Commit Graph

2182 Commits

Author SHA1 Message Date
Matthias Clasen
bda3c6c084 Merge branch 'wip/baedert/for-master' into 'master'
Improve the valgrind experience

See merge request GNOME/gtk!984
2019-07-09 19:39:13 +00:00
Robert Ancell
dbd2a81501 Change the few examples that use a full GTK_ enum value in .ui files.
Lowercase versions work just as well and are much more readable.
2019-07-08 15:52:28 +12:00
Timm Bäder
264d4bada6 widget: Remove queue_resize_no_redraw
We always invalidate the widget in size_allocate() anyway.
2019-07-07 07:43:08 +02:00
Timm Bäder
633172fd66 widget: Make queue_compute_expand() private
Nobody needs to call this anymore.
2019-07-07 07:36:29 +02:00
Timm Bäder
449c96ffb3 widget: Unref previous transform 2019-07-07 07:24:00 +02:00
Matthias Clasen
9768f35931 widget: Don't lose a layout manager ref
gtk_widget_set_layout_manager is transfer-full,
so we must give it a new reference from set_property
to implement object property semantics properly.
2019-07-03 09:18:41 -04:00
Matthias Clasen
895e8e25a8 widget: Implement GtkConstraintTarget 2019-06-30 23:42:44 +01:00
Emmanuele Bassi
e7b2c530c5 Propagate rooting and unrooting widgets to layout managers
Layout managers may need to get access to data attached to the root of a
scene graph.
2019-06-30 23:42:44 +01:00
Matthias Clasen
2405e2711e Add a non-varargs variant of activate_action
I recently turned gtk_widget_activate_action()
into a varargs function. That is more convenient
from C, but we need a non-varargs variant for
bindings. So add the old API back, under the
name gtk_widget_activate_action_variant(),
with a rename-to annotation.
2019-06-24 15:51:39 +00:00
Matthias Clasen
3acc014499 Make gtk_widget_activate_action better
As a convenience API, this should be easy to use,
so don't expect callers to manually create a
variant, do it for them.

Update all callers.
2019-06-23 22:51:55 +00:00
Matthias Clasen
3ebe30bf32 widget: create parent muxers lazily
We need to create a muxer eagerly for every
widget that has class actions, since those
are otherwise missed in the action lookup
on the muxer side. But otherwise, there is
no reason to create parent muxers aggressively,
as long as we update the parent muxers on
root/unroot.

This reduces the number of muxers we create
in widget-factory from 210 to around 50.
2019-06-23 17:59:41 +00:00
Matthias Clasen
203d612afd widget: Clarify docs for action inheritance
Spell out how action inheritance works wrt to prefixes.
2019-06-22 19:17:30 -04:00
Matthias Clasen
1f0904d3df widget: Teach query_action about property actions
This might be useful for documentation purposes.
2019-06-22 17:04:01 -04:00
Matthias Clasen
35a88c1440 widget: Rename a function
set_enabled is shorter and more to the point
than enabled_changed, now that we no longer have
a callback to query the state.

Adapt all callers.
2019-06-22 17:03:51 -04:00
Matthias Clasen
d1f4068b94 Replace stateful actions by property actions
The only cases of stateful actions we've seen
so far have been boolean properties, and we
don't really want to add much state handling
API, so lets just go with property actions
for now.

Adapt the only user in GtkText.
2019-06-22 17:03:38 -04:00
Matthias Clasen
7e73da5f73 widget: Add parameter type back to install_action
Adapt all callers.
2019-06-22 16:48:16 -04:00
Matthias Clasen
412006ad23 Add owner types for widget actions
This lets us filter out actions from parent classes
when introspecting.
2019-06-22 09:38:30 -04:00
Matthias Clasen
ea456b80da Make actions minimally introspectable
This will let us autogenerate some docs for
actions, in the future.
2019-06-21 22:47:40 -04:00
Matthias Clasen
152eabbaba widget actions: Add an explicit state type
Make the state type part of the API for installing
stateful widget actions. That lets us introspect it.

Update all callers.
2019-06-21 22:47:40 -04:00
Matthias Clasen
ef031e1a9d Allow registering actions per-class
Add a facility to register and install actions
at class init time. The intended use for these
actions is for

a) context and other model-based menus
b) key bindings

Most of these actions are going to be stateless,
so add separate apis for the simple and stateful
cases.

We avoid creating an action group for these by
teaching the action muxer about these actions.
The action muxer also maintains the enabled
state for these actions.
2019-06-18 14:47:33 -04:00
Matthias Clasen
9b62da10e6 Give the action muxer a widget
This will be used in the future to obtain
widget class actions.
2019-06-18 06:12:50 -04:00
Matthias Clasen
cc667926d6 Drop gtk_widget_get_action_group
Ths api exposes too much of the internal
action muxer setup; we want to add actions
to the muxer without an action group.
2019-06-15 21:41:11 -04:00
Matthias Clasen
9bb2d1eb5c widget: Remove gtk_widget_list_action_prefixes
This function was added just for the inspector,
and is not used there anymore. Drop it.
2019-06-15 21:40:38 -04:00
Matthias Clasen
21a5c7f0eb layout managers: Handle native children
Add a convenience api to skip children
that should not be included in the layout,
and call gtk_native_check_resize on all
native children outside of the vfunc.
2019-06-11 14:52:30 -04:00
Matthias Clasen
ddee5cfc43 widget: Improve focus handling
Make gtk_widget_real_focus do the right
thing for focusable widgets with children.

A case where this is (now) relevant is
an entry with a context popover.
2019-06-11 17:14:49 +00:00
Matthias Clasen
c1791d030a widget: Ignore natives for picking
The natives transforms are not set up properly
to make this work, so ignore them here, for now.
This my need to be revisited later.
2019-06-09 17:38:54 +00:00
Christian Hergert
828c36636c va_marshaller: add various va_marshallers
We don't need to cover every case with a va_marshaller, but there are a
number of them that are useful because they will often only be connected
to by a single signal handler.

Generally speaking, if I opened into a file to add a va_marshaller, I just
set all of them.
2019-06-06 15:30:42 -07:00
Matthias Clasen
0aa9e16294 Bring brink skip_allocate
This was removed by accident in 580aa8204f,
together with some no longer needed popover
special-casing.
2019-06-05 00:31:53 +00:00
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