Commit Graph

325 Commits

Author SHA1 Message Date
Matthias Clasen
2ef72442ec docs: Fix the links for keybinding signals
GtkBindingSignal does not exist anymore, so link to
GtkSignalAction for an explanation of keybinding signals.
2020-11-17 07:34:52 -05:00
Matthias Clasen
3bc2bf40a8 popover: Document signals 2020-11-17 07:34:52 -05:00
Matthias Clasen
dab11ea841 popover: Change default for cascade-popdown
We've found a number of cases where this cascading
has unexpected side-effects. So, turn it off by
default, and only set it for menus.
2020-11-03 11:00:32 -05:00
Benjamin Otte
8dad615f04 gtk: Remove unused header include
gtkcssnodeprivate.h was mainly used for repositioning CSS nodes in
gadgets, and gadgets are gone now.
2020-10-20 04:50:12 +02:00
Carlos Garnacho
3ba60b06fe gtkpopover: Remove GtkPopoverMenu special case
Now that there's ::cascade-popdown, we don't need to treat
GtkPopoverMenu especially here.
2020-10-13 16:55:53 +02:00
Carlos Garnacho
024d832d94 gtkpopover: Add cascade-popdown property/functions
And honor it in gtk_popover_popdown(). By default, a GtkPopover
pops down automatically if a child popover was closed, if this
property is FALSE, the popover will remain opened.
2020-10-13 16:55:53 +02:00
Timm Bäder
a6f86d9c26 popover: Only destroy arrow render node if position changed 2020-09-15 05:21:54 +02:00
Matthias Clasen
35708162cc Make GtkNativeInterface private
We are not sure yet if allowing out-of-tree
implementations of GtkNative are a good idea.
2020-08-14 07:03:27 -04:00
Christian Hergert
4d88e3af17 popover: allow setting popup layout offset
Currently there is no way to alter the offset of the popup when positioning
with GdkPopupLayout. This makes using the popup difficult for scenarios
like completion windows where you may need to offset the window by a given
amount for aligning text.

gtk_popover_set_offset() allows setting these values and are analagous to
the function of the same name for GdkPopupLayout.
2020-08-07 17:10:52 -07:00
Matthias Clasen
d6e352e862 popover: Set overflow: hidden
This keeps overlay scrollbars from wrecking our
nice rounded corners.

Fixes: #3012
2020-08-04 11:10:49 -04:00
Timm Bäder
76f2396764 popover: Use gtk_widget_add_css_class 2020-08-01 10:31:38 +02:00
Carlos Garnacho
6a4277a9a9 gtkpopover: Move away from gdk_device_get_state()
Use gdk_device_get_modifier_state() poking the keyboard and keymap,
instead of this function.
2020-07-28 17:36:18 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
37633985bd Drop gtknativeprivate.h
No need to ship empty headers.
2020-06-07 08:52:45 -04:00
Matthias Clasen
75d9310986 Change coordinate translation apis to take doubles
Change gtk_widget_translate_coordinates and
gtk_native_get_surface_transform to operate
on doubles. Update all callers.
2020-05-17 17:17:31 -04:00
Timm Bäder
5b0e91844b popover: Fix input shape rendering
Once again, calling gtk_widget_get_allocation() is wrong.

Fixes #2601
2020-05-16 22:34:38 +02:00
Timm Bäder
2fd86ef80c popover: Return correct values from get_surface_transform()
We do not (yet) care about the box shadow here, so it's sufficient to
return the css values.
2020-05-16 22:03:58 +02:00
Matthias Clasen
fa784aaa06 Cosmetics 2020-05-13 08:11:50 -04:00
Matthias Clasen
ddebf07236 popover: Fix a reference leak
Don't leak the reference to the default widget.
2020-05-11 12:19:39 -04:00
Matthias Clasen
b93631164f Remove lots of focus vfuncs
In many cases, the default widget vfuncs work just fine,
combined with setting focusable.
2020-05-11 00:11:37 -04:00
Matthias Clasen
1f0024a7f0 tooltip: Add private api to allocate the window
Add private gtk_tooltip_maybe_allocate() function
and use it from GtkWindow and GtkPopover.

This will let us stop using the ::size-allocate signal,
without having to redo all the tooltip management first.

That will happen later.
2020-05-06 14:27:45 -04:00
Matthias Clasen
b96509c030 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!1828
2020-05-06 03:55:55 +00:00
Timm Bäder
96673d5106 popover: Remove an unused gtk_widget_get_allocation() call 2020-05-05 08:20:09 +02:00
Matthias Clasen
ee1f8d8d06 popover: Derive from GtkWidget 2020-05-04 22:53:07 -04:00
Matthias Clasen
ee284a560a popover: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
91d8c230f3 popover: Fix repositioning logic
When the arrow changes position, we need to queue
an allocation to ensure that gtk_widget_allocate
actually calls our ->size_allocate vfunc.
2020-04-28 23:26:19 -04:00
Matthias Clasen
473709fee3 popover: Allocate after setting final_position
When we find out that we've been flipped, set
final_position and final_rect before allocating
the popover. This prevents 'smashed-in beak' disease.

Fixes: #2671
2020-04-27 20:58:03 -04: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
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
b4c79bad34 Assorted documentation fixes 2020-04-20 00:38:58 -04:00
Jonas Ådahl
aa72318581 popover: Fix indentation 2020-04-18 22:33:29 +02: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
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
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
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
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
4a430820bd popover: Implement GtkShortcutManager
This makes mnemonics work in popovers.
2020-03-25 23:14:45 -04:00
Benjamin Otte
62f96bfda6 Remove GtkMnemonicHash
It's not used anymore.
2020-03-25 23:14:27 -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
Carlos Garnacho
9a0b70fc84 gtkpopover: Re-present surface if position/pointing-to change while visible
This ensures the popover will follow the new position parameters. This is
necessary for popovers like the text magnifier that can be repositioned
while visible.
2020-03-20 15:52:19 +01:00
Carlos Garnacho
6431bdcf91 gtkpopover: Ensure the pointed to rectangle has a minimum w/h
On wayland, protocol errors will be raised if the rectangle width/height
are 0. Avoid that situation so it's valid to all popovers.
2020-03-20 15:52:19 +01:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Benjamin Otte
20cfa2e280 Remove GtkMnemonicHash
It's not used anymore.
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
bdde072c06 popover: Remove unused include 2020-03-18 23:00:50 -04:00
Matthias Clasen
f7a4d968e9 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-18 23:00:50 -04:00
Matthias Clasen
6eb848f0e0 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-17 20:15:26 -04:00
Matthias Clasen
6edff8cd67 gtk: use toplevel state getter 2020-03-12 14:56:20 -04:00
Matthias Clasen
b2ae6ce8ff surface: Rename gdk_surface_input_shape_combine_region
There is no shape combining going on anymore, so
call this just gdk_surface_set_input_region, and
remove the offset arguments too. All callers pass
0 anyway.

Update all callers and implementations.
2020-03-11 19:35:56 -04:00
Matthias Clasen
b670bf54f7 popover: Use GdkPopup 2020-03-11 19:35:55 -04:00