Commit Graph

668 Commits

Author SHA1 Message Date
Matthias Clasen
f5daecf353 Merge branch 'dnd-gestures-2' into 'master'
Add new dnd api

See merge request GNOME/gtk!1278
2020-01-11 06:09:58 +00:00
Christian Hergert
2f3518c80d gtkmain: be deterministic in source removal
Fixes gtk_main_sync() to only remove a source if it has not
already executed (and been removed). The previous code was
using gtk_main_quit() directly which would be non-determinstic
based on the previous value in the return register.
2020-01-10 15:04:44 -08:00
Christian Hergert
4a7f68e79e gtkmain: short-circuit gtk_main_sync() where no display
If there is no display, we will hit the slow path here which
can introduce long latencies in unit tests. This checks for
a NULL list of displays and simply short-circuits.
2020-01-10 15:00:10 -08:00
Matthias Clasen
f3be49838f Move code over
Move remaining code from gtkdnd.c to gtkdragdest.c
and nuke gtkdnd.c and gtkdndprivate.h.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f898bee032 Use normal event propagation for DND events
This works just fine, now that drop targets are
event controllers. There is only a very vestigial
gtk_drag_dest_handle_event() left that deals with
corner cases.
2020-01-08 18:48:21 -05:00
Matthias Clasen
7ee5779efc gtk: Remove menu code
GtkMenu, GtkMenuBar, GtkMenuItem and their subclasses
and supporting classes are replaced by model-based popover
implementations.
2019-12-29 20:31:58 -05:00
Christoph Reiter
94d9088034 Print a warning if GTK_DEBUG is set but gtk isn't built with G_ENABLE_DEBUG
G_ENABLE_DEBUG is tied to the meson builttype property, so building with "plain"
results in G_ENABLE_DEBUG not being defined and the GTK_DEBUG env var just gets ignored
for that build.

Since it can be confusing that GTK_DEBUG has no effect print a warning message instead.

See #2020. This is a port of !1109 to master
2019-10-02 21:35:20 +02:00
Timm Bäder
e3f1a3d27c main: Check if any debug flags are set in gtk_get_debug_flags()
We end up checking the debug flags for the default display, but that's
unnecessary if we know that no display has any debug flags set anyway.
2019-09-09 17:36:26 +02:00
Matthias Clasen
405121bccc constraint solver: Use GTK_NOTE
Allow using GTK_DEBUG=constraints to get debug
output from the constraints solver.
2019-07-01 00:10:11 +01:00
Matthias Clasen
6a4a082660 main: Move visible mnemonics handling
No need to special-case this anymore; we can use
a regular event controller in GtkWindow for this.
2019-06-21 02:37:51 +00:00
Matthias Clasen
a7cdcdf92c main: Move visible focus handling
No need to special-case this anymore; we can use
a regular event controller in GtkWindow for this.
2019-06-21 02:37:12 +00:00
Matthias Clasen
bc4f744562 main: Warn if GDK sends us bad focus events
The new rule for focus events from the windowing
system is: We only want them for toplevels. If you
put focus on popups, we don't want to know about
it, and you still need to deliver key events to
the toplevel.
2019-06-09 17:38:54 +00:00
Matthias Clasen
fcc8a365b9 main: Use gdk_surface_translate_coordinates
This gets rid of another use of global coordinates.
2019-05-29 18:04:08 +00:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
302d2a04ae Stop using gtk_widget_get_surface
Replace all uses of gtk_widget_get_surface by
gtk_native_get_surface.
2019-05-28 20:25:16 +00:00
Matthias Clasen
0d25233e39 main: Use gtk_widget_get_native 2019-05-28 20:25:13 +00:00
Matthias Clasen
66ccc825de main: Remove special-case hiding popopvers
This is now happening in GDK, so we don't have
to do this here anymore.
2019-05-28 20:25:13 +00:00
Matthias Clasen
6ab8ab87c8 Reimplement GtkPopover 2019-05-28 20:25:13 +00:00
Matthias Clasen
9059eee2f0 Review and replace uses of get_toplevel
Now that roots can have parent widgets, we need to
carefully examine all calls of gtk_widget_get_toplevel,
and replace them with gtk_widget_get_root if we want
the nearest root, and not the ultimate end of the parent
chain.
2019-05-28 20:24:39 +00:00
Matthias Clasen
c1d5e82d95 Use GtkNative APIs instead of GtkRoot 2019-05-28 20:24:39 +00:00
Matthias Clasen
618f1f08ec main: guard window-specific code paths
This was overlooked when I first tried to
make things for GtkRoot.
2019-05-28 19:54:32 +00:00
Matthias Clasen
cfe648eb11 Don't load print backends more than once
The modules don't depend on the default display
at all, and loading them more than once makes
the displayclose test fail here, locally.
2019-05-27 12:59:36 +00:00
Matthias Clasen
15f4c40a91 Rename gtkprintbackend.h to gtkprintbackendprivate.h
Follow the naming convention for private headers.
2019-05-26 22:23:52 +00:00
Benjamin Otte
4f0cc3086f win32: Rename a shadowing variable 2019-05-21 07:23:30 +02:00
Matthias Clasen
77ff83cdd1 Fix a compiler warning 2019-04-19 13:58:52 -04:00
Benjamin Otte
b9fb2f0933 Add missing G_GNUC_FALLTHROUGH statements 2019-04-15 14:40:25 +02:00
Benjamin Otte
0791924bf7 Convert fallthrough comments to G_GNUC_FALLTHROUGH
This way it's very obvious that fallthrough is indeed what we want.

Also bump the glib requirement to 2.59 which introduced
G_GNUC_FALLTHROUGH.
2019-04-15 14:40:25 +02: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
6f7d9f9613 A round of + removal
change GTK+ to GTK throughout gtkmain.c.
2019-04-05 05:07:32 +00:00
Benjamin Otte
551ced9ae4 Fix compile warning 2019-03-23 03:08:20 +01:00
Matthias Clasen
1ada7bbc02 Fix hover state handling
We were not paying enough attention to detail when updating
hover and focus state while generating crossing events. The
invariant that we need to preserve here is that when a widget
has focus or hover, its parent does too.
2019-03-22 16:35:20 -04:00
Matthias Clasen
5638882dca Remove debug spew 2019-03-22 14:44:51 -04:00
Matthias Clasen
f47c376fb1 main: Fix crossing event generation for parented roots
We were walking the parent chain here, which now
always needs to consider whether it should stop
at roots. Like this one should.

The symptom was that a label with a popup attached to
it would end up with an unintentional focus ring that
would not go away.
2019-03-19 21:33:38 -04:00
Matthias Clasen
6ddb61119a Use root in gdk_synthesize_crossing_events 2019-03-16 21:30:48 -04:00
Matthias Clasen
888b92674f Move maintaining the focus chain
Put this code in the same place where we generate
the crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
7d354b5084 Some fixes to crossing event generation
In the inferior and ancestor cases, we were missing
the initial/final event.
2019-03-16 21:24:45 -04:00
Matthias Clasen
adb547a147 Export gtk_synthesize_crossing_events internally
We want to use this for focus changes, now that
it can emit focus change events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
cdcd2bb073 Share crossing and focus change event code
Make a single function that can emit both
enter/leave and focus change events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
c73972f7df gdk: Rename gdk_event_set_user_data
Lets call it what it is, the target.
All of this is private api anyway.

Update all callers.
2019-03-16 21:24:45 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Matthias Clasen
9861887f1a inspector: Avoid grabs for inspecting
Instead of using a grab on a GtkInvisible, use
a hook in the GTK event propagation machinery to
get events.

The only downside of this approach is that we
lose the crosshair cursor. But we get rid of
the last use of GtkInvisible.
2019-02-24 09:41:13 -05:00
Matthias Clasen
4e8aa0c37a main: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
cc2c39209c Stop using gdk_event_handler_set
We no longer need it.
2019-02-23 14:13:57 -05:00
Timm Bäder
1674b6e269 main: Prefer implicit grab widget to target widget for motion events
When an implcit grab is going on, we don't need to consider other
widgets for motion (etc.) events.
2019-02-05 15:13:01 +01:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Timm Bäder
489e87baea main: Rename local variable
Make it a little clearer that this is the event widget and not just any
widget.
2019-02-04 17:05:30 +01:00
Timm Bäder
43234eec42 gtkmain: Rename event_widget to target_widget in do_event
The event_widget is the widget that the surface belongs to which got
this event. The target widget is the one that will receive the event.
The previous terminology was confusing.
2019-02-04 17:05:30 +01:00
Emmanuele Bassi
a7fa1cf6f2 Merge branch '1480-critical-csd-close-button' into 'master'
gtkmain: Avoid critical messages on closing window

Closes #1480

See merge request GNOME/gtk!442
2019-01-30 11:53:12 +00:00
Timm Bäder
0a5362a7d9 gtkmain: Remove comment mentioning GDK_PROPERTY_NOTIFY
... which doesn't exist anymore.
2019-01-29 07:19:54 +01:00