Commit Graph

153 Commits

Author SHA1 Message Date
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
ee4a7798c9 flowbox: Stop setting focus adjustments 2020-04-18 14:45:29 -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
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
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
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
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
Benjamin Otte
2e5fc35e51 flowbox: Port bindings to use shortcuts 2020-03-25 22:36:03 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Benjamin Otte
6e38af4429 flowbox: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Benjamin Otte
632fab0ca7 stylecontext: Get rid of gtk_style_context_get()
... and replace all the calls to it with
gtk_style_context_peek_property().

All the calls are hacks that need to go away btw.
2020-01-28 02:58:02 +01:00
Benjamin Otte
146b921246 cssnode: Convert name + id from interned string to GQuark
The reason for this is simply that I want to get hash functions that
have their values close together, so they can fit in a smaller range
(the goal here is 12 bits). By using GQuark, we get consecutive numbers
starting with 1 (and applications have <1000 quarks usually), whereas
interned strings can be all over the place.

As a side effect we also save 64 bytes per declaration.
2020-01-28 02:17:03 +01:00
Robert Ancell
83867f9cbf Add missing (closure) GIR annotations 2020-01-13 14:26:50 +13:00
Robert Ancell
ea9f0df67b Fix incorrect use of GIR closure annotations.
They were being applied to the callback function, not the data that is passed
to that function.
2020-01-13 14:11:15 +13:00
Christian Hergert
828c36636c va_marshaller: add various va_marshallers
We don't need to cover every case with a va_marshaller, but there are a
number of them that are useful because they will often only be connected
to by a single signal handler.

Generally speaking, if I opened into a file to add a va_marshaller, I just
set all of them.
2019-06-06 15:30:42 -07:00
Christian Hergert
bd26cce812 gtk: rely on default marshallers
Similar to previous removals of g_cclosure_marshal_VOID__VOID we can remove
other marshallers for which are a simple G_TYPE_NONE with single parameter.
In those cases, GLib will setup both a c_marshaller and va_marshaller for
us. Before this commit, we would not get a va_marshaller because the
c_marshaller is set.

Related to GNOME/Initiatives#10
2019-05-30 20:56:50 -07:00
Christian Hergert
f507a79056 marshallers: ensure g_cclosure_marshal_VOID__VOIDv is used
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
2019-05-29 13:22:31 -07:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00:00
Matthias Clasen
aec5e3d71e flow box: Make final
We keep GtkFlowBoxChild subclassable, though.
2019-05-28 20:01:43 -04:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
ef982b7d46 Rename things
Rename the can-pick property to can-target,
and redo the pick flags with more descriptive names.
2019-04-08 08:42:25 -04:00
Matthias Clasen
b804235aea Add a flags argument to gtk_widget_pick
This will be used to let the inspector and other users
pick insensitive widgets again. For now, update all
callers to pass no flags, preserving the current
behavior.
2019-04-07 17:19:09 +00:00
Matthias Clasen
c2c4133eb0 Fix up the border/background-color removal
I overlooked one level of indirection here. Oops.
2019-03-31 20:43:19 -04:00
Matthias Clasen
6f5675ef3c Stop using deprecated style context api
Use the non-deprecated one it wraps, instead.
Yes, this is cheating...
2019-03-31 15:35:20 -04:00
Timm Bäder
c9d9f8b750 flowbox: Implement get_child_at_pos properly
With transforms in the mix, checking if the coordinate is inside the
widget "allocation" makes even less sense. Just use gtk_widget_pick()
and walk up until we find a GtkFlowBoxChild.
2019-02-16 15:45:06 +01:00
Carlos Garnacho
1c14285dee flowbox: Accept multipress gesture late
So it's able to operate properly with the DnD gesture set by
gtk_drag_source_set(). We usually just react on button release,
that's the right time to claim the gesture.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1557
2019-01-07 21:01:59 +00:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Carlos Garnacho
15e00759c7 eventcontrollerkey: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
1e6eb1f8b9 draggesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Timm Bäder
1db1a30339 flowbox: Remove unnecessary queue_draw call 2018-04-14 12:50:17 +02:00
Carlos Garnacho
5118f9817a gtkflowbox: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Benjamin Otte
df68ef8553 a11y: Remove gtk.h from flowbox includes 2018-02-09 00:47:58 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
72c9853999 list, flow box: Make unpaired releases opt-in
We don't want a pointer that is moved off a scrollbar
to trigger a row when it gets released. To avoid this,
require an explicit opt-in to handling unpaired-releases.
2017-12-30 23:23:16 -05:00
Matthias Clasen
e92c0e85ec Replace gdk_keymap_get_for_display by gdk_display_get_keymap
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Timm Bäder
1aa811ce12 Remove all gtk_widget_get_content_size usages
And remove the function itself. Make everything use gtk_widget_get_width
and gtk_widget_get_height instead.
2017-12-06 07:56:12 +01:00
Carlos Garnacho
0567b41f24 gtkflowbox: Activate items on ::unpaired-release
If the flowbox is single-click.

https://bugzilla.gnome.org/show_bug.cgi?id=789163
2017-11-26 19:42:03 -05:00
Matthias Clasen
a8531605db Some more interning
This avoids more strdups at startup.
2017-11-18 08:18:11 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
e9dd5f327f flowbox: Compute view box from correct variables 2017-11-11 02:49:08 +01:00
Benjamin Otte
c4ecc0993a flowbox: Don't call get_allocation()
That's wome outdated workaround code from the last version of GTK3.
2017-11-05 14:46:01 +01:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
c4d57f85f4 gtkflowbox: Drop crossing/motion event handlers
Those basically controlled priv->active_child_active, which would
1) trigger a redraw when the pointer enters/leaves it, and 2) ensure
that press/release happen on the same child for it to be activated.

The former is not necessary, and the latter can be simplified by
just checking again the child on the coordinates given by the
::release gesture handler. This makes all enter/leave/motion_notify
event handlers unneeded.
2017-09-19 18:40:50 +02:00
Matthias Clasen
6b4dfcadaf flowbox: Convert to GdkEvent API 2017-09-19 18:39:02 +02:00