[gtk+/wip/ricotz/deprecated: 5/5] gdk: Remove deprecated {keyboard, pointer}_{grab, ungrab} API
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ricotz/deprecated: 5/5] gdk: Remove deprecated {keyboard, pointer}_{grab, ungrab} API
- Date: Mon, 24 Oct 2016 08:16:41 +0000 (UTC)
commit 39d12fcccc761f816096ef1efa655ae504d07fe8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Oct 24 10:13:14 2016 +0200
gdk: Remove deprecated {keyboard,pointer}_{grab,ungrab} API
docs/reference/gdk/gdk4-sections.txt | 8 --
gdk/broadway/gdkwindow-broadway.c | 10 ++-
gdk/gdkdeprecated.c | 53 --------
gdk/gdkdisplay.c | 68 +----------
gdk/gdkdisplay.h | 2 -
gdk/gdkmain.h | 22 ----
gdk/gdktypes.h | 4 +-
gdk/gdkwindow.c | 224 ----------------------------------
gtk/gtkmenushell.c | 2 -
9 files changed, 11 insertions(+), 382 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 801ceee..ff89f8b 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -24,17 +24,10 @@ gdk_flush
<SUBSECTION>
-gdk_pointer_grab
GdkGrabStatus
-gdk_pointer_ungrab
-gdk_pointer_is_grabbed
gdk_set_double_click_time
<SUBSECTION>
-gdk_keyboard_grab
-gdk_keyboard_ungrab
-
-<SUBSECTION>
gdk_beep
<SUBSECTION>
@@ -119,7 +112,6 @@ gdk_display_get_default_screen
gdk_display_get_device_manager
gdk_display_pointer_ungrab
gdk_display_keyboard_ungrab
-gdk_display_pointer_is_grabbed
gdk_display_device_is_grabbed
gdk_display_beep
gdk_display_sync
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 2e63f33..7b478ce 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -1304,6 +1304,8 @@ create_moveresize_window (MoveResizeData *mv_resize,
GdkWindowAttr attributes;
gint attributes_mask;
GdkGrabStatus status;
+ GdkSeat *seat;
+ GdkDevice *pointer;
g_assert (mv_resize->moveresize_emulation_window == NULL);
@@ -1325,13 +1327,17 @@ create_moveresize_window (MoveResizeData *mv_resize,
gdk_window_show (mv_resize->moveresize_emulation_window);
+ seat = gdk_display_get_default_seat (mv_resize->display);
+ pointer = gdk_seat_get_pointer (seat);
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- status = gdk_pointer_grab (mv_resize->moveresize_emulation_window,
+ status = gdk_device_grab (pointer,
+ mv_resize->moveresize_emulation_window,
+ GDK_OWNERSHIP_APPLICATION,
FALSE,
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK,
NULL,
- NULL,
timestamp);
G_GNUC_END_IGNORE_DEPRECATIONS;
diff --git a/gdk/gdkdeprecated.c b/gdk/gdkdeprecated.c
index 02a40fb..e6e8955 100644
--- a/gdk/gdkdeprecated.c
+++ b/gdk/gdkdeprecated.c
@@ -28,59 +28,6 @@
#include "gdkwindow.h"
/**
- * gdk_pointer_ungrab:
- * @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
- * timestamp is available.
- *
- * Ungrabs the pointer on the default display, if it is grabbed by this
- * application.
- *
- * Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
- * instead.
- **/
-void
-gdk_pointer_ungrab (guint32 time)
-{
- gdk_display_pointer_ungrab (gdk_display_get_default (), time);
-}
-
-/**
- * gdk_pointer_is_grabbed:
- *
- * Returns %TRUE if the pointer on the default display is currently
- * grabbed by this application.
- *
- * Note that this does not take the inmplicit pointer grab on button
- * presses into account.
- *
- * Returns: %TRUE if the pointer is currently grabbed by this application.
- *
- * Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
- **/
-gboolean
-gdk_pointer_is_grabbed (void)
-{
- return gdk_display_pointer_is_grabbed (gdk_display_get_default ());
-}
-
-/**
- * gdk_keyboard_ungrab:
- * @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
- * timestamp is available.
- *
- * Ungrabs the keyboard on the default display, if it is grabbed by this
- * application.
- *
- * Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
- * instead.
- **/
-void
-gdk_keyboard_ungrab (guint32 time)
-{
- gdk_display_keyboard_ungrab (gdk_display_get_default (), time);
-}
-
-/**
* gdk_window_at_pointer:
* @win_x: (out) (allow-none): return location for origin of the window under the pointer
* @win_y: (out) (allow-none): return location for origin of the window under the pointer
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 92ac894..bd9d152 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1418,8 +1418,7 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
* @device: device to get the grab information from
* @grab_window: (out) (transfer none): location to store current grab window
* @owner_events: (out): location to store boolean indicating whether
- * the @owner_events flag to gdk_keyboard_grab() or
- * gdk_pointer_grab() was %TRUE.
+ * the @owner_events flag to gdk_device_grab() was %TRUE.
*
* Determines information about the current keyboard grab.
* This is not public API and must not be used by applications.
@@ -1454,71 +1453,6 @@ gdk_device_grab_info (GdkDisplay *display,
}
/**
- * gdk_device_grab_info_libgtk_only:
- * @display: the display for which to get the grab information
- * @device: device to get the grab information from
- * @grab_window: (out) (transfer none): location to store current grab window
- * @owner_events: (out): location to store boolean indicating whether
- * the @owner_events flag to gdk_keyboard_grab() or
- * gdk_pointer_grab() was %TRUE.
- *
- * Determines information about the current keyboard grab.
- * This is not public API and must not be used by applications.
- *
- * Returns: %TRUE if this application currently has the
- * keyboard grabbed.
- *
- * Deprecated: 3.16: The symbol was never meant to be used outside
- * of GTK+
- */
-gboolean
-gdk_device_grab_info_libgtk_only (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow **grab_window,
- gboolean *owner_events)
-{
- return gdk_device_grab_info (display, device, grab_window, owner_events);
-}
-
-/**
- * gdk_display_pointer_is_grabbed:
- * @display: a #GdkDisplay
- *
- * Test if the pointer is grabbed.
- *
- * Returns: %TRUE if an active X pointer grab is in effect
- *
- * Since: 2.2
- *
- * Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
- */
-gboolean
-gdk_display_pointer_is_grabbed (GdkDisplay *display)
-{
- GList *seats, *s;
- GdkDevice *device;
-
- g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
-
- seats = gdk_display_list_seats (display);
-
- for (s = seats; s; s = s->next)
- {
- device = gdk_seat_get_pointer (s->data);
-
- if (gdk_display_device_is_grabbed (display, device))
- {
- g_list_free (seats);
- return TRUE;
- }
- }
-
- g_list_free (seats);
-
- return FALSE;
-}
-
-/**
* gdk_display_device_is_grabbed:
* @display: a #GdkDisplay
* @device: a #GdkDevice
diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h
index d74cf3a..3f8376f 100644
--- a/gdk/gdkdisplay.h
+++ b/gdk/gdkdisplay.h
@@ -65,8 +65,6 @@ void gdk_display_pointer_ungrab (GdkDisplay *display,
GDK_DEPRECATED_IN_3_0_FOR(gdk_device_ungrab)
void gdk_display_keyboard_ungrab (GdkDisplay *display,
guint32 time_);
-GDK_DEPRECATED_IN_3_0_FOR(gdk_display_device_is_grabbed)
-gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display);
#endif /* GDK_MULTIDEVICE_SAFE */
GDK_AVAILABLE_IN_ALL
diff --git a/gdk/gdkmain.h b/gdk/gdkmain.h
index e623dbd..74e9951 100644
--- a/gdk/gdkmain.h
+++ b/gdk/gdkmain.h
@@ -81,28 +81,6 @@ const gchar * gdk_get_display_arg_name (void);
GDK_DEPRECATED_IN_3_8_FOR(gdk_display_get_name (gdk_display_get_default ()))
gchar* gdk_get_display (void);
-#ifndef GDK_MULTIDEVICE_SAFE
-GDK_DEPRECATED_IN_3_0_FOR(gdk_device_grab)
-GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time_);
-GDK_DEPRECATED_IN_3_0_FOR(gdk_device_grab)
-GdkGrabStatus gdk_keyboard_grab (GdkWindow *window,
- gboolean owner_events,
- guint32 time_);
-#endif /* GDK_MULTIDEVICE_SAFE */
-
-#ifndef GDK_MULTIDEVICE_SAFE
-GDK_DEPRECATED_IN_3_0_FOR(gdk_device_ungrab)
-void gdk_pointer_ungrab (guint32 time_);
-GDK_DEPRECATED_IN_3_0_FOR(gdk_device_ungrab)
-void gdk_keyboard_ungrab (guint32 time_);
-GDK_DEPRECATED_IN_3_0_FOR(gdk_display_device_is_grabbed)
-gboolean gdk_pointer_is_grabbed (void);
-#endif /* GDK_MULTIDEVICE_SAFE */
GDK_AVAILABLE_IN_ALL
void gdk_set_double_click_time (guint msec);
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 4818fe3..0dac774 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -339,8 +339,8 @@ typedef enum
* @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
* @GDK_GRAB_FAILED: the grab failed for some other reason. Since 3.16
*
- * Returned by gdk_device_grab(), gdk_pointer_grab() and gdk_keyboard_grab() to
- * indicate success or the reason for the failure of the grab attempt.
+ * Returned by gdk_device_grab() to indicate success or the reason for the
+ * failure of the grab attempt.
*/
typedef enum
{
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ec0c916..214246d 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -8121,230 +8121,6 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display,
}
/**
- * gdk_pointer_grab:
- * @window: the #GdkWindow which will own the grab (the grab window).
- * @owner_events: if %FALSE then all pointer events are reported with respect to
- * @window 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 @window 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. Note that only pointer events (i.e. button and motion events)
- * may be selected.
- * @confine_to: (allow-none): If non-%NULL, the pointer will be confined to this
- * window during the grab. If the pointer is outside @confine_to, it will
- * automatically be moved to the closest edge of @confine_to and enter
- * and leave events will be generated as necessary.
- * @cursor: (allow-none): the cursor to display while the grab is active. If this is %NULL then
- * the normal cursors are used for @window and its descendants, and the cursor
- * for @window is used for all other windows.
- * @time_: the timestamp of the event which led to this pointer grab. This usually
- * comes from a #GdkEventButton struct, though %GDK_CURRENT_TIME can be used if
- * the time isn’t known.
- *
- * Grabs the pointer (usually a mouse) so that all events are passed to this
- * application until the pointer is ungrabbed with gdk_pointer_ungrab(), or
- * the grab window becomes unviewable.
- * This overrides any previous pointer grab by this client.
- *
- * Pointer grabs are used for operations which need complete control over mouse
- * events, even if the mouse leaves the application.
- * For example in GTK+ it is used for Drag and Drop, for dragging the handle in
- * the #GtkHPaned and #GtkVPaned widgets.
- *
- * 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 window 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: 3.0: Use gdk_device_grab() instead.
- **/
-GdkGrabStatus
-gdk_pointer_grab (GdkWindow * window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- guint32 time)
-{
- GdkWindow *native;
- GdkDisplay *display;
- GdkDevice *device;
- GdkGrabStatus res = 0;
- gulong serial;
- GList *seats, *s;
-
- g_return_val_if_fail (window != NULL, GDK_GRAB_FAILED);
- g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_FAILED);
- g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), GDK_GRAB_FAILED);
-
- /* We need a native window for confine to to work, ensure we have one */
- if (confine_to)
- {
- if (!gdk_window_ensure_native (confine_to))
- {
- g_warning ("Can't confine to grabbed window, not native");
- confine_to = NULL;
- }
- }
-
- /* Non-viewable client side window => fail */
- if (!_gdk_window_has_impl (window) &&
- !gdk_window_is_viewable (window))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (window);
- while (gdk_window_is_offscreen (native))
- {
- native = gdk_offscreen_window_get_embedder (native);
-
- if (native == NULL ||
- (!_gdk_window_has_impl (native) &&
- !gdk_window_is_viewable (native)))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (native);
- }
-
- display = gdk_window_get_display (window);
-
- serial = _gdk_display_get_next_serial (display);
- seats = gdk_display_list_seats (display);
-
- for (s = seats; s; s = s->next)
- {
- device = gdk_seat_get_pointer (s->data);
-
- res = GDK_DEVICE_GET_CLASS (device)->grab (device,
- native,
- owner_events,
- get_native_grab_event_mask (event_mask),
- confine_to,
- cursor,
- time);
-
- if (res == GDK_GRAB_SUCCESS)
- _gdk_display_add_device_grab (display,
- device,
- window,
- native,
- GDK_OWNERSHIP_NONE,
- owner_events,
- event_mask,
- serial,
- time,
- FALSE);
- }
-
- /* FIXME: handle errors when grabbing */
-
- g_list_free (seats);
-
- return res;
-}
-
-/**
- * gdk_keyboard_grab:
- * @window: the #GdkWindow which will own the grab (the grab window).
- * @owner_events: if %FALSE then all keyboard events are reported with respect to
- * @window. If %TRUE then keyboard events for this application are
- * reported as normal, but keyboard events outside this application
- * are reported with respect to @window. Both key press and key
- * release events are always reported, independant of the event mask
- * set by the application.
- * @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is
- * available.
- *
- * Grabs the keyboard so that all events are passed to this
- * application until the keyboard is ungrabbed with gdk_keyboard_ungrab().
- * This overrides any previous keyboard grab by this client.
- *
- * 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: 3.0: Use gdk_device_grab() instead.
- **/
-GdkGrabStatus
-gdk_keyboard_grab (GdkWindow *window,
- gboolean owner_events,
- guint32 time)
-{
- GdkWindow *native;
- GdkDisplay *display;
- GdkDevice *device;
- GdkGrabStatus res = 0;
- gulong serial;
- GList *seats, *s;
-
- g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_FAILED);
-
- /* Non-viewable client side window => fail */
- if (!_gdk_window_has_impl (window) &&
- !gdk_window_is_viewable (window))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (window);
-
- while (gdk_window_is_offscreen (native))
- {
- native = gdk_offscreen_window_get_embedder (native);
-
- if (native == NULL ||
- (!_gdk_window_has_impl (native) &&
- !gdk_window_is_viewable (native)))
- return GDK_GRAB_NOT_VIEWABLE;
-
- native = gdk_window_get_toplevel (native);
- }
-
- display = gdk_window_get_display (window);
- serial = _gdk_display_get_next_serial (display);
- seats = gdk_display_list_seats (display);
-
- for (s = seats; s; s = s->next)
- {
- device = gdk_seat_get_keyboard (s->data);
-
- res = GDK_DEVICE_GET_CLASS (device)->grab (device,
- native,
- owner_events,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL,
- NULL,
- time);
-
- if (res == GDK_GRAB_SUCCESS)
- _gdk_display_add_device_grab (display,
- device,
- window,
- native,
- GDK_OWNERSHIP_NONE,
- owner_events, 0,
- serial,
- time,
- FALSE);
- }
-
- /* FIXME: handle errors when grabbing */
-
- g_list_free (seats);
-
- return res;
-}
-
-/**
* gdk_window_geometry_changed:
* @window: an embedded offscreen #GdkWindow
*
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index d09c918..4430b4b 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -1886,8 +1886,6 @@ gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell)
* should not display mnemonics or accelerators, since it cannot be
* guaranteed that they will work.
*
- * See also gdk_keyboard_grab()
- *
* Since: 2.8
*/
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]