Commit Graph

706 Commits

Author SHA1 Message Date
Benjamin Otte
bb4fbe3d8f accels: Remove GtkAccelGroup 2020-03-25 23:14:44 -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
Carlos Garnacho
0f73e83f44 gtkwindow: Remove internal popover API
This was only used by text handles, and not anymore.
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
ff6df33b6a accels: Remove GtkAccelGroup 2020-03-18 23:00:51 -04:00
Emmanuele Bassi
b28da74e90 gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-18 23:00:51 -04:00
Benjamin Otte
a411959c91 droptarget: Redo
This is a huge reorganization of GtkDropTarget. I did not know how to
split this up, so it's unfortunately all one commit.

Highlights:

- Split GtkDropTarget into GtkDropTarget and GtkDropTargetAsync
  GtkDropTarget is the simple one that only works with GTypes and offers
  a synchronous interface.
  GtkDropTargetAsync retains the full old functionality and allows
  handling mime types.

- Drop events are handled differently
  Instead of picking a single drop target and sending all DND events to
  it, every event is sent to every drop target. The first one to handle
  the event gets to call gdk_drop_status(), further handlers do not
  interact with the GdkDrop.
  Of course, for the ultimate GDK_DROP_STARTING event, only the first
  one to accept the drop gets to handle it.
  This allows stacking DND event controllers that aren't necessarily
  interested in handling the event or that might decide later to drop
  it.

- Port all widgets to either of those
  Both have a somewhat changed API due to the new event handling.
  For the ones who should use the sync version, lots of cleanup was
  involved to operate on a sync API.
2020-03-02 03:18:55 +01:00
Matthias Clasen
57c8a643ff Drop gtk_grab_get_current
Another grab-related api that we are not using.
2020-02-28 16:29:56 -05:00
Matthias Clasen
0ffb35c9e7 Drop device grabs
We were not using this api at all, so lets drop it.
2020-02-28 16:27:42 -05:00
Benjamin Otte
a12e563cd2 main: Don't synthesize crossing events when nothing changed
This was especially bad because it was confusing the event controllers
so much, they'd emit leave + enter events every time the mouse moved.
2020-02-22 07:33:40 +01:00
Benjamin Otte
fc43ec0bbc gtk: Bubble drag events like motion events
Emit crossing events - with a new GTK_CROSSING_DROP type - like we do
for motion events. There is no more special casing for them.

Note that the gesture has not been updated yet, so some obscure behavior
may occur.
2020-02-22 07:33:40 +01:00
Benjamin Otte
808961564c gdk: Make DRAG_ENTER event take x/y coordinates
Make it mirror the behavior of ENTER/LEAVE events.
2020-02-21 18:19:16 +01:00
Matthias Clasen
e062137b2c motion controller: Match focus event propagation
Make the crossing event generation for pointer events
match what we do for focus now.
2020-02-21 00:51:03 -05:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05: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
Matthias Clasen
e5223b1cee main: Stop calling gdk_event_set_target
GTK is no longer relying on this.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e54e48f6d1 Explicitly pass the target to handle_event
Pass the event propagation target explicitly down to
the event controllers. This is a step towards getting
rid of gdk_event_set_target.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e3158a1bfb Make crossing events handled the same way 2020-02-21 00:50:59 -05:00
Matthias Clasen
64b9c6aaaa main: Drop gtk_get_event_target
This is no longer used.
2020-02-21 00:47:53 -05:00
Matthias Clasen
cd2b58574d Drop GDK_NOTHING
Events of type GDK_NOTHING are good for nothing.
2020-02-21 00:47:53 -05:00
Matthias Clasen
c343031a0e Stop using g_object_ref/unref on events
Use gdk_event_ref/unref instead of g_object_ref/unref.
Events will stop being object soon.
2020-02-21 00:47:53 -05:00
Matthias Clasen
9a1497f582 events: Drop GDK_DESTROY
No backend is emitting GDK_DESTROY events anymore, so no
need to carry this around.
2020-02-21 00:40:52 -05:00
Matthias Clasen
7db8be93f4 gtk: Stop handling GDK_DESTROY differently from GDK_DELETE
We don't have child windows anymore, so there is no difference.
2020-02-21 00:40:52 -05:00
Matthias Clasen
495de0b78b main: Use constructors instead of gdk_event_copy + rewriting 2020-02-21 00:40:52 -05:00
Matthias Clasen
a5f58e8d28 main: Use event constructors
At the same time, stop setting child_surface in
crossing events. Nothing in GTK looks at it.
2020-02-21 00:40:52 -05:00
Benjamin Otte
732716ba95 debug: When debug-printing, treat NULL as the default display
Otherwise we lose debug prints from all code that allows NULL displays.
2020-02-19 01:21:33 +01:00
Benjamin Otte
a278edab22 window: Remove type argument from gtk_window_new() 2020-02-14 21:18:49 +01:00
Matthias Clasen
59b935af38 Merge branch 'mainloop-cleanup' into 'master'
Mainloop cleanup

See merge request GNOME/gtk!1404
2020-02-10 14:32:09 +00:00
Matthias Clasen
9309153abc Remove GTK_DEBUG=baselines
This has been reimplemented differently
in the inspector.
2020-02-10 00:10:43 -05:00
Matthias Clasen
a8db322be6 Drop gtk_get_main_thread
This is not a very useful api, and if you need it,
you can just as easily keep track yourself which thread
called gtk_init().
2020-02-09 23:13:13 -05:00
Matthias Clasen
4dd780a96b Drop gtk_main and gtk_main_quit
The alternatives are to use GtkApplication,
or use GMainContext.
2020-02-09 23:13:13 -05:00
Matthias Clasen
4c22939dea docs: Update an example
Don't use gtk_main() in the mainloop example.
It is going away.
2020-02-09 23:12:32 -05:00
Matthias Clasen
7eb889c7aa Drop gtk_main_level
This api isn't useful without gtk_main, which is also
on the way out.
2020-02-09 23:12:32 -05:00
Matthias Clasen
49a6ad3dd1 Drop gtk_main_iteration
This function and its cousin, gtk_main_iteration_do, are
thin wrappers around GMainContext api that should just
be used directly.
2020-02-09 23:12:32 -05:00
Matthias Clasen
ebc720bfdb Drop gtk_events_pending
This was just a thin wrapper around gtk_main_context_pending,
which should be used directly instead.
2020-02-09 23:11:49 -05:00
Matthias Clasen
057f41532b Remove gtk_main_do_event from the docs 2020-02-09 10:55:37 -05:00
Matthias Clasen
c1970009ff docs: Remove more mentions of gtk_main_do_event 2020-02-09 10:45:33 -05:00
Carlos Garnacho
e67f0bfcfd gtkmain: Wait for GDK_CROSSING_UNGRAB leave event with implicit grabs
If there is a passive grab and the pointer leaves the window we would
receive a GDK_CROSSING_NORMAL event when the pointer moves outside
the window, and a GDK_CROSSING_UNGRAB event when we do release the
button and the implicit grab.

We currently would react to the first, but want to react to the
second. In the time between both events, the client would still receive
pointer motion that will reach the implicitly grabbed widget.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/13
2020-02-07 01:02:47 +01:00
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