Commit Graph

35141 Commits

Author SHA1 Message Date
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
Matthias Clasen
b3b29e37fd inspector: Drop more uses of can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
f996ba6585 inspector: Remove can-focus from ui files 2020-04-09 17:50:29 -04:00
Matthias Clasen
7ca36cd2d4 Stop setting can-focus in ui files
None of these settings are necessary.
2020-04-09 17:50:29 -04:00
Matthias Clasen
2a18f2150d window: Make set_focus equal to grab_focus
Make gtk_window_set_focus call gtk_widget_grab_focus internally.
This means that set_focus can now end up putting the focus on
a child of the passed-in widget, and makes the focus-widget
property work for setting initial focus to (the child of) an
entry in a ui file.
2020-04-09 17:50:28 -04:00
Matthias Clasen
a65fd81106 root: Reorganize focus handling
Make :focus-widget a GtkWindow property and add vfuncs
to the GtkRoot interface instead of the property.
2020-04-09 17:50:28 -04:00
Matthias Clasen
b86c1446a4 notbook: Fix a bug in focus handling
After the header widget was introduced, focus would get
stuck in a loop between actions and tabs.

This could be seen in the notebook on page 3 of
widget-factory.
2020-04-09 17:50:28 -04:00
Matthias Clasen
9ce58bdb0c coloreditor: Draw a focus around the color plane
Not doing it was just an oversight.
2020-04-09 14:11:18 -04:00
Matthias Clasen
9f252f0ceb colorplane: Set a css name
Every widget should have one.
2020-04-09 14:10:23 -04:00
Matthias Clasen
7008a531bb Merge branch 'wip/xdg-popup-move' into 'master'
Wayland popup moving

See merge request GNOME/gtk!1017
2020-04-08 23:59:02 +00:00
Jonas Ådahl
5425edff82 wayland: Move popups with xdg_popup.reposition
The third version of xdg-shell introduces support for explicit popup
repositioning. If available, make use of this to implement popup
repositioning.

Note that this does *NOT* include atomic parent-child state
synchronization. For that,
https://gitlab.freedesktop.org/wayland/wayland-protocols/issues/13 will
be needed.

This currently uses my own fork of wayland-protocols which adds meson
support, so that we can use it as a subproject. Eventually when
wayland-protocols' meson support lands upstream, we should change it to
point there.

Silence some meson warnings while at it to make CI happy.

This also bumps the glib requirement, since g_warning_once() is used.
2020-04-08 23:32:47 +02:00
Jakub Steiner
9ae0fe7f3a Merge branch 'Gtk4_blue_focus_rings' into 'master'
Blue outlines / focus rings

See merge request GNOME/gtk!1629
2020-04-08 21:12:57 +00:00
Frederik F
abe6876f7c Blue outlines / focus rings
- introduce two new colors: $focus_border_color for focused / outlined elements and $_coloured_focus_border_color for focused / outlined elements with a colored background color, like suggested/destructive buttons or selected elements
- set outline / focus color, offset and style accordingly for all widgets
- adapt entry focus color
2020-04-08 21:12:57 +00:00
Emmanuele Bassi
54e4e6cd23 Improve the gtktypefuncs.inc generator
Remove the plug/socket exception, and add exceptions for non-X11
windowing systems.

Additionally, speed up the file generation by avoiding string
concatenation in Python.
2020-04-08 15:41:19 +01:00
Emmanuele Bassi
59852d3425 Add missing transfer annotation 2020-04-08 15:40:15 +01:00
Emmanuele Bassi
d701a89281 Turn GskRenderNode into a derivable type
Language bindings—especially ones based on introspection—cannot deal
with custom type hiearchies. Luckily for us, GType has a derivable type
with low overhead: GTypeInstance.

By turning GskRenderNode into a GTypeInstance, and creating derived
types for each class of node, we can provide an introspectable API to
our non-C API consumers, with no functional change to the C API itself.
2020-04-08 15:40:15 +01:00
Matthias Clasen
1e8df851e9 Merge branch 'matthiasc/for-master' into 'master'
Remove an unused backend includes

See merge request GNOME/gtk!1648
2020-04-07 20:30:43 +00:00
Matthias Clasen
6b7cc8baa6 Remove an unused backend includes
These includes are just leftovers.

Every time where we do an #ifdef GDK_WINDOWING... in gtk/,
something went wrong. Don't do it needlessly.
2020-04-07 15:13:18 -04:00
Matthias Clasen
71fe843d99 impcontextsimple: Drop ifdef'ed platform dependencies
The proper way to do this would be to adapt the tables
to have the right data for the platform. Since 4.0 is
a new start in many ways, lets clean this up.
2020-04-07 14:54:04 -04:00
Matthias Clasen
552a681816 Merge branch 'private-x11-types' into 'master'
Do not parse all GDK-X11 source files

See merge request GNOME/gtk!1646
2020-04-07 18:18:55 +00:00
Emmanuele Bassi
37c3ba2645 Do not parse all GDK-X11 source files
We don't need all of them, only the ones that contain public API. This
allows us to reduce the chance of a stray symbol getting incorrectly
added to the introspection data.
2020-04-07 18:06:08 +01:00
Matthias Clasen
12b97ffd24 entry: Document buildable support 2020-04-06 23:33:22 -04:00
Matthias Clasen
1ae60cb713 entry: Add <attributes> support
Make entries support the same <attributes> syntax
as labels.

Closes: #1335
2020-04-06 22:59:54 -04:00
Matthias Clasen
3371e3aa49 Move label attribute parser code
We want to reuse the parser for <attributes> in several
widgets, so move it to a shared place.
2020-04-06 22:59:45 -04:00
Matthias Clasen
f8be3229b1 Merge branch 'fix-event-match' into 'master'
shortcuttrigger: Don't trigger on key releases

See merge request GNOME/gtk!1642
2020-04-06 23:44:32 +00:00
Matthias Clasen
eb649d8204 shortcuttrigger: Don't trigger on key releases
This broke when the event type check in gdk_key_event_matches
was removed and replaced by a precondition that accepts both
key press and release events.

Add the check in gtk_keyval_trigger_trigger instead.
2020-04-06 19:16:41 -04:00
Christian Hergert
4a00f3bc9a widget: fix parameter ordering to match implementation
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2586
2020-04-06 15:44:19 -07:00
Matthias Clasen
0b17658a82 Replace most uses of <Primary> with <Control>
The only place where we are still using <Primary> is
in tests, to ensure we keep parsing it. Otherwise,
<Control> is now the preferred syntax.
2020-04-06 17:05:52 -04:00
Matthias Clasen
2486f46c0b Merge branch 'keymap-rework-2' into 'master'
Keymap rework 2

See merge request GNOME/gtk!1635
2020-04-06 20:56:06 +00:00
Matthias Clasen
70fbf8dbb6 accelgroup: Small documentation updates
Mention GtkShortcutTrigger, and remove references
to <Release>.
2020-04-06 16:32:03 -04:00
Matthias Clasen
1de7719e34 Drop gtk_accelerator_set_default_mod_mask
Our new approach to modifiers works with a fixed set,
there is really no need to customize the modifier
masks if the backends are all supposed to deliver
the same modifiers.
2020-04-06 16:32:03 -04:00
Matthias Clasen
3419d9c04f gtk: Drop gtk_widget_get_modifier_mask
This is not used anymore.
2020-04-06 16:32:03 -04:00
Matthias Clasen
c297d45b8a gtk: Stop using modifier intents
Reviewing the existing settings, the only backend with
some differences in the modifier intent settings is OS X,
and we would rather have that implemented by interpreting
the existing modifiers in the appropriate way.

                X11      Wayland  Win32    OS X

primary         ctrl     ctrl     ctrl     mod2
mnemonic        alt      alt      alt      alt
context menu    -        -        -        ctrl
extend sel      shift    shift    shift    shift
modify sel      ctrl     ctrl     ctrl     mod2
no text         alt|ctrl alt|ctrl alt|ctrl mod2|ctrl
shift group     varies   -        -        alt

GTK now uses the following modifiers:

primary         ctrl
mnemonic        alt
extend sel      shift
modify sel      ctrl
no text         alt|ctrl

The context menu and shift group intents were not used
in GTK at all.

Update tests to no longer expect <Primary> to roundtrip
through the accelerator parsing and formatting code.
2020-04-06 16:32:03 -04:00
Matthias Clasen
da6faf321c Merge branch 'misc-meson-fixes' into 'master'
Reduce useless relinking on configure and fix check for buildtype arguments

See merge request GNOME/gtk!1614
2020-04-06 20:22:01 +00:00
Matthias Clasen
0eb728aa51 imcontextsimple: Disable some win32-only code
This code needs to be redone differently, since keymaps are no
longer going to be exposed. There should really not be this much
ifdef-ed backend-specific code here anyway. Or any, really.
2020-04-06 15:33:49 -04:00
Matthias Clasen
0a96a483c6 gdk: Redo key events
Add all of the keyboard translation results in the key event,
so we can translate the keyboard state at the time the event
is created, and avoid doing state translation at match time.

We actually need to carry two sets of translation results,
since we ignore CapsLock when matching accelerators, in
gdk_event_matches().

At the same time, drop the scancode field - it is only ever
set on win32, and is basically unused in GTK.

Update all callers.
2020-04-06 15:13:54 -04:00
Matthias Clasen
5071367794 gtk: Remove handling of virtual modifiers
These are going away. We expect to just have
named modifiers in modifier masks now, so we
longer juggle 'real' and 'virtual' modifiers.
2020-04-06 15:13:54 -04:00
Matthias Clasen
d110fddbce gtk: Stop using GDK_MODx_MASK
These are never used in practice, and we never want to
see them in the UI, so stop supporting them. This is
in preparation for cleaning up GdkModifierType.
2020-04-06 01:40:49 -04:00
Matthias Clasen
b02db72e17 Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-06 01:40:49 -04:00
Matthias Clasen
4495bacfd1 gtk: Use display apis for keymap mapping
This removes the last uses of GdkKeymap from GTK.
2020-04-06 01:40:49 -04:00
Matthias Clasen
234a21905c gtk: Stop using keymap apis
Stop using most keymap apis in GTK. Only a few calls
related to virtual modifiers are left.
2020-04-06 01:40:49 -04:00
Matthias Clasen
f27470aaf4 passwordentry: Show caps lock warning more
Show the caps lock warning regardless of whether we
have the peek icon or not.
2020-04-05 23:43:41 -04:00
Matthias Clasen
90eda2b17c Drop some no longer used code 2020-04-05 23:43:41 -04:00
Matthias Clasen
68d43c8e5c cell renderer accel: Use gdk_event_get_match 2020-04-05 23:43:41 -04:00
Matthias Clasen
e8330c5eec Add gdk_event_matches
Move the elaborate key event matching code from
GtkShortcutTrigger to GdkEvent, which greatly reduces
the amount of keymap api use outside of GDK.
2020-04-05 23:37:13 -04:00
Matthias Clasen
ec854fc503 shortcuts: documentation fixes
Update symbol lists, and add examples for parsing triggers
and actions.
2020-04-04 12:22:43 -04:00
Matthias Clasen
22211f29fb colorbutton: Don't add a customize menu
The color swatch in the button does not need a
context menu. Turn it off.
2020-04-04 00:28:52 -04:00
Matthias Clasen
8991275fbd colorbutton: Fix focus
The colorbutton contains a button which contains a colorswatch.
We want the focus to go straight to the button, nowhere else,
so mark the swatch as !can-focus.

Adapt tests to match.
2020-04-04 00:28:45 -04:00
Matthias Clasen
e43eb951d6 Merge branch 'scrollbar-a11y' into 'master'
Add GtkScrollbarAccessible

See merge request GNOME/gtk!1623
2020-04-04 04:03:40 +00:00
Matthias Clasen
5205fa0ff7 scrollbar: Be more defensive
Somehow the scrollbar accessible manages to call
gtk_scrollbar_get_adjustment when priv->range is NULL.
Survive taht.
2020-04-03 23:31:45 -04:00
Matthias Clasen
1424dd9786 Add an api to parse shortcut actions
This is so we can test this code. While doing it
I also fixed the missing else that was caused it
not to work.
2020-04-03 22:41:15 -04:00
Matthias Clasen
339d3e41b0 Add GtkScrollbarAccessible
When GtkScrollbar stopped being a GtkRange,
GtkRangeAccessible stopped working for scrollbars.

Update a11y tests to match.
2020-04-03 15:20:27 -04:00
Carlos Garnacho
e5d23aaaaf imwayland: Clamp the surrounding string end correctly
In the paths where len > MAX_LEN and cursor/anchor are separated by
at least MAX_LEN from text edges, we were clamping the right end of
the surrounding string at MAX_LEN. Oops.

This end anchor may go as far as the string length, although just
up to len - MAX_LEN in real terms (due to the condition above that
caches cursor/anchor positions being near enough the text end).

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2565

(cherry-picked from commit d7fb15c822)
2020-04-03 19:55:55 +02:00
Emmanuele Bassi
4e264a74be Annotation fixes
Match the arguments name in the declaration and the definition, and make
sure we have the proper transfer annotations.
2020-04-03 15:30:56 +01:00
Nirbheek Chauhan
777435c470 meson: Reduce useless relinking on reconfigure
When we reconfigure, `configure_file()` is called again, and
`*.gresource.xml` files are regenerated, which causes many (all?)
binaries to be relinked. Now we only write those out if the contents
actually changed (or if the output didn't already exist).

This is exactly what Meson already does with `configure_file()` when
`command:` is not used.

While we're at it, also do the same for `gen-c-array.py` and
`gentypefuncs.py` for completeness. Now even if the input to those
changes, re-building of those custom targets may not result in
relinking if the outputted C files have the same contents.
2020-04-03 18:41:55 +05:30
Timm Bäder
fb325afc79 shortcutcontroller: fix transfer full annotation 2020-04-03 08:03:32 +02:00
Timm Bäder
046190cb8a window: Don't leak toplevel layout 2020-04-03 07:37:54 +02:00
Matthias Clasen
8a0035333a a11y: Set focus-related states properly
Entries and menubuttons are no longer focusable themselves,
they have focusable children. Since we don't have accessible
objects for those, transfer the focus-related state (focusable
and focused) from the children to the main accessible object.
2020-04-02 17:35:09 -04:00
Matthias Clasen
1f8e633fff window: tie focus to surface state changes
We don't get a focus-out on the event controller, when
the surface is losing keyboard focus, since we are not
moving our focus to some other widget, so we are never
unsetting the mnemonics-visible property. Do that in
response to surface state changes instead.
2020-04-02 17:21:01 -04:00
Matthias Clasen
aaa4e40a1f imcontexsimple: Move Compose file loading to class_init
This ensures that it is done only once.
2020-04-02 09:04:23 -04:00
Matthias Clasen
8ec254e2bb imcontextsimple: Simpify Compose file loading
We are not loading the Compose file for individual contexts,
it just gets added to a global list. So don't pass an im context
along. This will let us move the loading out of the initialization
of individual contexts, and only do it once.
2020-04-02 09:02:05 -04:00
Matthias Clasen
2a9911724f imcontextsimple: Load ~/.Compose unconditionally
There is nothing display-specific in the ~/.Compose file,
so we can just try to load it without looking at the
display we are on.
2020-04-02 09:02:05 -04:00
Matthias Clasen
a9b4ac3d59 imcontextsimple: Add a profiler mark for IO
We are loading a file here, thankfully in a thread, but
we do it every time an entry is created. Add a profiler
mark, to make this visible.
2020-04-02 09:02:05 -04:00
Matthias Clasen
fcd36e59b1 Fix crossing event generation
We were not properly setting the new_descendent field
in Crossing structs for GTK_CROSSING_OUT events. This
was causing extraneous ::leave signals to be emitted,
and make model buttons in popover menus flicker when
hovered.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2536
2020-04-02 00:39:46 -04:00
Philip Withnall
544b8d5a7f gtkflowbox: Fix a minor typo in the documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-01 14:04:46 +01:00
Matthias Clasen
6ae5d9ac22 Merge branch 'matthiasc/for-master' into 'master'
keynav: Fix Shift-Tab

See merge request GNOME/gtk!1598
2020-04-01 05:04:02 +00:00
Matthias Clasen
dc3d778e01 keynav: Fix Shift-Tab
This was broken by the shortcuts branch merge.
2020-04-01 00:21:19 -04:00
Matthias Clasen
2154b8e745 Add a cursor-aspect-ratio setting
Add a setting that controls how thick the text caret is drawn.
The default value is 0.04.
2020-03-31 23:30:20 -04:00
Carlos Garnacho
fa7f6ad910 gtkmain: Do not try to coalesce/ignore crossing events
Under grabbing circumstances we used to get several crossing events,
some corresponding to the grab itself and some corresponding to
pointer motion.

The backends now do a better job at keeping those simple, which
means we sit listening for events that don't actually arrive. This
triggers pointer focus issues when dragging windows or opening
grabbing popups.

Actually obey those events, they will be the only ones we get now.
2020-04-01 00:40:17 +02:00
Matthias Clasen
5432f73095 window: Fix residual resizing issues
After the GdkToplevel split, GtkWindow occasionally
forgets its minimum size. Fix this by keeping a GdkToplevelLayout
around and reusing it.
2020-03-31 13:07:44 -04:00
Matthias Clasen
15eb3bbbf1 shortcutcontroller: Document buildable support 2020-03-30 20:09:29 -04:00
Matthias Clasen
ace183f38f shortcutcontroller: Fix builder support
The GtkBuilder support was not working anymore after
triggers and actions have been turned into objects.

Fix this.
2020-03-30 19:02:35 -04:00
Bastien Nocera
8cf41c1b66 filechoosernativeportal: Fall back if portal is too old
Add portal version checking as originally implemented for the GTK 3.x
branch.

See: 35fec1c6b2
2020-03-30 18:31:24 +02:00
Bastien Nocera
027ca22def Add portal version checking helper
Add gtk_get_portal_interface_version() to check the version of a portal.
2020-03-30 18:31:23 +02:00
Bastien Nocera
bd55c5842e colorpickerportal: Simplify version fetching code
Simplify version checking code by using a function to fetch the uint out
of the GVariant and don't throw a warning if it can't be fetched.
2020-03-30 18:31:23 +02:00
Matthias Clasen
de31bb59a1 window: Remove initial-focus leftovers
We removed the way to set initial_focus a year ago,
time to get rid of the leftovers.
2020-03-29 23:39:54 -04:00
Matthias Clasen
07bb29153b widget: Remove a leftover vfunc
The popup-menu signal is gone, so we can remove the vfunc.
2020-03-29 23:18:56 -04:00
Timm Bäder
785b33f169 widget: Return an array from list_controllers
Minimize the GList usage throughout the code base.
2020-03-29 15:32:54 +02:00
Matthias Clasen
47982ae272 coloreditor: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
0020b735d9 colorchooserdialog: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
e05c1b0244 colorchooserwidget: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
d0b4f9eb29 notebook: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
03375b723a listbox: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
e2beb6ec50 levelbar: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
ef32cff771 spinbutton: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
366b007024 filechooserwidget: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
40337aa1b3 printunixdialog: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
0bb38b903e printjob: Drop the Private struct 2020-03-29 09:04:19 -04:00
Matthias Clasen
173b1333ca printing: Avoid a crash
When no printer has been selected (e.g. because we don't
find any printers), the 'print at' radio group should be
insensitive, except for the 'now' choice. Selecting another
option in this situation will lead to a crash.
2020-03-28 15:36:15 -04:00
Matthias Clasen
784d6f8d0c printing: Fix initial page range radio group
Only set one radio button as active in the ui file.
Otherwise we end up with multiple options appearing
as selected initially.
2020-03-28 15:36:15 -04:00
Matthias Clasen
7916b95bc5 gesture: Fix gtk_gesture_get_bounding_box
When we stopped translating event coordinates in-place,
this function inadvertently started returning surface-relative
bounding boxes instead of widget-relative ones, as expected.

Fix this by using the widget-relative coordinates that we
already store.
2020-03-28 15:03:33 -04:00
Matthias Clasen
7b135c96e4 cellarea: Fix cell editing
We need to translate the event coordinates to
widget-relative coordinates. This broke when
we stopped translating event coordinates in-place.
2020-03-28 14:56:26 -04:00
Matthias Clasen
e662438675 button: Fix an event handling gotcha
We no longer translate event coordinates in-place,
so gdk_event_get_position() returns surface-relative
coordinates, not widget-relative ones. Just use the
coordinates we are given.
2020-03-28 14:33:01 -04:00
Matthias Clasen
aa2ca80817 imcontextsimple: Don't use g_object_unref on events
Events are not objects anymore.
2020-03-28 14:29:08 -04:00
Matthias Clasen
ceef86895f appchooserdialog: Drop the Private struct 2020-03-28 10:59:12 -04:00
Matthias Clasen
001d076e61 image: Drop the Private struct 2020-03-28 10:49:54 -04:00
Matthias Clasen
408dd37944 infobar: Drop the Private struct 2020-03-28 10:48:15 -04:00
Matthias Clasen
9287e0e7fb texthandle: Drop the Private struct 2020-03-28 10:36:09 -04:00
Matthias Clasen
28eb1fce04 searchentry: Drop the Private struct 2020-03-28 10:28:22 -04:00
Matthias Clasen
49427119ab statusbar: Drop the Private struct 2020-03-28 10:28:01 -04:00
Matthias Clasen
05891b1238 settings: Drop the Private struct
Also drop class padding - pointless for final types.
2020-03-28 10:22:44 -04:00
Matthias Clasen
b14d99ad7a accellabel: Drop unused class fields
We are not using these anymore.
2020-03-28 10:15:50 -04:00
Matthias Clasen
329638280c accellabel: Drop the Private struct 2020-03-28 10:06:26 -04:00
Matthias Clasen
06365cdc38 actionbar: Drop the Private struct 2020-03-28 09:59:49 -04:00
Matthias Clasen
1f808c479a aboutdialog: Drop the Private struct 2020-03-28 09:59:07 -04:00
Matthias Clasen
7e8d61b92c menubutton: Drop the Private struct 2020-03-28 09:49:29 -04:00
Timm Bäder
d01e664c79 applicationaccels: Fix shortcut memory leaks
g_list_model_get_item() is transfer-full.
2020-03-28 08:34:35 +01:00
Matthias Clasen
ba25e08e7b menubutton: Add a use-underline property
This is necessary since apps no longer have direct
access to the label.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2489
2020-03-28 00:08:12 -04:00
Matthias Clasen
8997dc6f31 Merge branch 'rename-theme-resources' into 'master'
Rename GResources for standard GTK themes

See merge request GNOME/gtk!1576
2020-03-27 16:37:31 +00:00
Emmanuele Bassi
f1003d6ae8 Rename GResources for standard GTK themes
After commit 2ab9be54fb we had to rename
the generated CSS files to be included into the GResource bundle; we
kept the URI stable to avoid too much churn, and allow backporting the
change to the 3.24 stable branch. This had the adverse effect of making
it harder to debug issues, as the on-disk file name does not match the
location in the GResource that will be used to print out warnings,
errors, and debugging messages.
2020-03-27 15:20:59 +00:00
Emmanuele Bassi
6719d3044d Add parsing for GtkAlternativeTrigger
Alternative triggers are separate by a pipe character.
2020-03-27 14:35:00 +00:00
Emmanuele Bassi
170e8bd605 Parse keyval name directly for mnemonic triggers
We don't need to parse the full accelerator format for mnemonic
triggers.
2020-03-27 13:57:19 +00:00
Emmanuele Bassi
96ccb25f97 Return a full reference when parsing triggers
We're not returning a full reference for GtkNeverTrigger, but we are
returning full references for mnemonic and keyval triggers; this means
we're either going to leak mnemonic and keyval triggers if we consider
this function a "transfer none" one, or we are going to trigger an
assertion failure when finalizing a never trigger, if we consider this
function a "transfer full" one.

Let's be consistent, and always return a full reference to the caller.
2020-03-27 13:57:19 +00:00
Timm Bäder
c3c06e60dc calendar: Only highlight one day as today
Fixes #2490
2020-03-27 09:50:30 +01: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
Timm Bäder
f7975828bc filechooserwidget: Plug a memory leak 2020-03-27 08:36:32 +01:00
Jakub Steiner
06fe4f0205 Adwaita: make insensitive slightly less sensitive
- will expose itself even more in HC
2020-03-26 17:22:47 +01:00
Jakub Steiner
910dd7a20a HC: derive from Adwaita
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1450
2020-03-26 17:21:47 +01:00
Jakub Steiner
8d8990ccd7 Revert "Adwaita: make insensitive slightly less sensitive"
This reverts commit bf3ccaa1bf.
2020-03-26 17:19:19 +01:00
Jakub Steiner
bf3ccaa1bf Adwaita: make insensitive slightly less sensitive
- will expose itself even more in HC
2020-03-26 15:55:42 +01:00
Matthias Clasen
1ec2d1d9f1 shortcutmanager: Add some more docs 2020-03-25 23:14:45 -04:00
Matthias Clasen
f59cd392ba shortcuttrigger: Some documentation fixups 2020-03-25 23:14:45 -04:00
Matthias Clasen
6bacb0b0ae shortcutaction: Some documentation fixups 2020-03-25 23:14:45 -04:00
Matthias Clasen
530b571d89 shortcutcontroller: Expand the docs 2020-03-25 23:14:45 -04:00
Matthias Clasen
591f6bd7a9 popovermenu: Show mnemonics on keynav
This is the expected behavior for menus.
2020-03-25 23:14:45 -04:00
Matthias Clasen
642503afb4 popover: Implement auto mnemonics
Unfortunately, this involves copying a bunch of
code from gtkwindow.c. The only difference here
is that we add a private method to turn this off,
which will be used by GtkPopoverMenu to implement
its own auto mnemonics.
2020-03-25 23:14:45 -04:00
Matthias Clasen
fc0b0b14a8 label: Respect GtkPopover::mnemonics-visible
When inside a popover, look to the popover for
whether to show mnemonics or not.
2020-03-25 23:14:45 -04:00
Matthias Clasen
2de4fc3ec0 popover: Add a mnemonics-visible property
This will be handled separately for popovers, so we
need our own property for it.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b2ac42e576 label: Disconnect visible mnemonics in popovers
The controller handling mnemonics is limited to same-native,
so showing mnemonics in other natives.
2020-03-25 23:14:45 -04: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
2c28a0713d popovermenu: Make mnemonics work without Alt
This is expected menu behavior.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b423f974db shortcutcontroller: Inject accels into the action muxer
This is the way model button pic up accels for their actions.
2020-03-25 23:14:45 -04:00
Matthias Clasen
4a430820bd popover: Implement GtkShortcutManager
This makes mnemonics work in popovers.
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
Emmanuele Bassi
6e8c78714d Turn GtkShortcutAction into a GObject
Just like we did for GtkShortcutTrigger.

This allows language bindings to properly deal with all the actions.
2020-03-25 23:14:45 -04:00
Emmanuele Bassi
457b6657bb Turn GtkShortcutTrigger into an object
The lightweight inheritance mechanism used for GtkShortcutTrigger is not
going to be usable by bindings, because boxed types cannot have derived
types.

We could use GTypeInstance and derive everything from that, like
GParamSpec, but in the end shortcuts are not really a performance
critical paths, unlike CSS values or render nodes.
2020-03-25 23:14:45 -04:00
Matthias Clasen
5ea45bf57d widget: Remove some leftover accel group plumbing
The ::can-activate-accel and ::accel-closures-changed signals
are not used anymore, remove them.
2020-03-25 23:14:45 -04:00
Matthias Clasen
4e978d6b7a shortcutcontroller: Only activate shortcuts of visible widgets
Our shortcuts are like mnemonics in this respect - they only
activate when the widget is viewable.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b4722b43a1 Drop GtkKeyHash 2020-03-25 23:14:45 -04:00
Matthias Clasen
fd95cc56b1 window: Remove GtkKeyHash remnants
It is not used anymore.
2020-03-25 23:14:45 -04:00
Matthias Clasen
35332eb3b0 shortcutcontroller: Implement mnemonic cycling
Make GtkShortcutController collect matching shortcuts
in the same way GtkKeyHash did (accept fuzzy matches
if we don't have any exact matches), and cycle among
the matches if we have multiple.
2020-03-25 23:14:45 -04:00
Matthias Clasen
586e7749d5 shortcuttrigger: Do elaborate matching for key events
Copy the logic from GtkKeyHash for matching key events
to shortcuts.

Adapt shortcuts test to work with the better matching,
by creating more complete key events.
2020-03-25 23:14:45 -04:00
Matthias Clasen
904835d4b1 shortcuttrigger: Introduce partial matches
Allow GtkShortcutTrigger to return partial matches.
Currently, no triggers produce such results, and
GtkShortcutController treats partial matches like
exact ones.
2020-03-25 23:14:45 -04:00
Matthias Clasen
9cce474106 widget: Drop the ::popup-menu signal
This is now done in widgets which have context
menus.
2020-03-25 23:14:45 -04:00
Matthias Clasen
9d84996fea placesview: Stop using ::popup-menu
This signal is going away.
2020-03-25 23:14:45 -04:00
Matthias Clasen
c2d77a1f37 filechooser: Stop using ::popup-menu
This signal is going away.
2020-03-25 23:14:45 -04:00
Matthias Clasen
54a0037c45 mountoperation: Stop using ::popup-menu
We can just use a shortcut controller directly.
2020-03-25 23:14:45 -04:00
Matthias Clasen
844801580f colorchooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
2020-03-25 23:14:44 -04:00
Matthias Clasen
28b05eea67 range: Remove ::popup-menu emission
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-25 23:14:44 -04:00
Matthias Clasen
ca1d4322a2 scrollbar: Remove :popup-menu forwarding
This signal is going away.
2020-03-25 23:14:44 -04:00
Matthias Clasen
c94ec4a204 emojichooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
2020-03-25 23:14:44 -04:00
Matthias Clasen
778d884f70 Use an action for the context menu keybinding
The ::popup-menu signal is going away.
2020-03-25 23:14:44 -04:00
Matthias Clasen
e8be45fabc Print mnemonic triggers clearly 2020-03-25 23:14:44 -04:00
Matthias Clasen
c90b0581dd inspector: Show shortcuts
At a tab that lists the shortcuts contained in a
GtkShortcutController.
2020-03-25 23:14:44 -04:00
Benjamin Otte
43c0ea676d filechooser: Trigger the location popup via bindings
Simplifies code quite a bit.
2020-03-25 23:14:44 -04:00
Benjamin Otte
bb4fbe3d8f accels: Remove GtkAccelGroup 2020-03-25 23:14:44 -04:00
Benjamin Otte
4c45410d43 widget: Remove gtk_widget_add_accelerator()
People should use shortcut controllers instead (global, capture).

A side effect of this is that GtkAccelLabel now lost its method to
magically look up accelerators to display. Somebody needs to add that
back later.
2020-03-25 23:14:28 -04:00
Benjamin Otte
78e3e42042 shortcutcontroller: Implement GtkBuildable
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-25 23:14:28 -04:00
Benjamin Otte
33045c3e0b shortcutaction: Integrate with GtkBuilder property parsing
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-25 23:14:28 -04:00
Benjamin Otte
7974751e24 shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
And hook it up into the GtkBuilder infrastructure.
2020-03-25 23:14:28 -04:00
Benjamin Otte
daa7d9072d application: Replace accelerator handling with shortcuts
API remains the same, but activation is now done via a
shortcutcontroller.

The code uses a controller with global scope so that the
shortcuts are managed with all the other global shortcuts.
2020-03-25 23:14:28 -04:00
Benjamin Otte
90a34312d4 accel: Add display arg to gtk_accelerator_parse_with_keycode()
It was using the default display unconditionally.
2020-03-25 23:14:28 -04:00
Benjamin Otte
580863b112 accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
A parse function should return success or not. So do that.
2020-03-25 23:14:28 -04:00
Benjamin Otte
fb6a8f5fc1 shortcuttrigger: Add hash(), equal(), and compare() functions
Those are useful for putting triggers in hash tables or getting sorted
output.
2020-03-25 23:14:28 -04:00
Matthias Clasen
c2e2e2993b shortcutmanager: Use list models 2020-03-25 23:14:28 -04:00
Matthias Clasen
5763514ab8 shortcutcontroller: Use a list model for shortcuts 2020-03-25 23:14:28 -04:00
Benjamin Otte
4c5d8547be shortcutaction: Add gtk_shortcut_action_to_string()
For all but the callback action, we can print something useful.
2020-03-25 23:14:27 -04:00
Matthias Clasen
34987c0b5c widget: Only create a controller if we have shortcuts
No point in creating objects that just hold empty lists.
2020-03-25 23:14:27 -04:00
Benjamin Otte
3cd4eb0310 widget: Keep keybindings as a GListStore
This way, we can use shortcut_controller_new_for_model() and avoid all
the special casing about run_class.
2020-03-25 23:14:27 -04:00
Benjamin Otte
a1e9ae5259 shortcutcontroller: Add gtk_shortcut_controller_new_for_model()
This is mainly for internal use, but I can't see a reason to not have it
public for people who want to maintain their own lists.

I'm sure gnome-builder will never ever find a way to misuse it.
2020-03-25 23:14:27 -04:00
Benjamin Otte
e738a4d129 shortcutcontroller: Implement GListModel
After all, this controller is a list of shortcuts.
2020-03-25 23:14:27 -04:00
Benjamin Otte
92e20deca1 shortcut: Change the API for creating shortcuts
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.

Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2020-03-25 23:14:27 -04:00
Benjamin Otte
cd0332aad5 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
2020-03-25 23:14:27 -04:00
Benjamin Otte
cdd33bbee6 accelgroup: Remove unneeded APIs
After the removal of GtkAccelMap, these things are no longer necessary.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
bca1f6b64f gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-25 23:14:27 -04:00
Benjamin Otte
9b99b89807 gtk: Remove accel paths
It's an outdated technology now that everybody is using GActionGroups.

If somebody wanted to support changeable shortcuts, they'd need to
reintroduce it in another way.
2020-03-25 23:14:27 -04:00
Benjamin Otte
62f96bfda6 Remove GtkMnemonicHash
It's not used anymore.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
2c62cde780 window: Remove all old mnemonic handling API 2020-03-25 23:14:27 -04:00
Emmanuele Bassi
aab10ea43b Add GtkShortcutManager
This adds an interface for taking care of shortcut controllers with
managed scope.

Only GtkWindow currently implements this interface, so we need to ensure
that we check if any top-level widget we reach is a shortcuts manager
before we call into it.
2020-03-25 23:14:27 -04:00
Benjamin Otte
9428807c57 label: Implement mnemonics using shortcuts 2020-03-25 23:14:27 -04:00
Benjamin Otte
21e6e4c026 shortcut: Add gtk_shortcut_set_mnemonic_activate()
Makes the shortcut call gtk_widget_mnemonic_activate() upon activation.
2020-03-25 23:14:27 -04:00
Benjamin Otte
bde4cbe377 shortcuttrigger: Add support for mnemonics
Mnemonics need to be triggered with help from the controllers (who
determine the modifiers). Support for that has been added, too.

Mnemonics do not use this yet though.
2020-03-25 23:14:27 -04:00
Benjamin Otte
0b7e74318b window: Put F10 accelerator into its own shortcut controller
So instead of relying on gtk_window_activate_key(), it's now using
proper infrastructure.
2020-03-25 23:14:27 -04:00
Benjamin Otte
e398f63bf6 window: Get rid of public APIs that shouldn't be
Event controllers should have replaced all of them.
And if they haven't, apps need to fix their code (I'm
looking at you Gimp).
2020-03-25 23:14:27 -04:00
Benjamin Otte
2244eeb727 gdk: Remove GDK_RELEASE_MASK
It was only ever supported by keybindings and those are gone now.
2020-03-25 23:14:27 -04:00
Benjamin Otte
730154df7d shortcutcontroller: Add GtkShortcutScope
Allow setting the scope for a controller. The scope determines at what
point in event propagation the shortcuts will be activated.

Local scope is the usual activation, global scope means that the root
widget activates the shortcuts - ie they are activated at the very
start of event propagation (for global capture events) or the very end
(for global bubble events).
Managed scope so far is unimplemented.

This is supposed to be used to replace accelerators and mnemonics.
2020-03-25 23:14:27 -04:00
Benjamin Otte
2309e1dd38 shortcuttrigger: Add gtk_shortcut_trigger_to_label()
Provide a user-presentable string.
2020-03-25 23:14:27 -04:00
Benjamin Otte
90c7f4608a accelgroup: Add gtk_accel_group_print_label() 2020-03-25 23:14:27 -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
Benjamin Otte
d84b60e5f9 accellabel: Get rid of class variables
We can just look them up as-needed, no need to cache them.
2020-03-25 23:14:27 -04:00
Benjamin Otte
9a03c8b4d8 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
f02521c502 Remove bindings activation from GtkEventControllerKey
We're going to use shortcuts soon.
2020-03-25 22:36:03 -04:00
Matthias Clasen
c1247a7993 popover: Add keynav keybindings
The shortcut controllers are limited to same-native,
so we need to duplicate the Tab and arrow key bindings
for focus handling, as well as the Enter bindings for
activation.
2020-03-25 22:36:03 -04:00
Emmanuele Bassi
b2a747b4d4 popovermenu: Port to shortcuts 2020-03-25 22:36:03 -04:00
Benjamin Otte
c1ee2fd54a accelgroup: Actually have a default mod mask
Don't just use a value without initializing it.
2020-03-25 22:36:03 -04:00
Benjamin Otte
4c7b00fd20 treeview: Redo event forwarding hack
Reorder the event controllers so that key forwarding to the search
entries really happens after shortcut triggering.
2020-03-25 22:36:03 -04:00
Benjamin Otte
3fba7f9dce combobox: Redo key event forwarding hack
Instead of manualling invoking bindings, we now reorder event
controllers inside the treemenu, so that shortcuts run before the event
forwarding.
2020-03-25 22:36:03 -04:00
Emmanuele Bassi
7ca4a94768 widget: Add private accessor to event controllers 2020-03-25 22:36:03 -04:00
Benjamin Otte
1df0a5eab5 iconview: Port bindings to use shortcuts 2020-03-25 22:36:03 -04:00
Benjamin Otte
6a005c815e infobar: Port bindings to use shortcuts 2020-03-25 22:36:03 -04:00