From 04dfbf75136b67c6f3035a5903cd2911bb79526f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 29 Mar 2019 11:31:13 -0400 Subject: [PATCH 1/3] Remove gdk_device_grab/ungrab from public api They are still used internally in gdk, but we no longer offer them as public api. --- docs/reference/gdk/gdk4-sections.txt | 4 -- gdk/gdkdevice.c | 59 ---------------------------- gdk/gdkdevice.h | 13 ------ gdk/gdkinternals.h | 11 ++++++ 4 files changed, 11 insertions(+), 76 deletions(-) diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index f001a252f8..b7bbd6891e 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -502,10 +502,6 @@ gdk_device_get_n_keys gdk_device_get_axes gdk_device_get_seat - -gdk_device_grab -gdk_device_ungrab - gdk_device_get_state gdk_device_get_position diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index 9abdacda68..18640a7f74 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -1242,56 +1242,6 @@ get_native_grab_event_mask (GdkEventMask grab_mask) GDK_BUTTON3_MOTION_MASK)); } -/** - * gdk_device_grab: - * @device: a #GdkDevice. To get the device you can use gtk_get_current_event_device() - * or gdk_event_get_device() if the grab is in reaction to an event. Also, you can use - * gdk_seat_get_pointer() but only in code that isn’t triggered by a - * #GdkEvent and there aren’t other means to get a meaningful #GdkDevice to operate on. - * @surface: the #GdkSurface which will own the grab (the grab surface) - * @grab_ownership: specifies the grab ownership. - * @owner_events: if %FALSE then all device events are reported with respect to - * @surface and are only reported if selected by @event_mask. If - * %TRUE then pointer events for this application are reported - * as normal, but pointer events outside this application are - * reported with respect to @surface and only if selected by - * @event_mask. In either mode, unreported events are discarded. - * @event_mask: specifies the event mask, which is used in accordance with - * @owner_events. - * @cursor: (allow-none): the cursor to display while the grab is active if the device is - * a pointer. If this is %NULL then the normal cursors are used for - * @surface and its descendants, and the cursor for @surface is used - * elsewhere. - * @time_: the timestamp of the event which led to this pointer grab. This - * usually comes from the #GdkEvent struct, though %GDK_CURRENT_TIME - * can be used if the time isn’t known. - * - * Grabs the device so that all events coming from this device are passed to - * this application until the device is ungrabbed with gdk_device_ungrab(), - * or the surface becomes unviewable. This overrides any previous grab on the device - * by this client. - * - * Note that @device and @surface need to be on the same display. - * - * Device grabs are used for operations which need complete control over the - * given device events (either pointer or keyboard). For example in GTK+ this - * is used for Drag and Drop operations, popup menus and such. - * - * Note that if the event mask of an X window has selected both button press - * and button release events, then a button press event will cause an automatic - * pointer grab until the button is released. X does this automatically since - * most applications expect to receive button press and release events in pairs. - * It is equivalent to a pointer grab on the surface with @owner_events set to - * %TRUE. - * - * If you set up anything at the time you take the grab that needs to be - * cleaned up when the grab ends, you should handle the #GdkEventGrabBroken - * events that are emitted when the grab ends unvoluntarily. - * - * Returns: %GDK_GRAB_SUCCESS if the grab was successful. - * - * Deprecated: Use gdk_seat_grab() instead. - **/ GdkGrabStatus gdk_device_grab (GdkDevice *device, GdkSurface *surface, @@ -1344,15 +1294,6 @@ gdk_device_grab (GdkDevice *device, return res; } -/** - * gdk_device_ungrab: - * @device: a #GdkDevice - * @time_: a timestap (e.g. %GDK_CURRENT_TIME). - * - * Release any grab on @device. - * - * Deprecated: 3.20. Use gdk_seat_ungrab() instead. - */ void gdk_device_ungrab (GdkDevice *device, guint32 time_) diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h index 3ae1c209ca..1e65d6c0ea 100644 --- a/gdk/gdkdevice.h +++ b/gdk/gdkdevice.h @@ -211,19 +211,6 @@ GList * gdk_device_list_slave_devices (GdkDevice *device); GDK_AVAILABLE_IN_ALL GdkDeviceType gdk_device_get_device_type (GdkDevice *device); -GDK_DEPRECATED_FOR(gdk_seat_grab) -GdkGrabStatus gdk_device_grab (GdkDevice *device, - GdkSurface *surface, - GdkGrabOwnership grab_ownership, - gboolean owner_events, - GdkEventMask event_mask, - GdkCursor *cursor, - guint32 time_); - -GDK_DEPRECATED_FOR(gdk_seat_ungrab) -void gdk_device_ungrab (GdkDevice *device, - guint32 time_); - GDK_AVAILABLE_IN_ALL GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device); diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index c6ed927826..f2261f0571 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -351,6 +351,17 @@ void gdk_synthesize_surface_state (GdkSurface *surface, GdkSurfaceState unset_flags, GdkSurfaceState set_flags); +GdkGrabStatus gdk_device_grab (GdkDevice *device, + GdkSurface *surface, + GdkGrabOwnership grab_ownership, + gboolean owner_events, + GdkEventMask event_mask, + GdkCursor *cursor, + guint32 time_); +void gdk_device_ungrab (GdkDevice *device, + guint32 time_); + + G_END_DECLS #endif /* __GDK_INTERNALS_H__ */ From 1ea1decfd69cd119b95f4061e37d0204ad31e5d6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 29 Mar 2019 11:55:42 -0400 Subject: [PATCH 2/3] Add a missing include --- gdk/gdkseatdefault.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c index 14dbb75f97..22b4b64e9b 100644 --- a/gdk/gdkseatdefault.c +++ b/gdk/gdkseatdefault.c @@ -19,6 +19,7 @@ #include "gdkseatdefaultprivate.h" #include "gdkdevicetoolprivate.h" +#include "gdkinternals.h" typedef struct _GdkSeatDefaultPrivate GdkSeatDefaultPrivate; From 1e372f57f9c03fcbe7b9af1c5d71b946fa5b24e3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 29 Mar 2019 11:55:58 -0400 Subject: [PATCH 3/3] Don't mark GDK_SURFACE_STATE_TILED as deprecated I've come to the conclusion that we should keep this state, since not all backends support per-edge information. Updated the docs to explain how the tiled state relates to the per-edge states. --- gdk/gdksurface.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h index 1ec9ec3318..8f1364f3da 100644 --- a/gdk/gdksurface.h +++ b/gdk/gdksurface.h @@ -356,16 +356,15 @@ struct _GdkGeometry /** * GdkSurfaceState: - * @GDK_SURFACE_STATE_WITHDRAWN: the surface is not shown. - * @GDK_SURFACE_STATE_ICONIFIED: the surface is minimized. - * @GDK_SURFACE_STATE_MAXIMIZED: the surface is maximized. - * @GDK_SURFACE_STATE_STICKY: the surface is sticky. - * @GDK_SURFACE_STATE_FULLSCREEN: the surface is maximized without - * decorations. - * @GDK_SURFACE_STATE_ABOVE: the surface is kept above other surfaces. - * @GDK_SURFACE_STATE_BELOW: the surface is kept below other surfaces. - * @GDK_SURFACE_STATE_FOCUSED: the surface is presented as focused (with active decorations). - * @GDK_SURFACE_STATE_TILED: the surface is in a tiled state. Deprecated + * @GDK_SURFACE_STATE_WITHDRAWN: the surface is not shown + * @GDK_SURFACE_STATE_ICONIFIED: the surface is minimized + * @GDK_SURFACE_STATE_MAXIMIZED: the surface is maximized + * @GDK_SURFACE_STATE_STICKY: the surface is sticky + * @GDK_SURFACE_STATE_FULLSCREEN: the surface is maximized without decorations + * @GDK_SURFACE_STATE_ABOVE: the surface is kept above other surfaces + * @GDK_SURFACE_STATE_BELOW: the surface is kept below other surfaces + * @GDK_SURFACE_STATE_FOCUSED: the surface is presented as focused (with active decorations) + * @GDK_SURFACE_STATE_TILED: the surface is in a tiled state * @GDK_SURFACE_STATE_TOP_TILED: whether the top edge is tiled * @GDK_SURFACE_STATE_TOP_RESIZABLE: whether the top edge is resizable * @GDK_SURFACE_STATE_RIGHT_TILED: whether the right edge is tiled @@ -376,6 +375,11 @@ struct _GdkGeometry * @GDK_SURFACE_STATE_LEFT_RESIZABLE: whether the left edge is resizable * * Specifies the state of a toplevel surface. + * + * On platforms that support information about individual edges, the %GDK_SURFACE_STATE_TILED + * state will be set whenever any of the individual tiled states is set. On platforms + * that lack that support, the tiled state will give an indication of tiledness without + * any of the per-edge states being set. */ typedef enum {