Commit Graph

2154 Commits

Author SHA1 Message Date
Timm Bäder
88344ccf4e widget: Unref priv->{allocated_,}transform 2019-06-03 17:03:02 +02:00
Matthias Clasen
17cd6d7f44 widget: Stop setting root coords in events
Nothing should use them anymore.
2019-05-31 23:36:35 +00:00
Matthias Clasen
8145872e27 Merge branch 'wip/chergert/remove-cclosure' into 'master'
gtk: rely on default marshallers

See merge request GNOME/gtk!893
2019-05-31 10:57:27 +00:00
Christian Hergert
bd26cce812 gtk: rely on default marshallers
Similar to previous removals of g_cclosure_marshal_VOID__VOID we can remove
other marshallers for which are a simple G_TYPE_NONE with single parameter.
In those cases, GLib will setup both a c_marshaller and va_marshaller for
us. Before this commit, we would not get a va_marshaller because the
c_marshaller is set.

Related to GNOME/Initiatives#10
2019-05-30 20:56:50 -07:00
Benjamin Otte
6b2518a190 widget: fix CSS transforms with margins
The CSS transform should operate on the border-box, not the margin box.
So we need to shrink the bounds by the margin before we apply the CSS
transform.
2019-05-31 05:36:50 +02:00
Christian Hergert
82afe850e8 marshallers: add missing g_cclosure_marshal_VOID__VOID fixes 2019-05-29 13:48:33 -07:00
Matthias Clasen
956e94a8d4 Remove a misleading comment
We don't have windowed widgets anymore, and
gdk_surface_move_resize is about to go away.
2019-05-29 18:04:08 +00:00
Matthias Clasen
b636e32d85 widget: Stop using gdk_device_get_position
Root coordinates are going away. Stop
setting them in crossing events, so we
can drop this api.
2019-05-29 18:04:08 +00:00
Benjamin Otte
cabe39862b widget: Add marshallers to signals
Yay for better sysprof logs!
2019-05-29 16:34:56 +02:00
Benjamin Otte
2380f9673b widget: Do proper clean up in real_hide()
Do the same things set_visible_flag() does.
2019-05-29 16:34:56 +02:00
Benjamin Otte
170c25a9d2 widget: Move functions around
Copy them further up so that we can use them there in the next commit.
2019-05-29 16:34:56 +02:00
Benjamin Otte
e85f1e176a widget: Insist on proper vfunc calling
Insist that ->show() is only called for invisible and ->hide only for
visible widgets.
2019-05-29 16:34:56 +02:00
Benjamin Otte
a079fd2def widget: Fix transform refcounting in allocate()
Make the transform (transfer full).

1. This makes sure we actually reference the transform. Previously we
   did not.
2. Most callers create a new transform to pass to us. Now they don't
   have to uref it anymore.
2019-05-29 16:34:56 +02:00
Matthias Clasen
693b2aa4d1 Drop gtk_widget_get_toplevel
Not used anymore.
2019-05-28 20:25:16 +00:00
Matthias Clasen
6674f2764e Drop gtk_widget_is_toplevel
No longer used.
2019-05-28 20:25:16 +00:00
Matthias Clasen
948347afa9 Stop using gtk_widget_is_toplevel 2019-05-28 20:25:16 +00:00
Matthias Clasen
8fc6f07327 Drop gtk_widget_get_surface
It is no longer used.
2019-05-28 20:25:16 +00:00
Matthias Clasen
302d2a04ae Stop using gtk_widget_get_surface
Replace all uses of gtk_widget_get_surface by
gtk_native_get_surface.
2019-05-28 20:25:16 +00:00
Matthias Clasen
b99962e7a2 Drop gtk_widget_set_surface
Not used anymore. Only GtkNative's have surfaces.
2019-05-28 20:25:15 +00:00
Matthias Clasen
43bed7986a Drop GtkWidget::surface
Unneeded.
2019-05-28 20:25:15 +00:00
Matthias Clasen
0047492bf9 Work toward dropping widget->surface
Drop special-casing of GtkNative in
most widget vfuncs. GtkNative implementations
need to override these anyway.
2019-05-28 20:25:15 +00:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
61247a8921 widget: Remove a popover special case
We never run this since GtkPopover has its
own size_allocate, anyway.
2019-05-28 20:25:15 +00:00
Matthias Clasen
f3559fe0f0 widget: Optimize resize propagation
When a GtkNative widget is marked as resize_needed,
we need a current position for its parent and we need
the parent to be allocated (so we can position our
surface), but we don't need the parent to be marked
as resize_needed, since the parent size is entirely
independent of the popup size.
2019-05-28 20:25:15 +00:00
Matthias Clasen
27596c328a widget: Improve warning messages
When we print warnings about a widget, using
gtk_widget_get_name() is slightly better than
G_OBJECT_TYPE_NAME(), since it will give us
the widgets unique name when available.
2019-05-28 20:25:15 +00:00
Matthias Clasen
bab5836e89 Drop gtk_widget_register_surface
This is no longer used.
2019-05-28 20:25:14 +00:00
Matthias Clasen
52c3507ae1 widget: Stop using child surface apis
All our surfaces are toplevels now, and thus all native.
2019-05-28 20:25:13 +00:00
Matthias Clasen
580aa8204f widget: Remove some unneeded popover special-casing 2019-05-28 20:25:13 +00:00
Matthias Clasen
6ab8ab87c8 Reimplement GtkPopover 2019-05-28 20:25:13 +00:00
Matthias Clasen
54662f4ca0 widget: Don't snapshot foreign children
When snapshotting, we walk down the widget tree.
We need to skip children that have a different
surface, since those will do their own snapshot.
2019-05-28 20:25:13 +00:00
Matthias Clasen
5de06f47cf widget: Use GtkNative 2019-05-28 20:24:39 +00:00
Matthias Clasen
9059eee2f0 Review and replace uses of get_toplevel
Now that roots can have parent widgets, we need to
carefully examine all calls of gtk_widget_get_toplevel,
and replace them with gtk_widget_get_root if we want
the nearest root, and not the ultimate end of the parent
chain.
2019-05-28 20:24:39 +00:00
Matthias Clasen
c1d5e82d95 Use GtkNative APIs instead of GtkRoot 2019-05-28 20:24:39 +00:00
Matthias Clasen
7dcb163ee6 Add gtk_widget_get_native
This is a common enough operation to deserve api.
2019-05-28 20:24:39 +00:00
Matthias Clasen
afcf3e66f6 widget: guard popover-specific code paths
This is essentially a special case just for GtkPopover,
which is the last widget with a child surface.
2019-05-28 19:54:32 +00:00
Matthias Clasen
ff1150d87c Export gtk_widget_render privately
We need it in gtkwindow.c and gtkpopover.c.
2019-05-28 19:54:32 +00:00
Timm Bäder
a474beb7b8 widget: Don't always call get_display() when allocating
The GTK_DISPLAY_DEBUG_CHECK macro will cleverly only call the function
if any of the display debug flags are set, so in the common case it
won't even be executed.
2019-05-21 08:17:13 +02:00
Benjamin Otte
fe592cd414 widget: Make gtk_widget_render() static 2019-05-18 17:06:08 +02:00
Matthias Clasen
c6a42e92bb widget: Revert the event translation change
This is a temporary revert to make menus work
in the 3.96 release, until we land the popup
surface work and port menus to it.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1755
2019-05-06 22:20:51 +00:00
Emmanuele Bassi
fe473dbef8 Make get_layout_manager_type() public
The inspector, and other tools introspecting the widget structure like
gtk-builder-tool and Glade, may very well want to access the default
layout manager used by a class, especially if there are layout
properties involved, without having a whitelist of widget/layout manager
associations.
2019-05-06 12:15:21 +01:00
Emmanuele Bassi
c6b2184aa0 Allow specifying the layout manager for a widget type
Some widgets have a well-defined layout manager created alongside their
own instance; if they do, we can handle the layout manager creation at
the GtkWidget instantiation.
2019-05-06 11:57:32 +01:00
Matthias Clasen
af2207bc0b widget: Reset controllers when going numb
Reset event controllers when their
widget is going insensitive. This is
the expected behavior.
2019-05-02 15:53:30 -04:00
Matthias Clasen
bea8025fb5 Drop the GtkWidget::display-changed signal
Display changes now happen exclusively through
the ::root and ::unroot vfuncs. Third parties
can observe display changes by listening
for notify::root.
2019-05-02 01:33:41 +00:00
Matthias Clasen
33a8108f19 window: Implement display change via root/unroot
Export gtk_widget_root/unroot privately,
make them work on roots, and use them in
gtk_window_set_display. This gets us to a
single way to listen for display changes,
the root property.
2019-05-01 23:05:09 +00:00
Matthias Clasen
92e21c3f1c Drop the can-default property
It was added at a time when default buttons
had a very large external border that would disrupt
aligment. Not a problem nowadays.
2019-04-28 23:28:39 +00:00
Matthias Clasen
59d50be737 widget: Drop gtk_widget_grab_default
The default widget is mostly a dialog concept,
and does not really need this generic api.

If you need to mark a widget as default,
use gtk_window_set_default() directly.
2019-04-28 23:23:11 +00:00
Matthias Clasen
6d73443131 widget: Remove special handling for has-default
We used to handle has-default specially in ui
files. It was awkward, so stop doing that. If you
need to influence the default widget in a window,
you can just set the default-widget property.
2019-04-28 23:23:11 +00:00
Matthias Clasen
f4880f5df5 Add gtk_widget_activate_default
This is a convenience wrapper for
activating the "default.activate" action.
2019-04-28 23:20:13 +00:00
Matthias Clasen
65052a5d6c Rename gtk_window_set_default
Call it gtk_window_set_default_widget, to match
the getter, and the property name. Update all
callers.
2019-04-28 23:20:13 +00:00
Matthias Clasen
aa8ada3fed widget: Add a convenience api to activate actions
Since actions are used increasingly, we should
have a convenient way to trigger an action in
the context of a widget.
2019-04-28 23:19:05 +00:00