Commit Graph

35141 Commits

Author SHA1 Message Date
Peter Bloomfield
d85f02a994 file-system-model: Avoid use-after free
This is a possible fix for https://gitlab.gnome.org/GNOME/gtk/-/issues/2657

Use a NULL return from g_file_query_info_finish() to detect cancellation
of the query, and avoid derferencing a stale pointer.
2020-04-26 16:47:23 -04:00
scootergrisen
01ebd00f97 Remove a "-" 2020-04-26 20:44:04 +00:00
Matthias Clasen
dc99a7aa61 stackswitcher: Drop the Private struct 2020-04-26 15:48:46 -04:00
Matthias Clasen
508ed21786 progressbar: Drop the Private struct 2020-04-26 15:44:44 -04:00
Matthias Clasen
2356c9b503 overlay: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
bf77694557 linkbutton: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
5bd2b49064 fontchooserdialog: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
a78e0f1188 fontchooserwidget: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
7ede3b919c calendar: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
2ea7f47089 separator: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
9156be6bf1 viewport: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
0b6cd34b1d Merge branch 'matthiasc/for-master' into 'master'
widget-factory improvements

See merge request GNOME/gtk!1767
2020-04-26 19:20:47 +00:00
Matthias Clasen
2dfd1404ff inspector: Make the resource tab play videos
We can do this easily, so why not. This can be
seen in action with gtk-logo.webm, e.g. in gtk4-demo.
2020-04-26 14:08:40 -04:00
Alexander Mikhaylenko
7874b29ec2 Adwaita: remove margin from GtkWindowControls when empty 2020-04-26 20:24:20 +05:00
Matthias Clasen
7f1e82d1bc Merge branch 'wip/exalm/titlebuttons' into 'master'
GtkWindowControls + GtkHeaderBar cleanups

See merge request GNOME/gtk!1755
2020-04-26 13:09:35 +00:00
Alexander Mikhaylenko
5321f8f195 headerbar: Use GtkWindowControls
Now that the title buttons are encapsulated in a separate widget, use
it in the header bar.

Hide them when empty, so that they don't add extra spacing.
2020-04-26 15:13:15 +05:00
Alexander Mikhaylenko
4aa8f6f73c Add GtkWindowControls
Move some code out of GtkHeaderBar and into a separate widget, making it
reusable in process.

See https://gitlab.gnome.org/GNOME/gtk/issues/2242
2020-04-26 15:13:15 +05:00
Matthias Clasen
637890517b Move the idle sizer to the gtkroot.c
This is needed since we already have a second GtkRoot
implementation with GtkDragIcon, and DND is causing
critical warnings due to this.
2020-04-25 21:03:57 -04:00
Matthias Clasen
b64f889cd9 fixed: Fix an oversight in size requisition
We need to take orientation into account when applying
child transforms. This is what broke the background-image-multiple
reftest.
2020-04-25 13:18:34 -04:00
Matthias Clasen
fdc4335eba menu: Dismiss submenus during keynav
We need to dismiss submenus explicitly on left arrow,
otherwise the grab interferes with our keynav.
2020-04-25 12:14:04 -04:00
Matthias Clasen
4936e7f859 Cosmetics
Reduce casting.
2020-04-25 11:54:29 -04:00
Matthias Clasen
8b64e29ba6 menu: Ignore leaves due to grabs
When we open a submenu we get a leave due to the grab,
but we don't want to unset the active item then.
2020-04-25 11:46:43 -04:00
Carlos Garnacho
2c23546ba9 gtktexthandle: Set parent through API call
The GtkWidget::parent property went readonly, use the API call
to ensure the text handle has a parent set.
2020-04-25 00:09:41 +02:00
Carlos Garnacho
9ed579505d gtktreeview: Ensure to transiently prelight on touch input
Some machinery (like clicking on expander) relies on prelight state
being up to date, but we don't set prelight on touch events. Do that
transiently, as long as a row is clicked.

Fixes tapping on expanders.
2020-04-24 23:14:51 +02:00
Carlos Garnacho
67e1acd4d7 gtkpopover: Roll back properly if presenting the popup fails
If the popover fails to be shown, it would internally undo visible
and mapped state. If we just proceed as normal, the widget enters
in inconsistent state, and a grab remains issued on the invisible
widget, preventing further input from the input device.
2020-04-24 23:06:52 +02:00
Carlos Garnacho
d104efe06e gtkwindow: Correct device check
This function to revoke implicit grabs may be called with a NULL
device, which means all devices should be revoked. Fix the check
so this actually happens.

Fixes implicit grabs (maybe) being unset in result to a GTK grab.
2020-04-24 23:04:27 +02:00
Carlos Garnacho
2a877a9be5 gtkwindowgroup: Take default group into account when listing windows
Otherwise, no windows belong to the default group, paradoxically.
2020-04-24 23:03:13 +02:00
Carlos Garnacho
777fd92eba gtkpadcontroller: Avoid filling action list with empty elements
We don't need to set the array size if we are adding elements afterwards.
2020-04-24 22:21:08 +02:00
Alexander Mikhaylenko
2791c522d8 headerbar: Remove decoration-layout-set property
It's unnecessary and only complicates the API. Use decoration-layout if
it's not NULL, and GtkSettings otherwise.
2020-04-24 23:54:07 +05:00
Alexander Mikhaylenko
18114bafe0 headerbar: Remove title button separators
They have had opacity: 0 for a while, just remove them.
2020-04-24 23:54:07 +05:00
Matthias Clasen
b2deab6adf Drop gtk_widget_has_grab
This was just a leftover in our public api.
All other grab-related apis are gone.
2020-04-23 14:10:44 -04:00
Benjamin Otte
389575ee18 Merge branch 'wip/exalm/window-headerbar' into 'master'
First steps for #2242

See merge request GNOME/gtk!1739
2020-04-23 15:26:30 +00:00
Alexander Mikhaylenko
7c4694ca3c window: Stop listening to headerbar title changes
Remove another dependency.
2020-04-23 19:26:10 +05:00
Alexander Mikhaylenko
610d5794ac headerbar: Update window buttons automatically
Update the layout when any of the following properties changes:
 * modal
 * transient-for
 * resizable
 * deletable

Stop updating it from GtkWindow, make that function static.
2020-04-23 19:26:10 +05:00
Matthias Clasen
b0f2cd02ad window: Tweak visible focus behavior
Only turn on visible focus when a key event actually leads
to a change in focus location (ie, 'keynav').

Make the visible focus disappear after 5 seconds of no
keyboard interaction, to avoid permanent focus ring
distraction.

As an extra bonus, make it so that we make the focus
visible while the Alt key is pressed. This gives us
a 'find my focus!' shortcut, and goes well with the
prexisting use of Alt for finding mnemonics.

Discussed in: #2644
2020-04-23 09:33:26 -04:00
Jakub Steiner
7fe51a876c Merge branch 'wip/jimmac/uniform-checkboxes' into 'master'
Adwaita: lower glyph contrast for checkboxes

See merge request GNOME/gtk!1745
2020-04-23 11:44:47 +00:00
Jakub Steiner
424a86a6a6 Adwaita: lower glyph contrast for checkboxes
- stylistic choice didn't sit well with majority of the design team
2020-04-23 10:53:02 +02:00
Matthias Clasen
f4b1762072 Adwaita: Add padding to circular button rows in menus
The lack of this was negatively affecting the spacing
of these buttons.

Fixes: #2626
2020-04-22 22:42:04 -04:00
Matthias Clasen
ba45d7a991 menusectionbox: Improve circular button spacing
In the n == 2 case, we want to avoid the buttons being
drawn all the way out to the ends of the box, but in the
n >= 3 case, that is exactly what we want for the first
and last button.
2020-04-22 22:16:46 -04:00
Benjamin Otte
8b1e857a67 Merge branch 'fix-icontheme-invalidation' into 'master'
Fix icontheme invalidation

See merge request GNOME/gtk!1733
2020-04-23 00:13:26 +00:00
Matthias Clasen
94906d076a Drop gtk_widget_reset_style
There was a single call left that should not be necessary.
Also drop no longer used attached-window functionality.
2020-04-22 19:30:48 -04:00
Matthias Clasen
a199060728 Drop gtk_style_context_reset_widgets
This is no longer used.
2020-04-22 19:30:48 -04:00
Matthias Clasen
7b4378bc46 widget: Update when font settings change
Update the pango context when font-related settings
change, using the new GtkSystemSetting mechanism.
2020-04-22 19:30:48 -04:00
Matthias Clasen
679863af4f image: Invalidate icon helper when icon theme changes
This is necessary to drop the cached image.
2020-04-22 19:30:48 -04:00
Matthias Clasen
a59cb5dfa6 icontheme: Call gtk_system_setting_changed
When the icon theme changes, we want to both initiate
a css SOURCE change (since css values may depend on the
icon theme), as well as calling gtk_system_setting_changed,
since widgets need to drop cached images, e.g. in GtkIconHelper.
2020-04-22 19:30:48 -04:00
Matthias Clasen
4b13d99cfe settings: Call gtk_system_setting_changed
Replace calls to gtk_style_context_reset_widgets by
gtk_system_setting_changed, with the appropriate setting,
and add style invalidation where required.
2020-04-22 19:29:59 -04:00
Matthias Clasen
129b8bb7f1 window: Use gtk_system_setting_change
Propagate GTK_SYSTEM_SETTING_DISPLAY when the display
of the window changes.
2020-04-22 19:29:15 -04:00
Matthias Clasen
723d57eeb5 widget: Add a system_setting_changed vfunc
This gives us a hook to walk the widget tree whenever a global
setting changes and do per-widget invalidations. This will
replace gtk_style_context_reset_widgets().
2020-04-22 19:29:15 -04:00
Matthias Clasen
58ca3b05c9 css: Compare icon theme serials
When comparing to icon theme image values for equality,
take the serial of the icon theme at compute time into
account.
2020-04-22 19:22:41 -04:00
Matthias Clasen
fe6ef5256b icontheme: Keep a serial
This will let us identify when we have to re-lookup
icons because they may have changed despite the theme
object being the same.
2020-04-22 15:18:16 -04:00
Emmanuele Bassi
c0d18ebff2 Fix annotations for GtkCustomLayout
Silence the warnings from the introspection scanner.
2020-04-22 19:24:45 +01:00
Alexander Mikhaylenko
451c3279ee window: Introduce actions for window buttons
Add the following actions:
 * window.close
 * window.toggle-maximize
 * window.minimize

Ensure they are disabled when not appropriate, such as for modal windows.

Use them in GtkHeaderBar.
2020-04-22 23:01:12 +05:00
Alexander Mikhaylenko
016eac0645 header-bar: Track window icon changes
Listen to icon-name changes if it's in a GtkWindow. This allows to remove a
special case for headerbar-as-titlebar from GtkWindow.
2020-04-22 23:01:12 +05:00
Alexander Mikhaylenko
cead405831 header-bar: Don't assume there's only one icon
Instead of tracking the titlebar icon widget, and updating it when the icon
changes, update the window buttons completely.
2020-04-22 23:01:12 +05:00
Matthias Clasen
2ddff872cd css: Drop the -gtk-icon-theme property
We want to always use the current icon theme, and only
have the minimum amount of custom properties.
2020-04-22 12:35:30 -04:00
Matthias Clasen
7aeef71a49 css: Get the icon theme via the settings
We don't have a css value for it anymore, but we
still need the current icon theme to interpret
icon names.
2020-04-22 12:35:30 -04:00
Matthias Clasen
98611735ec Stop using the -gtk-icon-theme style property
We want to just use the current icon theme, always.
2020-04-22 12:35:22 -04:00
Alexander Mikhaylenko
2240eb5c99 header-bar: Stop showing application menu
The application menu isn't particular relevant anymore, and the support for
showing fallback appmenu as a headerbar icon is one of the things tying
GtkWindow to GtkHeaderBar.

Remove support for "menu" window decoration element completely, update
GtkHeaderBar docs.
2020-04-22 21:30:19 +05:00
Alexander Larsson
e75bc2833d icon-theme: Fix deadlock in GktIconTheme dispose
When freeing the display GtkIconTheme and that was the last owner we
ran into a deadlock, because we unref the "next-to-last" ref inside a
gtk_icon_theme_ref_aquire/release() pair, which makes the final unref
to happen in the release(), while the ref lock still was held.
The unref triggers dispose which tries to NULL out the ref, but that then
deadlocks on the mutex being held by the caller already.

We fix this by moving the release unref outside the lock. This is safe
because refcounts are atomic, and we *do* own the ref.
2020-04-22 12:20:57 -04:00
Jakub Steiner
9fe6bc0792 HC: fix switch slider borders
- HC got caught up on a condition made for color (suggested) buttons.
  the rule just made the slider a tag lighter on dark probably due to the
  overlaid AA making it stronger. Got rid of it for now, if someone cares
  enough we can reintroduce an exception (that doesn't break HC).
2020-04-22 11:59:40 +02:00
Matthias Clasen
e026a04e03 Merge branch 'fix-placesview-popover' into 'master'
placesview: Fix up the address entry help popover

Closes #2642

See merge request GNOME/gtk!1731
2020-04-21 22:27:57 +00:00
Emmanuele Bassi
30c386dde9 Merge branch 'missing-annotation' into 'master'
widget: Add missing callback annotation

See merge request GNOME/gtk!1732
2020-04-21 21:56:43 +00:00
Christian Hergert
55dd737ea0 textview: fix assertion when toggling caret visibility
When toggling caret visibility (with F7) we would hit an assertion if the
cursor is currently blinking. This adjusts things to ensure that we should
be showing the carent when scheduling our blink timeouts.

Fixes #2647
2020-04-21 13:39:50 -07:00
Matthias Clasen
1edfd80528 Adwaita: Some styling for menu section titles
More fine-tuning needed.
2020-04-21 14:55:14 -04:00
Matthias Clasen
654af88529 Change the approach to menu section titles
Put the label below the separator, and give
it the title style class.
2020-04-21 14:48:39 -04:00
Florian Müllner
8e2ffb3b46 widget: Add missing callback annotation
GI can only figure out the correct scope if there's a GDestroyNotify
or GAsyncReadyCallback parameter.
2020-04-21 16:35:07 +02:00
Matthias Clasen
0ebcf8c02e placesview: Fix up the address entry help popover
Popovers without parent don't work anymore. Set a
parent, a fix up the position.

Fixes: #2642
2020-04-21 07:43:52 -04:00
Jakub Steiner
89ebe9e456 HC: export public colors
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2641
2020-04-21 12:39:34 +02:00
Matthias Clasen
6185cf95fb Fix label accessibility
Emit accessible change signals after setting the
new selection limits. This was broken in
commit f6bedd0d5e, and showed up as broken
accessibility tests.
2020-04-20 23:16:23 -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
Matthias Clasen
841c4a8cfe container: Cosmetic doc cleanup
Remove remnants of child properties from the
documentation. They no longer exist.
2020-04-20 16:30:45 -04:00
Matthias Clasen
d756c6e282 Move set_focus_child to GtkWidget
Move the set_focus_child vfunc from GtkContainer
to GtkWidget. This removes the last focus functionality
from GtkContainer.

Update the two users.
2020-04-20 16:30:43 -04:00
Carlos Garnacho
b20f21df24 gtkpopover: Set GTK grab on autohide popovers
These popovers handle clicks outside the widget, and expect input
to be routed through it when it is shown. This pretty much matches
the characteristics of GTK grabs, and setting one up will ensure
the cancellation of event controllers that were active at the time
of showing the popover.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2446
2020-04-20 20:28:05 +02:00
Matthias Clasen
2869f80bc0 Merge branch 'docs-work' into 'master'
Docs work

See merge request GNOME/gtk!1727
2020-04-20 05:33:02 +00:00
Matthias Clasen
b4c79bad34 Assorted documentation fixes 2020-04-20 00:38:58 -04:00
Matthias Clasen
013cc09651 widget: Remove some leftovers
gtk_widget_can_activate_accel is gone, so remove the
vfunc and declaration.
2020-04-19 23:44:50 -04:00
Nelson Benítez León
66e802596a GtkFileChooserWidget: fix refactor regression
Commit 4a3742979d which removed
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER slipped
a bad g_assert() refactoring, which is causing
a crash when selecting a folder in a GtkFileChooserButton
dialog.

Fixes #2635
2020-04-19 18:00:37 -04:00
Matthias Clasen
e91907d427 Docs: Various tweaks
Tweak the docs for library initialization, versioning
and settings, and remove some outdated information.
2020-04-19 16:26:25 -04:00
Matthias Clasen
7f3125fc69 Some minor documentation fixes 2020-04-19 10:42:10 -04:00
nana-4
2afd10b537 Adwaita: Fix and simplify infobar styling
- Apply sizing regardless of style class.
- Fix bottom border not reaching the bottom corners.
- Remove unnecessary style overrides that should have been removed
  during the redesign.
2020-04-19 20:10:52 +09:00
nana-4
47bfa49118 Adwaita: Fix link styling
- Fix broken visited link styling by avoiding invalid selector
  `🔗visited` - CSS :link and :visited are mutually exclusive.
- In link button, move %link from the child label to the parent button,
  so that the hover/active effect is applied within the whole button and
  the visited style is applied correctly.
- Remove invalid selectors `:backdrop:backdrop`.
2020-04-19 15:21:40 +09:00
Matthias Clasen
2cd152c2ed Merge branch 'fix-css-filter-transitions' into 'master'
css: Allow transitioning between different units again

See merge request GNOME/gtk!1719
2020-04-19 02:00:26 +00:00
Matthias Clasen
a7cad79092 css: Allow transitioning between different units again
This turns out to be necessary for transitioning filters,
and we run into criticals if transitioning numbers
unexpectedly returns NULL. I've observed that with

* {
  filter: invert(80%);
}

This was broken in c9e972eecb.
2020-04-18 21:10:32 -04:00
Matthias Clasen
661b8c3d1a Merge branch 'matthiasc/for-master' into 'master'
css: Give none singletons unique names

See merge request GNOME/gtk!1718
2020-04-18 22:52:15 +00:00
Matthias Clasen
853de6c511 Merge branch 'wip/fix-multi-popup-hide' into 'master'
Fix autohiding popup chain

See merge request GNOME/gtk!1717
2020-04-18 22:33:52 +00:00
Matthias Clasen
45bcffd637 statusbar: Don't use a frame
This frame serves no purpose anymore, and now that frames
draw frames, it shows up annoyingly.
2020-04-18 17:29:13 -04:00
Matthias Clasen
1e7c56db19 Merge branch 'focus-adjustment' into 'master'
Drop container focus adjustments

See merge request GNOME/gtk!1716
2020-04-18 20:59:50 +00:00
Jonas Ådahl
aa72318581 popover: Fix indentation 2020-04-18 22:33:29 +02:00
Matthias Clasen
ef8e8ba14d css: Give none singletons unique names
This makes for a less confusing experience in gdb.
2020-04-18 15:24:13 -04:00
Matthias Clasen
1c472cca00 Drop gtk_container_set_focus_[hv]adjustment
This functionality should be provided by scrollables, see
for example by the recently added GtkViewport:scroll-to-focus.
2020-04-18 14:59:44 -04:00
Matthias Clasen
ee4a7798c9 flowbox: Stop setting focus adjustments 2020-04-18 14:45:29 -04:00
Matthias Clasen
b339bde6a5 inspector: Use the new scroll-to-focus 2020-04-18 14:43:48 -04:00
Matthias Clasen
13b6b9f2b4 scrolledwindow: Stop setting focus adjustments
Stop setting focus adjustments on the automatically
generated viewport.
2020-04-18 14:43:48 -04:00
Matthias Clasen
66347fa3bf viewport: Add GtkViewport:scroll-to-focus
And implement this property by listening for focus
changes, and updating the adjustments. This is a
replacement for setting focus adjustments on containers.
2020-04-18 14:43:48 -04:00
Nelson Benítez León
2c7d54791c GtkPlacesSidebar: avoid location clicks to grab focus
Sibebar location rows should not grab focus on click.

Fixes filechooser issue #1469
2020-04-18 14:43:02 -04:00
Matthias Clasen
8e45e15a11 colorchooser: Fix a crash
Don't crash when we start removing custom colors
that happen to be currently selected.
2020-04-18 03:29:13 -04:00
Matthias Clasen
323394e8b5 emojichooser: Drop focus adjustment setting
It is not needed here, we are now scrolling
differently.
2020-04-18 03:29:13 -04:00
Matthias Clasen
d53f3a54b1 filechooser: Cosmetic doc changes 2020-04-17 20:08:21 -04:00
Matthias Clasen
e880abfaf3 drawingarea: Cosmetic docs fix 2020-04-17 20:05:04 -04:00
Matthias Clasen
6a4f788976 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #1899 and #2627

See merge request GNOME/gtk!1709
2020-04-17 23:34:15 +00:00
Matthias Clasen
19dbbf6fa5 aspectframe: Modernize
Make GtkAspectFrame not derive from GtkFrame anymore,
since frames now always draw, well, a frame. Also,
add proper setters for the properties of GtkAspectFrame.

Update our sole user.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2627
2020-04-17 17:38:52 -04:00
Emmanuele Bassi
dd23a37ca1 Reconcile documentation with declaration and definition
The arguments name in the documentation must match declaration and
definition, or gtk-doc and g-ir-scanner will get very cross at us.
2020-04-17 22:34:10 +01:00
Emmanuele Bassi
d46e1288a4 Copy axes when rewriting events 2020-04-17 22:23:32 +01:00
Matthias Clasen
b5d17d2f9b Adwaita: Add focus to expander
We were not drawing a focus indication at all for
expanders. Bring it back. Also, make the color plane
focus snug.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/1899
2020-04-17 16:24:44 -04:00
Matthias Clasen
79267674ff popovermenu: Reinstate section title handling
We were creating a hbox with separators around the label,
but forgot to arrange sizing to prevent the separators from
shrinking into nothingness.
2020-04-17 13:53:56 -04:00
Matthias Clasen
d4e53b14cb Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1703
2020-04-17 16:23:29 +00:00
Matthias Clasen
ad7118ef9a calendar: Fix focus keynav
This broke when the calendar was broken into widgets.
2020-04-17 10:57:36 -04:00
Matthias Clasen
909120ec78 Drop GtkReliefStyle
We are not using this enum anymore.
2020-04-17 10:57:36 -04:00
Matthias Clasen
12d5fdd457 menubutton: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
df1816a29c button: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
fdbbef863d Drop GtkShadowType
We are not using this enum anymore.
2020-04-17 10:57:36 -04:00
Matthias Clasen
47ac0db66c viewport: Drop shadow-type
The viewport draws a frame at the same place as
the scrolled window, so there is really no need
to have that ability in both. Just drop the frame
from viewports.
2020-04-17 10:57:36 -04:00
Matthias Clasen
edae2a8dc5 frame: Drop shadow-type
Frames that don't draw frames are not very useful,
so just drop the shadow-type property.
2020-04-17 10:57:36 -04:00
Matthias Clasen
ffbc58d328 treeviewcolumn: Stop using a frame
There is no desire to draw a frame here, so don't use a GtkFrame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
285aa226e5 scrolledwindow: Drop shadow-type
We were only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
f297d0684d scrolledwindow: Document the .frame style class 2020-04-17 10:57:36 -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
f4acde371e snapshot: Avoid a save/restore pair if we can 2020-04-17 15:21:00 +02:00
Timm Bäder
aad67743b9 label: Ignore setting attrs from NULL to NULL 2020-04-17 15:21:00 +02:00
Timm Bäder
1886648652 text: unconditionally unref attr list
pango_attr_list_unref() works on NULL
2020-04-17 15:21:00 +02:00
Timm Bäder
67c2665028 text: Avoid creating a PangoAttrList we don't need
It's going to be empty, unless we have preedit_attrs
2020-04-17 15:21:00 +02:00
Timm Bäder
5d61abd748 label: Redraw when text attrs are affected by css change
GtkWidget doesn't do it automatically and probably shouldn't
2020-04-17 15:21:00 +02:00
Timm Bäder
9f6ec5b7d4 label: Don't create an unnecessary attribute list 2020-04-17 15:21:00 +02:00
Timm Bäder
78e6475f9f label: Only parse mnemonic attributes if we need to 2020-04-17 15:21:00 +02:00
Timm Bäder
6289f7eecd label: Ignore AFFECTS_ATTRS css changes if we can
It's only interesting if we either already have attributes, or the new
style adds some.
2020-04-17 15:21:00 +02:00
Timm Bäder
9ad0dbb145 label: Inline function into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder
db9fbb3918 label: Remove some unused quarks 2020-04-17 15:21:00 +02:00
Timm Bäder
afaa352142 label: Remove priv pointer 2020-04-17 15:21:00 +02:00
Timm Bäder
3b7cb31157 label: Stop connecting to notify::gtk-enable-accels
Leftover from when GtkAccelLabel was a GtkLabel subclass. GtkAccelLabel
connects to this itself these days though.
2020-04-17 15:21:00 +02:00
Timm Bäder
f0b33cdc53 label: Set underline text and markup in one step
Try to unify the way we parse the mnemonic character
2020-04-17 15:21:00 +02:00
Timm Bäder
203b0c9c9d label: Fold set_pattern_internal into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder
1ea24e98c1 adwaita: don't extent %link in linkbuttons
We already do that for the label inside the button.
2020-04-17 15:21:00 +02:00
Timm Bäder
36248c609d label: Remove GtkLabel:track-visited-links
Always track visited state of links. This way all visited links in all
labels look the same. Whether the theme wants to style :visited is the
theme's business.
2020-04-17 15:21:00 +02:00
Timm Bäder
f6bedd0d5e label: Remove a11y-only properties
Update them manually instead.
2020-04-17 15:21:00 +02:00
Timm Bäder
8f96b38539 label: Fold function into only caller
This makes it more obvious that gtk_label_setup_mnemonic() depends on
the root of the widget and it therefore makes sense to call it in
::root/::unroot.
2020-04-17 15:21:00 +02:00
Timm Bäder
813be8a921 label: Don't normalize booleans in internal setters
We almost always pass a literal TRUE/FALSE to them.
2020-04-17 15:21:00 +02:00
Timm Bäder
21ac2330af stylecontext: Remove get_pango_attributes
Make the only caller use GtkCssNode API.
2020-04-17 15:21:00 +02:00
Timm Bäder
584a71ae96 cssstyle: Only create PangoAttrList if there are attribtues
Don't allocate a new GString if we never need it and therefore don't
create the PangoAttrList if we have no attributes anyway. Update callers
to handle the possible NULL return value.
2020-04-17 15:21:00 +02:00
Timm Bäder
2e14ea84f3 label: Pull all pango attributes from the theme
Dont' force an underline attribute here. Just ask the theme for the
text-decoration.
2020-04-17 15:21:00 +02:00
Timm Bäder
4737495e3c label: Fix an old TODO comment 2020-04-17 15:21:00 +02: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
Timm Bäder
4851081a77 label: Remove public pattern API 2020-04-17 15:21:00 +02:00
Timm Bäder
13fde6f4cd label: Shorten set_markup_internal a bit 2020-04-17 15:21:00 +02:00
Timm Bäder
1db53e6676 label: Avoid duplicating a string
We only use str_for_accel if with_uline is TRUE.
2020-04-17 15:21:00 +02:00
Timm Bäder
74b5eaa700 label: Pass <markup> length directly when parsing markup 2020-04-17 15:21:00 +02:00
Timm Bäder
b16157bc0d label: Remove a double if (needs_root) check
The code is clearer and shorter this way.
2020-04-17 15:21:00 +02:00
Timm Bäder
7a98e79d90 label: Use widget API to add style class 2020-04-17 15:21:00 +02:00
Timm Bäder
c588d8f858 label: Clear select info before creating a new one
E.g. set_markup_internal will create a new select_info, but then we were
destroying it again, just to recreate it later.
2020-04-17 15:21:00 +02:00
Timm Bäder
23cffdfe42 label: Save a few LOC 2020-04-17 15:21:00 +02:00
Timm Bäder
99998d25f8 label: Save links in an array
Stop using GList for this.
2020-04-17 15:21:00 +02:00
Timm Bäder
ca47e96d35 widget: Return an array from list_devices
To forther reduce the GList usage in the code base.
2020-04-17 15:21:00 +02:00
Timm Bäder
e583349956 accelgroup: Restructure gtk_accelerator_name
To fix invalid reads and make the function a bit shorter while we're at
it.

Fixes #2602
2020-04-17 15:21:00 +02:00
Timm Bäder
7bc4daae2f main: Stop using GList when propagating events
There are still some cases missing.
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
726a7ac705 inspector: Fix a crash
Don't crash while picking. The event signal broke
when GdkEvent was turned into a type instance,
since the automatic marshallers don't know how to
deal with that. Manually set the right marshaller.
2020-04-17 08:37:45 -04:00
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Emmanuele Bassi
96cfb12946 Fix annotations for GtkEventController 2020-04-16 19:40:00 +01:00
Emmanuele Bassi
5abb6f2a61 Fix annotation for gtk_show_uri_full()
The callback is now an asynchronous closure.
2020-04-16 19:40:00 +01:00
Emmanuele Bassi
0d065bca6d Fix compiler warning
Newer versions of GCC are fairly aggressive with NULL checks.
2020-04-16 19:40:00 +01:00
Matthias Clasen
b3b194532d Merge branch 'matthiasc/for-master' into 'master'
themes: Fix HighContrast dependencies

See merge request GNOME/gtk!1701
2020-04-16 18:05:19 +00:00
Matthias Clasen
d36e41c6b8 themes: Fix HighContrast dependencies
HighContrast themes now depend on sass files from Adwaita.
2020-04-16 12:40:37 -04:00
Matthias Clasen
4516bfbc88 Adwaita: Some adjustments for :focus-within
Use :focus-within for focus in entries, since the
actual focus is on the text within, and :focus for
notebooks, since we don't want to draw an outline
around the notebook when the focus is in content.
2020-04-16 12:31:17 -04:00
Matthias Clasen
54b99d281b Add a focus-within state
This is used for widgets that contain the focus widget,
reserving the focused state for the focus location itself.

This aligns our focus state handling with
https://www.w3.org/TR/selectors-4/
2020-04-16 12:31:01 -04:00
Matthias Clasen
03080f29b9 css: use :focus-visible instead of :focus(visible)
This is aligning our language with
https://www.w3.org/TR/selectors-4/
2020-04-15 23:09:36 -04:00
Matthias Clasen
dbd578eaef window: Don't set is-active twice
We are listening to focus change events for this
no need to duplicate the work in ::state-changed.
2020-04-15 17:08:15 -04:00
Nelson Benítez León
45d7051dff GtkFilechooserWidget: prevent oblivious selection of file
which could happen after confirming the "file overwrite"
dialog and may result in a different file being overwritten
causing data loss.

The oblivious file selection can be done by a mouse
click or keyboard press sent inadvertently just after
confirming the "file overwrite" dialog (and before the
enclosing GtkfilechooserDialog is closed).

Fixed by adding a flag to ignore any button/key press
events sent to the file list. We set this flag just
after the user accepts the "file overwrite" dialog (which
means the enclosing GtkfilechooserDialog is about to
get closed). And we restablish the flag when the dialog
is shown again (in its map() handler).

Fixes data loss issue #2288
2020-04-15 16:46:43 -04:00
Matthias Clasen
8e9406a082 Move key event rewriting
Stop rewriting key and focus events on the GDK side.
Instead deliver them as they are, and propagate them
from the root on the gtk side, in gtkmain.c. And
stop complaining about focus events on popups - we
can just ignore them if we have no use for them.
2020-04-15 14:56:32 -04:00
Matthias Clasen
031b248c20 window: Fix setting :is-active
We want to listen to focus events from the windowing
system here, relying on crossing events for this doesn't
work.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2612
2020-04-15 14:43:00 -04:00
Matthias Clasen
a2a194f71e eventcontroller: Fix signal marshallers
GdkEvent is no longer a GObject. Any signals taking
events as arguments need to have their marshallers
fixed. Thankfully, we have few of these left.
2020-04-15 14:36:04 -04:00
Jakub Steiner
b6353a6369 Adwaita: drop text shadows for buttons
- People seem to misunderstand the unsharp-mask-like increase
  of visual contrast for "fuziness". That is not the reason for
  the change. The stylistic change of just going with flat
  text label allows to simplify the code and drop complexity.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2280
2020-04-15 18:27:49 +02:00
Jakub Steiner
97ceb03008 Merge branch 'wip/jimmac/checkradio-focus' into 'master'
Adwaita: check & radio focus ring

See merge request GNOME/gtk!1690
2020-04-15 15:47:14 +00:00
Jakub Steiner
a5234f2d09 Merge branch 'wip/jimmac/active-state-for-checkradios' into 'master'
Adwaita: fix active state for radios & checkboxes

Closes #2493

See merge request GNOME/gtk!1689
2020-04-15 15:47:09 +00:00
Jakub Steiner
faaf80dd46 Merge branch 'wip/jimmac/levelbar-punch' into 'master'
Adwaita: no edge highlight

Closes #2494

See merge request GNOME/gtk!1691
2020-04-15 15:45:05 +00:00
Jakub Steiner
e6fcac29b5 Adwaita: slightly increase contrast for treeview borders
- sligtly increase contrast for the treeview borders
- FIXME: High Contrast seems to drop the borders completely,
  there might be some trickery for using border-left-color and
  border-top-color this way as even forcing the color 'red' seems
  to render invisible on HC.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2238
2020-04-15 14:55:33 +02:00
Jakub Steiner
3f9ee61a36 Adwaita: no edge highlight
- Levelbars and progressbars are indicators, not controls. They don't
  need no affordance signifier. Make it flat!

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2494
2020-04-15 13:56:12 +02:00
Jakub Steiner
097b585bbc Adwaita: check & radio focus ring
- this slipped through Frederik's patch
2020-04-15 13:45:59 +02:00
Jakub Steiner
ed2a4e2d93 Adwaita: fix active state for radios & checkboxes
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2493
2020-04-15 13:34:41 +02:00
Matthias Clasen
fb2502fa5f Merge branch 'emoji-keynav' into 'master'
Emoji keynav

See merge request GNOME/gtk!1687
2020-04-15 05:34:03 +00:00
Matthias Clasen
4e6b62e564 emojichooser: link sections for keynav
Make Up/Down jump between sections in the Emoji grid.
2020-04-14 15:07:58 -04:00
Matthias Clasen
8f75df1cb3 flowbox: Add a private api to disable move-cursor
Without this, it seems impossible to make cross-section
keynav in the Emoji chooser work. I've tried, but got
lost between the focus, grab_focus, move_cursor and
keynav-failed vfuncs and signals, and their competing
implementations GtkFlowBox and GtkEmojiChooser.
2020-04-14 15:07:47 -04:00
Matthias Clasen
037b0259d8 flowbox: Remove can-focus handling
With the new meaning of can-focus, this doesn't make
sense anymore.
2020-04-14 15:07:10 -04:00
Arnaud Bonatti
8c769ea3f3 Fix typo in IconTheme.
The add_search_path() method was
using the resource_path property
in place of the search_path one.
2020-04-14 20:43:06 +02:00
Matthias Clasen
7179e8d5f3 emojichooser: Improve keynav, again
When the focus is moved to one of the Emoji children,
scroll it into view.
2020-04-14 13:25:20 -04:00
Matthias Clasen
325a485315 emojichooser: Improve keynav
Add an action to scroll to the next or previous section,
and bind it to Ctrl-n/Ctrl-p.
2020-04-14 13:25:20 -04:00
Matthias Clasen
eb5b3083ff Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1685
2020-04-14 14:07:54 +00:00
Matthias Clasen
6870159c1d build: Prepare library versioning
Set version and soversion separately for the library.
When we do the 4.0 release, we will set:

gtk_soversion = '1'
gtk_library_version = '1.0.0'

See https://gitlab.gnome.org/GNOME/gtk/-/issues/1963
2020-04-14 09:15:31 -04:00
Matthias Clasen
a072e16297 appchooserwidget: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen
78ac2f2d5b lockbutton: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen
9f5955e1b1 expander: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen
fa759272b0 colorswatch: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen
d802b35578 Merge branch 'wip/matthiasc/monitor-signals' into 'master'
Add enter/leave signals for monitors

See merge request GNOME/gtk!1680
2020-04-13 23:25:55 +00:00
Mathieu H
57a56538eb Remove the blacklist list in convert-emoji.c since now it is supported 2020-04-13 16:29:02 -04:00
Matthias Clasen
f97180beee inspector: Show scales other than 2
We were hardcoding that monitor scales can only be
1 or 2. Not true.
2020-04-13 09:17:46 -04:00
Matthias Clasen
64b0c63190 Merge branch 'modal-buttons' into 'master'
Modal buttons

See merge request GNOME/gtk!1679
2020-04-13 11:15:14 +00:00
Matthias Clasen
8ff540eb4c appchooserbutton: Drop the Private struct 2020-04-13 01:08:52 -04:00
Matthias Clasen
9194b7388f Add a GtkAppChooserButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-13 00:43:19 -04:00
Matthias Clasen
6831d3e28e fontbutton: Drop the Private struct 2020-04-13 00:32:50 -04:00
Matthias Clasen
800f1c03d5 Add a GtkFontButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-13 00:28:34 -04:00
Matthias Clasen
7a0355fcb1 colorbutton: Drop the Private struct 2020-04-13 00:28:11 -04:00
Matthias Clasen
15d58a868a Add a GtkColorButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-13 00:17:00 -04:00
Matthias Clasen
61f21fc9e9 filechooserbutton: Make dialog modal by default
This is the expected behavior, so default to it.
2020-04-13 00:12:30 -04:00
Matthias Clasen
9e068d3a46 filechooserbutton: Drop the Private struct 2020-04-12 23:57:49 -04:00
Matthias Clasen
2aa136a19c Add a GtkFileChooserButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-12 23:45:03 -04:00
Matthias Clasen
08fbd012ec window: Make resize cursors work for modal dialogs
We were inadvertedly not letting the grab_widget determine
a cursor. This was showing up as resize cursors not appearing.
2020-04-12 22:18:50 -04:00
Matthias Clasen
19f7b7ed40 Adwaita: visible focus outline for color swatches
Make the focus outline for color swatches visible
again.
2020-04-12 20:13:50 -04:00
Matthias Clasen
e3dba28666 Merge branch 'arnaudb/better-substitution' into 'master'
Fix some gtk-builder-tool substitutions.

See merge request GNOME/gtk!1675
2020-04-12 22:53:54 +00:00
Matthias Clasen
17a9b13af2 text: Be more careful with cached layouts
If we call any functions that may call ensure_layout
themeselves, we risk having the cached layout pulled
out from underneath. Better play it safe and take a
reference.
2020-04-12 17:32:57 -04:00
Matthias Clasen
1efa781a19 window: Cosmetic cleanup
Use a convenience function to get the current event time.
2020-04-12 17:32:13 -04:00
Matthias Clasen
0a19d7ef08 textview: Fix an erroneous unref
This was left behind by accident in 0ee58e9ef4.
2020-04-12 17:32:13 -04:00
Arnaud Bonatti
926fb208ba Coding style improvements. 2020-04-12 21:21:24 +02:00
Arnaud Bonatti
11a43cf554 Replace also margin-left and margin-right. 2020-04-12 19:28:29 +02:00
Arnaud Bonatti
17ec74da35 Fix a gtk-builder-tool substitution.
The margin-left and margin-right properties have been
removed in favor of margin-start and margin-end ones.
2020-04-12 19:28:29 +02:00
Matthias Clasen
ff53d5ba11 stylecontext: Respect cursor aspect ratio everywhere
We were using the new cursor aspect ratio setting in
the snapshotting code, but not in gtk_render_insertion_cursor.

Make them both behave the same.
2020-04-12 11:44:13 -04:00
Matthias Clasen
8a1a96a47e text: Fix placing the cursor on click
Commit c297d45b8a accidentally removed the
check for the right modifier mask, causing us to
always extend the selection.
2020-04-12 09:19:12 -04:00
Matthias Clasen
432b741ab7 gtk: Port all users to the new gtk_show_uri()
We were only handling the error in one place anyway.
2020-04-11 22:10:08 -04:00
Matthias Clasen
703f18ce66 Redo gtk_show_uri_on_window
Make this a full async function, and add a simple wrapper.

Call gtk_show_uri_full() if you need control over the
results, and use gtk_show_uri() if you are fine with
ignoring any errors.
2020-04-11 21:56:32 -04:00
Matthias Clasen
feee281cf8 Drop gtk_get_current_ apis
We have event controller apis to replace these.
There is one remaining use of gtk_get_current_event_time
in gtkwindow.c, so we can't drop the implementation yet.

Add a section in the migration guide for this.
2020-04-11 17:29:27 -04:00
Matthias Clasen
4b346538e2 gtk: Port widgets away from gtk_get_current_ apis
This commit handles complicated cases where we selections.
We handle this by adding extend and modify parameters to
the ::move-cursor signals, and adjust the bindings
accordingly.
2020-04-11 17:29:27 -04:00
Matthias Clasen
0ee58e9ef4 gtk: Port widgets away from gtk_get_current_ apis
Use the event controller equivalents where needed.
This commit covers the simple cases.
2020-04-11 17:29:27 -04:00
Matthias Clasen
bd56bc9055 Add gtk_event_controller_get_current_event[_state]
For now these are private, to replace internal uses
of gtk_get_current_event[_state], but we may want to
make them public.
2020-04-11 17:29:27 -04:00
Matthias Clasen
3e7e862415 gtk: Just use current time for showing urls
We don't really have an event anywhere close in most
cases, and we already pass GDK_CURRENT_TIME in half
the cases anyway.

If we want to be serious about this, we need to pass
the event itself, since future focus-stealing protocols
may not rely on just a timestamp.
2020-04-11 17:29:27 -04:00
Matthias Clasen
4eeb413047 entrycompletion: Remove an unused field
No point in storing a device that is never used.
2020-04-11 17:29:27 -04:00
Matthias Clasen
520ea7c39d Merge branch 'jjardon/more_licenses' into 'master'
gtk/gtkaboutdialog: Add some more very common licenses:

See merge request GNOME/gtk!1667
2020-04-11 16:47:32 +00:00
Javier Jardón
ffa345e4ab gtk/gtkaboutdialog: Add some more very common licenses:
- BSD 3-Clause "New" or "Revised" license
- Apache License 2.0
- Mozilla Public License 2.0
2020-04-11 16:49:09 +01:00
Emmanuele Bassi
e072d9b28b Merge branch 'gsk-public-symbols' into 'master'
Install all headers with public symbols

Closes #2607

See merge request GNOME/gtk!1666
2020-04-11 15:21:11 +00:00
Emmanuele Bassi
d08310096c Conditionally include the GSK broadway and vulkan symbols
In case GTK is built without these features.
2020-04-11 15:42:51 +01:00
Matthias Clasen
6b9ac1043b Document actions 2020-04-11 10:07:31 -04:00
Matthias Clasen
72a0828101 Merge branch 'respect-window-cursors' into 'master'
window: Respect widget cursors

See merge request GNOME/gtk!1663
2020-04-10 18:56:44 +00:00
Matthias Clasen
7379c34a39 window: Respect widget cursors
gtk_widget_set_cursor can be used on a GtkWindow; we
should not blow away the result when temporarily installing
resize cursors.
2020-04-10 14:36:55 -04:00
Matthias Clasen
a6a31827bc Remove gtk_style_context_reset_widgets
This should never be necessary to call from the outside.
Whenever we fail to update styles properly, it is a bug.
2020-04-10 12:45:28 -04:00
Matthias Clasen
394ea32e93 Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class
by the new APIs. The only remaining uses of the old API
are in save/restore situations.
2020-04-10 12:09:57 -04:00
Matthias Clasen
ad1bc75dd2 accelgroup: Fix an invalid write
This was lost by accident in d110fddbce.

Fixes: #2602
2020-04-10 08:24:03 -04:00
Matthias Clasen
8780906b93 Merge branch 'fix-radiobuttons' into 'master'
radiobutton: Fix selection on focus-in

Closes #2326

See merge request GNOME/gtk!1658
2020-04-10 04:17:37 +00:00
Matthias Clasen
58253d567f radiobutton: Fix selection on focus-in
We need to unselect the previously selected button
to preserve radioness.

Fixes: #2326
2020-04-09 22:38:30 -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
Matthias Clasen
9b5dc35650 popovermenu: Remove debug spew 2020-04-09 21:41:02 -04:00
Matthias Clasen
b15f16e8db Adwaita: Don't render focus around labels with links
This avoids the 'double outline' problem for labels
with links.

Fixes: #135
2020-04-09 21:19:36 -04:00
Matthias Clasen
e3b9dfef1c label: Improve link styling
Add a .link style class on labels that contain links,
so we can avoid the focus outline around the label
when individual links are focused, and use the link
node when rendering the focus on links.
2020-04-09 21:19:22 -04:00
Matthias Clasen
822c2aba36 scalebutton: Don't derive from GtkButton
Make GtkScaleButton a widget that has a toggle button
as a child, just like all the other button widgets now.
The immediate benefit of this arrangement is to avoid
the "double focus" problem when we pop up the popup.

Update accessible, demos and tests to match.
2020-04-09 20:43:45 -04:00
Matthias Clasen
16c820c2f0 Small documentation tweaks
Update the docs for GtkWidget:can-focus and :focus-on-click.
2020-04-09 18:26:31 -04:00
Matthias Clasen
72ae6daa1e Move focus to the parent if a popover is dismissed
This is better than just dropping focus altogether,
and is expected behavior in most cases.
2020-04-09 18:26:31 -04:00
Matthias Clasen
508cb6160c a11y: Fix focusable state
The :can-focus property is no longer very useful to
give an indication of what is focusable, since it is
TRUE for almost all widgets now. Patch things up
to by looking at known widget types.
2020-04-09 18:14:15 -04:00
Matthias Clasen
2ae08e632c color editor: Make the sample non-focusable again
This is one of the situations, where can-focus can still
be used to tweak focus behavior of leaf widgets. Color
swatches are focusable by default to allow selecting colors
with the keyboard. But when used as color samples, they
should not take focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen
22e1827f84 Change the default value of GtkWidget:can-focus
Make widgets can-focus by default, and change the semantics
of can-focus to be recursive . If it is set to FALSE, focus
can not enter the widget or its descendents at all anymore.

This commit temporarily breaks focus behavior of widgets
that did not expect to receive focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen
3c39613d9c widget: Add common focus vfunc implementations
Privately export a number of implementations for the focus
and grab_focus vfuncs that cover many common cases.
2020-04-09 17:50:29 -04:00
Matthias Clasen
46ff9f891a gizmo: Allow passing changing focus behavior
We need this in popovers. Maybe it could be done better
by defining one-off custom widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen
97ff1b83dc widget: Make the :has-focus property readonly
The only place where this should be set is when making
a widget the focus-widget of a window. We still keep
the property around in readonly form, since there are
a few places where we rely on property notification
for it.
2020-04-09 17:50:29 -04:00
Matthias Clasen
c1459cc45b widget: Drop the :is-focus property
This property doesn't carry any new information compared
to GtkWindow:focus-widget. We still keep the gtk_widget_is_focus
getter, as a convenient shortcut.
2020-04-09 17:50:29 -04:00