Commit Graph

157 Commits

Author SHA1 Message Date
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -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
303ff60d5e modelbutton: Avoid a crash
We may not have a popover menu ancestor. The check for
this was forgotten in one of the branches here.

Fixes: #3831
2021-04-05 14:06:42 -04:00
Matthias Clasen
3205cc79a7 modelbutton: Remove SECTION
Its private, no need.
2021-03-11 16:37:37 +00:00
Matthias Clasen
efbb649eee modelbutton: Center titles
The centering of titles was broken in b5b81dea7f.
Make it mostly work again by adding an empty end indicator.

Related: #3405
2020-12-23 00:51:51 -05:00
Matthias Clasen
fcd449f0d4 modelbutton: Remove an unused field
We're not using the centered field anymore.
2020-12-21 17:45:01 -05:00
Carlos Garnacho
5155fac94f gtk/modelbutton: Handle unpaired releases
Let model buttons handle unpaired releases, these may happen indirectly
e.g. due to other child menus being opened at the time. Clicking would
dismiss the menu, but the menu item beneath the pointer would not get
activated.

We can handle that button release though via ::unpaired-release, so
there's no second click required.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3463
2020-12-12 01:42:42 +01:00
Emmanuele Bassi
213024a560 Use function setter for WidgetClass.activate_signal 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
2e146a56f7 docs: Mark GtkModelButton's section as private
The widget is not public any more.
2020-12-02 19:05:41 +00:00
Timm Bäder
dc13ff97e2 modelbutton: Reset active menu item on pointer leave
We don't want to leave an active menu item behind if the pointer doesn't
enter another menu item.
This matches the old GtkMenu behavior
2020-11-30 09:23:03 -05:00
Matthias Clasen
c2ae73f247 popover: Fix submenu navigation
In commit 024d832d94, we introduced a
cascade-popdown property that makes closing a submenu
propagate up and close its parent menus. This is the
behavior we want when a menuitem in the submen is
activated.

What we overlooked is that we still need to be able to
close a submenu during navigation, before opening another
one. And in this case, propagating the closing is breaking
things. Fix this by adding a private close_submenu api
to GtkPopoverMenu that avoids the propagation.

Fixes: #3301
2020-11-16 21:34:33 -05:00
Matthias Clasen
6891f40110 modelbutton: Fix keynav for check and radio
The expected behavior when activating check or radio
menuitems via keynav is that Space toggles the item
but keeps the menu open, while Return toggles the
item and closes the menu.
2020-11-15 21:52:07 -05:00
Emmanuele Bassi
f8bb206034 a11y: Icons in buttons are presentational
Buttons are described by text, and the icon child can be safely ignored.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
9ac4a7d99f a11y: Simplify GtkModelButton
Instead of recreating GtkATContexts in order to change their role, we
can simply unrealize and realize them back.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
ed7619ec16 a11y: Clone GtkATContext in GtkModelButton
The hypothetical widget that needs to clone ATContext instances
because it needs to control the accessible role post-construction is
really GtkModelButton.

Fixes: #3342
2020-11-10 14:31:57 +00:00
Emmanuele Bassi
c264254d4b a11y: Parse reference lists using varargs
Using GList is a bit lame, and makes the API more complicated to use
than necessary in the common case.

The only real use case for a GList is gtk_widget_add_mnemonic_label(),
and for that we can use the GValue-based API instead.

Fixes: #3343
2020-11-10 14:31:56 +00:00
Matthias Clasen
6cd3bc7384 modelbutton: Explicitly set up LABELLED-By relation
GTK does this automatically based on mnemonics, but only
if the string actually contains a mnemonic. This makes
orca read out menuitems, as expected.
2020-10-26 22:48:01 -04:00
Matthias Clasen
3e43dda9d4 modelbutton: Recreate our AT context
When the button role changes, we want to update the
accessible role to match. Since accessible roles are
unchangeable post-creation of the AT context, we have
to cheat a bit and recreate the whole context.
2020-10-21 21:27:38 -04:00
Matthias Clasen
f96a1cfadd modelbutton: Initial accessibility setup
Set the accessible role to GTK_ACCESSIBLE_ROLE_MENU_ITEM.
This is incomplete, we need to recreate the context when
the buttons role changes, and there are other things that
need to be set.
2020-10-21 21:27:38 -04:00
Matthias Clasen
a772d8fcac Merge branch 'wip/baedert/for-master'
Leaving out the gboolean -> bool change.
2020-10-14 15:07:09 -04:00
Timm Bäder
eca3eab96f Remove unneeded gtkstylecontext.h includes 2020-10-14 15:06:12 -04:00
Carlos Garnacho
a939203e6e gtkmodelbutton: Drop special case to close GtkPopoverMenu
With ::cascade-popdown in place, this special case is not necessary
anymore.
2020-10-13 16:55:53 +02:00
Matthias Clasen
81f84fbe8f modelbutton: Claim the gesture
This aligns the model button behavior with what
GtkButton does.
2020-09-04 13:20:33 -04:00
Matthias Clasen
c7b6c2f441 Remove GtkRadioButton references in the docs 2020-08-30 21:23:25 -04:00
Matthias Clasen
ae7cefd97d Drop style class defines
We document the supported style classes by name,
not by macro name, and these macros don't really
add any value. Drop them for GTK 4.
2020-08-14 07:03:27 -04:00
Matthias Clasen
8562c623d3 Drop GtkAccelLabel
We no longer use this widget anywhere.
2020-08-04 23:05:18 -04:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Matthias Clasen
2a24b8c653 Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
2020-05-11 22:38:21 -04:00
Matthias Clasen
edc31a264c widget: Add a :focusable property
Add back a property that determines whether an individual
widget will accept focus or not. :can-focus prevents the
focus from ever entering the entire widget hierarchy
below a widget, and :focusable just determines if grabbing
the focus to the widget itself will succeed.

See #2686
2020-05-10 23:24:48 -04:00
Matthias Clasen
236fc57329 modelbutton: Unify activation code paths
Opening submenus by Enter or Space wasn't working,
because we had different code paths for activation
via keynav and via click. Unify them.
2020-05-06 20:27:04 -04:00
Matthias Clasen
8683925fe0 modelbutton: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
b55195fa2e Move the idle sizer to GtkWindow
This was only living in gtkcontainer.c for historic
reasons. Move it closer to where it belongs, and
rename it from 'idle' to 'layout', since it is
really about the layout phase of the frame clock,
nowadays.
2020-04-20 16:30:45 -04:00
Timm Bäder
c7d871570f Revert "modelbutton: Emit ::clicked() before closing the popover"
This reverts commit 57f913b753.
2020-04-17 16:43:17 +02:00
Matthias Clasen
7caed3a462 Merge branch 'assorted-menu-fixes' into 'master'
Assorted menu fixes

See merge request GNOME/gtk!1704
2020-04-17 14:12:20 +00:00
Timm Bäder
57f913b753 modelbutton: Emit ::clicked() before closing the popover
The clicked handler might still need the popover.
2020-04-17 15:21:00 +02:00
Matthias Clasen
17cb92889a modelbutton: Don't show accels without text
We don't want to show accelerators in iconic buttons.
2020-04-17 09:04:26 -04:00
Matthias Clasen
c09c61769c modelbutton: Catch focus-in more carefully
We need to unset the propagation limit on the focus
controller, else we miss the focus-in when the focus
enters the popover upon initial popup, when it comes
from the parent button.
2020-04-09 22:22:28 -04:00
Timm Bäder
ecb8dda309 shortcutscontroller: Make add_shortcut transfer-full
Like all the other shortcut api
2020-03-27 08:36:32 +01:00
Matthias Clasen
b19d4b9006 modelbutton: Install accels when inside a popover
When a model button in a popover displays a shortcut,
it is probably from the global shortcut controllers,
and will not work inside the popover, since that is
a different native. Install a shortcut using the same
trigger that just activates the model button. This
shortcut will end up in the managed shortcut controller
of the popover.
2020-03-25 23:14:45 -04:00
Matthias Clasen
5153cdc01d modelbutton: Make activatable
This is expected of button-like widgets, and is necessary
to make keynav in popover menus work as expected.
2020-03-25 23:14:45 -04:00
Matthias Clasen
1db5382c6d modelbutton: Remove accel poking
Stop manually poking GtkApplication for accels.
GtkApplication already feeds them into the action
muxer machinery, so that is where will get them.
2020-03-25 23:14:45 -04:00
Benjamin Otte
66102dacf1 accellabel: Move gtk_accelerator_get_label() code
The function lives in gtkaccelgroup.c, so there's no need to have that
call a private function in another source file. Instead, make that
other source file call gtk_accelerator_get_label() instead.
2020-03-25 23:14:27 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Benjamin Otte
93af53a2fc accellabel: Move gtk_accelerator_get_label() code
The function lives in gtkaccelgroup.c, so there's no need to have that
call a private function in another source file. Instead, make that
other source file call gtk_accelerator_get_label() instead.
2020-03-18 23:00:50 -04:00
Matthias Clasen
b5bacb3be6 Drop the margin property
Replace it with margin-start, -end, -top, -bottom throughout.
2020-02-25 20:59:04 -05:00
Timm Bäder
df3b88483d modelbutton: Fix wrong function name in doc comment 2020-02-25 11:08:25 +01:00
Matthias Clasen
a43d13aa74 popover: Drop ::relative-to
It is enough to just set the parent (and make the parent
call gtk_native_check_resize in size_allocate).

This commit removes the relative_to argument to the
constructors of GtkPopover and GtkPopoverMenu, and
updates all callers.
2020-02-24 20:46:41 -05:00
Matthias Clasen
cadeca74e2 Go back to ::enter/::leave for pointer changes
These signals are behaving a little differently from
what ::focus-in/::focus-out used to do.
2020-02-21 00:51:03 -05:00
Matthias Clasen
5a2f829a40 Split off GtkEventControllerFocus
Split the focus tracking into a separate
GtkEventControllerFocus, and change the API one more time.
We are back to having ::focus-in and ::focus-out signals.

Update all users.
2020-02-21 00:51:03 -05:00