Commit Graph

2580 Commits

Author SHA1 Message Date
Matthias Clasen
4c2761302a doc: Syntax fixes
No, we can't have links that say [constructor@...] or
[mehtod@...] or [methoc@...] or [methos@...] or [metohd@...].
And no, not [signals@...] either.
2021-05-25 07:33:55 -04:00
Matthias Clasen
13a93489b7 widget: Cosmetic docs changes 2021-05-22 17:25:26 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Carlos Garnacho
f003a4c6cc gtkwindow: Simplify GTK grab notification
The _gtk_widget_grab_notify() function just (maybe) did a) reset
controllers and b) hide toplevels. The second part was a testing
remnant introduced in commit 024d832d94, not part of the original
fix.

Do the former more concisely, called from the place where we figure
out whether a widget's ability to receive events changed due to
GTK grabs. It's across those changes that we are interested in
resetting the controllers.

With the gestures being reset both ways, GtkWindowHandle (and
probably other) gestures are now able to reset after a GTK grab
takes input away (e.g. GtkMenuButton). This could be seen as
a sudden jump the next time they'd be dragged with the mouse,
as the gesture would "resume" the previous interaction.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3942
2021-05-18 00:16:48 +02:00
Matthias Clasen
bf454e948d Fix picking with transforms
When transforms include scales, we weren't picking
children properly. The special-case in gtk_widget_do_pick
only applies to 2D translations.
2021-05-12 20:58:16 -04:00
Matthias Clasen
32280090fe Check for root being a GtkWindow in a few places
These things were showing up as crashes during DND,
when the root is a GtkDragIcon. I'm sure there's more.
2021-04-30 13:45:39 -04:00
Matthias Clasen
a455db01a0 a11y: Actually set accessible roles
With most context realization happening inside
GtkAtspiContext in response to D-Bus calls, the
code in gtk_widget_realize_at_context that sets
the role is not executed for most accessibles,
causing them to be stuck with the 'filler' role
that makes orca ignore them.

To fix this, split gtk_widget_realize_at_context
into the actual context realization (getting on
the bus) and the setting of widget-specific
properties, and do the latter part when the
widget is rooted.

This makes accerciser report proper roles for
entries and buttons. Orca still has an issue
with getting the hierarchy populated.
2021-04-19 19:22:20 +01:00
Matthias Clasen
9e8187bdc4 a11y: Track window states more closely
Orca ignores events unless the object is inside an object
with role window and states ACTIVE and SHOWING. To arrange
for this, introduce a new ACTIVE platform state, and set it
for windows when they are active.

This gets orca to be a lot more talkative.
2021-04-19 19:22:20 +01:00
Emmanuele Bassi
0a7af75639 docs: Update annotations for WidgetClass.query_action()
The parameter_type and property_name out arguments can be set to NULL.

Fixes: #3757
2021-03-15 13:48:35 +00:00
Matthias Clasen
8d7103116a widget: Fix up some links
Fix up some links to vfuncs and to sections, as well as class methods.
2021-03-11 16:37:38 +00:00
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