Commit Graph

55056 Commits

Author SHA1 Message Date
Matthias Clasen
e283ed5523 Export some entry functions privately
This will be used in the following commits.
2018-04-23 18:54:43 -04:00
Emmanuele Bassi
3f307c59bd wayland: Allow a NULL inhibitors hash table
The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
2a87caf529 gtk-demo, testgtk: Don't pass an integer to fabs
It looks like a mistake which compilers are likely to warn.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
f57c1a2901 imcontextxim: Don't assign a variable to itself
This causes clang to show warnings.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
1517114d9f Fix header guards
They were found by clang.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
48af688940 build: Use cc.links to check linker arguments
Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
e882db2763 build: Make the default setting work on non-Linux Unix-like systems
All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.
2018-04-23 18:54:43 -04:00
Daniel Mustieles
7bb98674d0 Update Spanish translation 2018-04-23 14:18:20 +00:00
Emmanuele Bassi
fc57d3b5a3 wayland: Allow a NULL inhibitors hash table
The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.
2018-04-23 10:57:07 +01:00
Matthias Clasen
9178f74067 Merge branch 'wip/lantw/improve-freebsd-build-and-fix-warnings' into 'master'
Improve meson.build for FreeBSD and reduce the number of warnings during compilation

See merge request GNOME/gtk!123
2018-04-23 02:40:00 +00:00
Daniel Boles
e6deaa3a85 Widget: Add missing space in new warning 2018-04-22 23:12:18 +01:00
Daniel Boles
5c152192d7 themes: Fix a new comment
bah.
2018-04-22 22:21:35 +01:00
Daniel Boles
b92e688141 themes: Fix swapped borders on RTL PathBar buttons
.linked assumes the container is a GtkBox, which is documented as never
flipping children in RTL, so :first-child is always the left child, etc.
GtkBox does that by reordering its CSS nodes when the direction changes.

But most widgets don’t do that, so :first|last-child are 1st/last ADDED
and swap sides in RTL. GtkPathBar is so, and ignoring that in our themes
meant that in RTL, its left/right buttons got each other’s borders. Yuk!

This patch adds the groundwork for supporting widgets like that, via the
%linked_flippable placeholder, and applies that to override buttons in
  filechooser .path-bar.linked > button
so that the correct borders get applied to those buttons when using RTL.

Note that I select only PathBars within a FileChooser because we also
have NautilusPathBar, which also uses widget.path-bar – but *does* flip
its nodes for RTL already, so letting that get affected broke it again!

https://bugzilla.gnome.org/show_bug.cgi?id=772817
2018-04-22 22:06:50 +01:00
Daniel Boles
0401e031ad CheckMenuItem: Fix insert_after|before() here too
See the previous commit.

There may be other cases of these being swapped by Gadget conversions,
but hopefully someone else will find and fix those before I have to…

Close https://gitlab.gnome.org/GNOME/gtk/issues/200
2018-04-22 21:51:10 +01:00
Daniel Boles
95f65da038 MenuItem: Fix broken args to insert_before|after()
The widget & its parent were swapped to each other’s place in the calls.

https://gitlab.gnome.org/GNOME/gtk/issues/200
2018-04-22 21:49:41 +01:00
Daniel Boles
f36c8c219c Widget: Show widget name/addrs if fail to reparent
so we can more easily get an idea of where the problematic code is

https://gitlab.gnome.org/GNOME/gtk/issues/200
2018-04-22 21:49:41 +01:00
Daniel Boles
ae14fa4efd Widget: Trivially fix arg name in non-doc comment 2018-04-22 21:40:20 +01:00
Daniel Boles
5f7191b31a MenuButton: popover connects to menu_deactivate_cb
This was missed (even before my recent patches).

https://gitlab.gnome.org/GNOME/gtk/issues/199
2018-04-22 16:33:26 +01:00
Daniel Boles
279344a2e6 MenuButton: Disconnect newly added signal handler
Otherwise, we do stuff we shouldn't, as the failing pipeline showed:
https://gitlab.gnome.org/GNOME/gtk/pipelines/9431

https://gitlab.gnome.org/GNOME/gtk/issues/199
2018-04-22 16:33:26 +01:00
Daniel Boles
f403a311c9 MenuButton: Clarify NULL popup/over/menu/model doc 2018-04-22 16:11:18 +01:00
Daniel Boles
caa9255dd3 MenuButton: Drop ref to Popover on its ::destroy
Otherwise, if the Popover is destroyed before the MenuButton, the latter
still had a non-NULL but invalid instance and tried to use it in dispose

Close https://gitlab.gnome.org/GNOME/gtk/issues/199
2018-04-22 16:11:18 +01:00
Daniel Boles
1d636dc8d4 Entry: Show optional style classes in node diagram 2018-04-22 16:11:09 +01:00
Juan Pablo Ugarte
bc2fad6842 a11y/ScrolledWin|IconView: Connect signals safely
Use g_signal_connect_data() instead of g_signal_connect_object()
to make sure the callback gets disconnected when the data object
is destroyed. This avoids problems in garbage-collected bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=789215
2018-04-22 16:11:08 +01:00
Piotr Drąg
bef44a0c9d Update Polish translation 2018-04-22 16:13:56 +02:00
Ting-Wei Lan
43a7f36993 gtk-demo, testgtk: Don't pass an integer to fabs
It looks like a mistake which compilers are likely to warn.
2018-04-22 21:59:13 +08:00
Ting-Wei Lan
d3f40dc771 imcontextxim: Don't assign a variable to itself
This causes clang to show warnings.
2018-04-22 21:57:10 +08:00
Ting-Wei Lan
77637dc73b Fix header guards
They were found by clang.
2018-04-22 21:57:10 +08:00
Ting-Wei Lan
ff1dd5009c build: Use cc.links to check linker arguments
Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.
2018-04-22 21:57:10 +08:00
Ting-Wei Lan
f922109a9c build: Make the default setting work on non-Linux Unix-like systems
All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.
2018-04-22 21:57:10 +08:00
Benjamin Otte
7a09cd4cda widget: Position changes don't require a redraw
Well, they don't require a redraw of the widget, because the widget
itself didn't change.
They require a redraw of the parent, because that now displays the
widget in a different position.

And this means we can keep the cache of the widget's render node.

My fishbowl numbers are through the roof^W water surface. Vulkan gets
4000 now.
2018-04-22 02:57:47 +02:00
Benjamin Otte
c5bcc47ce7 demo: Don't add more icons all the time
If adding new icons takes longer than a second, the frame clock should
run before we add even more icons...
2018-04-22 02:57:47 +02:00
Timm Bäder
8d11e7685a build: Remove 'name' kwarg from has_function calls
They cause warnings with later meson versions.
2018-04-21 19:30:12 +02:00
Timm Bäder
f483fd539e build: Fix copy/paste error 2018-04-21 19:24:25 +02:00
Timm Bäder
5b453ecd19 Always use #ifdef for G_ENABLE_DEBUG
Release builds don't define it to 0, they just don't define it. Avoid
the compilation warning we get otherwise.
2018-04-21 19:18:20 +02:00
Timm Bäder
9b8ff8d6c3 sizerequestcache: Directly initialize some locals
Declaring them and initializing them in the same block of code without
an empty line in between is really just confusing.
2018-04-21 19:06:54 +02:00
Timm Bäder
1313234ae0 Use inlined gtk_widget_get_display version in a few places
We can safely do this whenever we already made sure that the given
pointer is a valid GtkWidget.
2018-04-21 19:06:21 +02:00
Timm Bäder
c3e02b2b22 widget: Add static inline version of gtk_widget_display()
Due to the few type checks in gtk_widget_get_display(), it was the
slowest part of a call to gtk_widget_query_size_for_orientation if the
in case of a cache hit.
2018-04-21 18:48:15 +02:00
Timm Bäder
1a24a360bd textview: Remove handling_key_event flag
It's not used anymore.
2018-04-21 15:45:47 +02:00
Timm Bäder
4f3c7cd48a gsk: Make gsk_text_node_new_with_bounds private
We pulled out the bounds calculation for performance reasons, but the
caller can't know how to properly compute them. Inside gtk+, we can do
that but it's not good enough for public API.
2018-04-21 11:20:15 +02:00
Timm Bäder
d74be1fcf0 gl renderer: Rename texture_id parameter to fbo_id
So this makes sense again.
2018-04-21 10:13:16 +02:00
Timm Bäder
ac268b1c5d widget: Use get_instance_private more often
To be more consistent with newer code. We can also save a few lines here
and there by pulling the priv initialization before the precondition
checks.
2018-04-21 10:06:57 +02:00
Timm Bäder
fae1bbb3fe sizerequestcache: Constify some locals
Make it clear that we only use them for lookups here.
2018-04-21 10:06:57 +02:00
Timm Bäder
bd855c11ab sizerequestcache: Use int instead of gint 2018-04-21 10:06:57 +02:00
Timm Bäder
bb412cdda1 sizerequest: Pull locals in closest scope 2018-04-21 10:06:57 +02:00
Timm Bäder
840504b60a snapshot: Fix some documentation problems 2018-04-21 10:06:57 +02:00
Timm Bäder
c948c9e51d viewport: Remove useless import
Just a debugging remnant
2018-04-21 10:06:57 +02:00
Timm Bäder
746c9dc278 viewport: Remove outdated comment 2018-04-21 10:06:57 +02:00
Timm Bäder
29f38056a9 gl renderer: Fix fallback node scaling 2018-04-21 10:06:57 +02:00
Matthias Clasen
cfa04805a3 Merge branch 'print-deserialize' into 'master'
printing: Be more careful when deserializing

See merge request GNOME/gtk!121
2018-04-20 21:37:13 +00:00
Matthias Clasen
6f4a77bb3c printing: Be more careful when deserializing
The GVariant we are getting here might not be coming
from GTK+, but rather from some other source. Best to
be forgiving and deal with missing data without crashing.

This was causing the GTK+ portal backends to crash on
print requests from Qt.
2018-04-20 16:58:36 -04:00