Commit Graph

2567 Commits

Author SHA1 Message Date
Matthias Clasen
30073de932 widget: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
e034046724 widget: Convert docs
Some work toward converting the docs to markdown.

More work needed, in particular around vfuncs and
class functions.
2021-03-11 16:37:31 +00:00
Emmanuele Bassi
b2a99642a9 docs: Begin porting GtkWidget to the new format 2021-03-11 16:37:30 +00:00
Matthias Clasen
5556907194 inspector: Fix surface transform regression
Ever since we added surface-to-widget transforms,
the autofading of the fps overlay did not work anymore,
since it was given the transient transform node, most
of the time.

Fix this by passing both the root of the node tree and
the node for the toplevel widget to prepare_render, and
hande the widget node to the overlays. Update the
affected overlays that need to have their positioning
adjusted.
2021-03-09 18:27:04 -05:00
Alexander Mikhaylenko
8e2f90e342 widget: Don't assume GtkWindow root in gtk_widget_propagate_state()
Avoid crashes with GtkDragIcon children.
2021-02-18 13:41:41 +05:00
Emmanuele Bassi
958005317b Merge branch 'master' into 'master'
Improve the docs of GtkWidget and GtkGrid

See merge request GNOME/gtk!2946
2021-02-05 12:14:26 +00:00
Matthias Clasen
bf4102e664 Merge branch 'wip/exalm/consumes-motion' into 'master'
Drag fixes and cleanups

Closes #3513

See merge request GNOME/gtk!3001
2021-02-01 01:34:45 +00:00
Ungedummt
293b81cad2 Fix small typo in the docs of GtkWidget
In a XML example was MyGrid as a class defined; replaced with GtkGrid
2021-01-31 10:19:08 +01:00
Emmanuele Bassi
988ebc2248 docs: Annotate XML fragments as such
This way we can get syntax highlighting.
2021-01-29 16:31:10 +00:00
Emmanuele Bassi
9f31e95420 docs: Escape bare tags
Otherwise tools processing the description of GtkWidget will be *very*
confused.
2021-01-29 16:31:10 +00:00
Alexander Mikhaylenko
28f5d26719 windowhandle: Don't drag on capture phase
This was needed to work around widgets claiming event sequences on press,
by ignoring them and starting the drag anyway unless they have certain
event controllers on them.

The most visible offender was GtkButton, but since the last commit it
doesn't claim the sequence anymore and we can remove the hack.
2021-01-29 12:00:10 +05:00
Matthias Clasen
da59c77ae2 widget: Use subpixel positioning
Before turning off pangos rounding of glyph positions,
we must check if the cairo we are using is new enough
to have working subpixel positioning (the relevant
cairo commit is 52a7c79fd4ff96bb5fac175f0199819b0f8c18fc).
2021-01-28 18:17:22 -05:00
Matthias Clasen
10d5705b70 Reduce use of GtkStyleContext
Remove some unnecessary uses of GtkStyleContext where
we can directly go to the GtkCssStyle, and and drop
unnnecessary includes.
2021-01-28 12:27:07 -05:00
Sophie Herold
b89376da55 widget: get_name() is not nullable
Partial revert of !2905
2021-01-27 17:49:17 +00:00
Matthias Clasen
8ef1d6a49c widget: Fix can-focus
Setting can-focus to FALSE on a widget is supposed
to prevent focus from entering the entire subtree.
So when we grab focus directly to a widget, we need
to check the can-focus flag not just of the widget
itself, but all its ancestors.

Fixes: #3610
2021-01-26 23:45:06 -05:00
Matthias Clasen
344f9fcf05 css: Implement transform-origin
Implement most of transform-origin. We only
handle the xy components currently, which lets
us reuse the position value implementation that
is used for background-position.
2021-01-24 22:49:08 -05:00
Emmanuele Bassi
95ceb49770 a11y: Make GtkATContext realization lazier
We only realize the ATContext on the top level, which will create an
GtkAtSpiRoot object and the corresponding GtkAtSpiCache object. Whenever
an AT connects to the accessibility bus, and asks for the various
objects, all the ATContext will be realized on demand.
2021-01-21 16:40:57 +00:00
Timm Bäder
5ea3777599 widget: Fix gtk_widget_class_add_binding() argument name 2021-01-17 08:12:14 +01:00
Timm Bäder
872b46a527 widget: Shorten get_halign() a bit 2021-01-17 04:39:26 +01:00
Matthias Clasen
d89ff71819 Flip margin-start and -end in RTL
We lost this at some point, but the widget margins
are still meant to be relative to the text direction.

Fixes: #3583
2021-01-15 14:58:21 -05:00
Benjamin Otte
4761641098 Add critical if widget has a parent during dispose
This is a refcounting bug. Be very verbose about it instead of trying to
call a function that releases a reference to the widget without
references.
2021-01-07 11:39:32 -06:00
Timm Bäder
699adb0b10 widget: Refactor gtk_widget_class_set_template()
Don't call gbytes_get_data/get_size so often and exit early if the given
bytes is already precompiled.
2021-01-03 11:01:29 +01:00
Timm Bäder
c91b5eaa41 widget: Inline setup_template_child() into only caller
This is a pretty short and self-contained function.
2021-01-03 11:01:29 +01:00
Timm Bäder
06cce81a97 widget: Use gtk_widget_get_native() in get_surface_allocation() 2021-01-03 11:01:29 +01:00
Timm Bäder
92ec754737 widget: Move quark_builder_set_id declaration to other GQuarks 2021-01-03 11:01:29 +01:00
Timm Bäder
d11fbbc478 widget: Re-arrange some more functions 2021-01-03 11:01:29 +01:00
Timm Bäder
f11f0da11c wiget: Fix whitespace issues
Switch from tabs to spaces everywhere consistently and remove all
trailing whitespace.
2021-01-03 11:01:29 +01:00
Timm Bäder
ebdf2989f8 widget: Move a few vfunc implementations above class_init
And save us the prototypes at the top of the file this way.
2021-01-03 11:01:29 +01:00
Emmanuele Bassi
af0973c847 a11y: Fix removing mnemonic widgets
We must not use the variadic arguments version with GList, as it expects
a pointer to a GtkAccessible.
2020-12-17 15:49:00 +00:00
Emmanuele Bassi
fb93baeae4 docs: Add missing description for GtkWidget::move-focus 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
2c97d44281 docs: Fix the Widget as Buildable example
The layout properties use an old name.
2020-12-11 23:41:51 +00:00
Matthias Clasen
1f141c1953 Merge branch 'wip/surface-state-rework' into 'master'
Rework surface state and geometry computation

See merge request GNOME/gtk!2885
2020-12-08 15:38:36 +00:00
Jonas Ådahl
8a599b2582 gtk: Allocate everything from GtkNativeClass::layout
This changes allocation of the widget trees to happen as a side effect
to the GdkSurface::layout signal, which first passes the GtkNative
instance where it is then forwarded to the implementations of the
GtkNative interface.

The implementations of GtkNative are the ones doing the actual
gtk_widget_allocate(), and they do so in their GtkNativeClass::layout
function.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecc861bf06 Pass the layout signal via GdkSurface to GtkRoot
Don't have GtkRoot listen directly to the layout signal on the frame
clock, but let it pass through GdkSurface. This will allow GdkSurface to
be more involved in the layout phase.
2020-12-07 09:46:39 +01:00
Emmanuele Bassi
d8c9a67d20 docs: Clarify gtk_widget_activate()
We need to tell people what signal will be emitted when calling
gtk_widget_activate(), and that the shortcuts API might be more
appropriate to what they are looking for.
2020-12-06 15:13:57 +00:00
Emmanuele Bassi
c352fe9ab0 Move activate_signal to the widget private class data
Instead of having it as a field in the class structure.
2020-12-06 15:06:18 +00:00
Emmanuele Bassi
fe9c0db603 Add getter for WidgetClass.activate_signal
Just like we have a setter.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
e5e18ddffb Add private method to check activatability
We should have an actual method, instead of checking the
WidgetClass.activate_signal directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
b3e03fa6f0 Add wrappers for setting the WidgetClass.activate_signal field
Setting a field on a class structure is not always an easy task from
languages other than C. While bindings can provide access to the class
pointer, twiddling the fields in the class structure can be awkward.
Additionally, signal ids are not always readily available.

We can paper over the direct access to the class structure, as well as
the "signal name to id" mapping with a simple couple of setter
functions.
2020-12-05 01:04:18 +00:00
Matthias Clasen
ab9e99218f docs: Remove mentions of <accelerator>
That is no longer supported, keyboard shortcuts
are done with GtkShortcut now.

Fixes: #3429
2020-12-02 19:59:44 -05:00
Matthias Clasen
af944aa74c widget: Add a missing nullability annotation 2020-12-02 10:08:58 -05:00
Matthias Clasen
b5077d02ed Clarify the docs for gtk_widget_class_set_css_name
Reword, and mention the default css name.
2020-12-02 10:06:01 -05:00
Timm Bäder
2d43ecf8ca widget: root child before emitting child observer signals
Try to avoid the childen_observer signal handlers screwing up internal
state.

Fixes #3364
2020-11-30 09:21:52 -05:00
Christoph Reiter
b97b95b0c7 gtkwidget: fix crashes with GTK_A11Y=none
at_context can be NULL in that case, so guard against it.

Fixes #3333
2020-11-15 15:59:31 +01:00
Carlos Garnacho
80de00a248 gtk/main: Stack ::active calls
We may have the situation of multiple touchpoints in the same
widget, or combinations with other devices. Stack those ::active
states are preserved on widgets on all but the last pointer/touch
going away.
2020-11-13 00:39:23 +01:00
Matthias Clasen
5d9799d4e3 Merge branch 'ebassi/for-master' into 'master'
ATContext lifetime fixes

Closes #3341

See merge request GNOME/gtk!2811
2020-11-12 12:35:23 +00:00
Emmanuele Bassi
8157717e03 a11y: Add missing fallback for accessible-role getter
If the per-instance accessible role is unset, use the class role.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
9052f6dafe a11y: Rework ownership and lifetime of GtkATContext
Now that GtkATContext is explicitly realized and unrealized, we should
always create an instance at widget initialization time, and drop it
during the widget finalization. This should make it easier to set up the
initial accessible state of a widget during the instance initialization,
as well as reduce the chances of accidental creation of GtkATContext
instances during the destruction sequence.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
428ec29598 a11y: Unrealize ATContext on dispose()
By unrealizing the context we avoid additional work during the dispose
phase, in case widget code updates the accessible state. We use
GtkAccessible's API, to ensure we unrealize the right ATContext, instead
of the one we store inside GtkWidgetPrivate.

We drop the ATContext instance inside GtkWidget during finalization, to
mop up eventual vivifications there.
2020-11-11 18:33:15 +00:00
Matthias Clasen
27c4c19333 Don't hide widgets in dispose()
This is leftover code from when widgets were hidden
by default, and was setting them back to their initial
state.

This is getting in the way now, as hiding the widget
updates the HIDDEN accessible state, which ends up
re-creating the at context that we've already disposed
of, leading to memory leaks.
2020-11-11 10:35:54 -05:00