[gtk+] Drop GdkScreen from GdkDevice apis



commit a3cffa50720ef148f68108b578894c4a8af7f623
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 31 12:30:38 2017 -0400

    Drop GdkScreen from GdkDevice apis
    
    Returning the screen does not add anything here and
    GdkScreen is going away.

 gdk/broadway/gdkdevice-broadway.c  |    2 --
 gdk/gdkdevice.c                    |   31 ++++++++-----------------------
 gdk/gdkdevice.h                    |    3 ---
 gdk/gdkdeviceprivate.h             |    1 -
 gdk/gdkwindow.c                    |    2 +-
 gdk/mir/gdkmirkeyboard.c           |    1 -
 gdk/mir/gdkmirpointer.c            |    1 -
 gdk/quartz/gdkdevice-core-quartz.c |    1 -
 gdk/wayland/gdkdevice-wayland.c    |    1 -
 gdk/win32/gdkdevice-virtual.c      |    1 -
 gdk/win32/gdkdevice-win32.c        |    1 -
 gdk/win32/gdkdevice-wintab.c       |    1 -
 gdk/win32/gdkwindow-win32.c        |    7 ++-----
 gdk/x11/gdkdevice-core-x11.c       |    4 ++--
 gdk/x11/gdkdevice-xi2.c            |    3 +--
 gdk/x11/gdkdnd-x11.c               |    4 +---
 gtk/gtkdnd.c                       |    7 ++-----
 gtk/gtkmenu.c                      |    2 +-
 gtk/gtknotebook.c                  |    6 ++----
 gtk/gtkwidget.c                    |    1 -
 gtk/gtkwindow.c                    |    4 ++--
 21 files changed, 22 insertions(+), 62 deletions(-)
---
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 4ac423c..b05d444 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -37,7 +37,6 @@ static void gdk_broadway_device_set_window_cursor (GdkDevice *device,
                                                   GdkWindow *window,
                                                   GdkCursor *cursor);
 static void gdk_broadway_device_warp (GdkDevice *device,
-                                     GdkScreen *screen,
                                      gdouble    x,
                                      gdouble    y);
 static void gdk_broadway_device_query_state (GdkDevice        *device,
@@ -133,7 +132,6 @@ gdk_broadway_device_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_broadway_device_warp (GdkDevice *device,
-                         GdkScreen *screen,
                          gdouble    x,
                          gdouble    y)
 {
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index d44df42..e6aa335 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -565,8 +565,6 @@ gdk_device_get_state (GdkDevice       *device,
 /**
  * gdk_device_get_position_double:
  * @device: pointer device to query status about.
- * @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen
- *          the @device is on, or %NULL.
  * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
  * @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
  *
@@ -579,13 +577,11 @@ gdk_device_get_state (GdkDevice       *device,
  **/
 void
 gdk_device_get_position_double (GdkDevice        *device,
-                                GdkScreen       **screen,
                                 gdouble          *x,
                                 gdouble          *y)
 {
   GdkDisplay *display;
   gdouble tmp_x, tmp_y;
-  GdkScreen *default_screen;
 
   g_return_if_fail (GDK_IS_DEVICE (device));
   g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
@@ -595,16 +591,12 @@ gdk_device_get_position_double (GdkDevice        *device,
   g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
                     gdk_display_device_is_grabbed (display, device));
 
-  default_screen = gdk_display_get_default_screen (display);
-
   _gdk_device_query_state (device,
                            NULL,
                            NULL,
                            &tmp_x, &tmp_y,
                            NULL, NULL, NULL);
 
-  if (screen)
-    *screen = default_screen;
   if (x)
     *x = tmp_x;
   if (y)
@@ -614,8 +606,6 @@ gdk_device_get_position_double (GdkDevice        *device,
 /**
  * gdk_device_get_position:
  * @device: pointer device to query status about.
- * @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen
- *          the @device is on, or %NULL.
  * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
  * @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
  *
@@ -627,14 +617,13 @@ gdk_device_get_position_double (GdkDevice        *device,
  * Since: 3.0
  **/
 void
-gdk_device_get_position (GdkDevice        *device,
-                         GdkScreen       **screen,
-                         gint             *x,
-                         gint             *y)
+gdk_device_get_position (GdkDevice *device,
+                         gint      *x,
+                         gint      *y)
 {
   gdouble tmp_x, tmp_y;
 
-  gdk_device_get_position_double (device, screen, &tmp_x, &tmp_y);
+  gdk_device_get_position_double (device, &tmp_x, &tmp_y);
   if (x)
     *x = round (tmp_x);
   if (y)
@@ -1511,13 +1500,12 @@ gdk_device_ungrab (GdkDevice  *device,
 /**
  * gdk_device_warp:
  * @device: the device to warp.
- * @screen: the screen to warp @device to.
  * @x: the X coordinate of the destination.
  * @y: the Y coordinate of the destination.
  *
- * Warps @device in @display to the point @x,@y on
- * the screen @screen, unless the device is confined
- * to a window by a grab, in which case it will be moved
+ * Warps @device in @display to the point @x,@y,
+ * unless the device is confined to a window by a grab,
+ * in which case it will be moved
  * as far as allowed by the grab. Warping the pointer
  * creates events as if the user had moved the mouse
  * instantaneously to the destination.
@@ -1531,15 +1519,12 @@ gdk_device_ungrab (GdkDevice  *device,
  **/
 void
 gdk_device_warp (GdkDevice  *device,
-                 GdkScreen  *screen,
                  gint        x,
                  gint        y)
 {
   g_return_if_fail (GDK_IS_DEVICE (device));
-  g_return_if_fail (GDK_IS_SCREEN (screen));
-  g_return_if_fail (gdk_device_get_display (device) == gdk_screen_get_display (screen));
 
-  GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
+  GDK_DEVICE_GET_CLASS (device)->warp (device, x, y);
 }
 
 /* Private API */
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index c9ca3c6..b86f5ca 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -169,7 +169,6 @@ void     gdk_device_get_state    (GdkDevice         *device,
                                   GdkModifierType   *mask);
 GDK_AVAILABLE_IN_ALL
 void     gdk_device_get_position (GdkDevice         *device,
-                                  GdkScreen        **screen,
                                   gint              *x,
                                   gint              *y);
 GDK_AVAILABLE_IN_ALL
@@ -180,7 +179,6 @@ GdkWindow *
                                   gint              *win_y);
 GDK_AVAILABLE_IN_3_10
 void     gdk_device_get_position_double (GdkDevice         *device,
-                                         GdkScreen        **screen,
                                          gdouble           *x,
                                          gdouble           *y);
 GDK_AVAILABLE_IN_3_10
@@ -241,7 +239,6 @@ void          gdk_device_ungrab      (GdkDevice        *device,
 
 GDK_AVAILABLE_IN_ALL
 void          gdk_device_warp        (GdkDevice        *device,
-                                      GdkScreen        *screen,
                                       gint              x,
                                       gint              y);
 
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 86d2a55..e6dcd6c 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -89,7 +89,6 @@ struct _GdkDeviceClass
                               GdkCursor *cursor);
 
   void (* warp)              (GdkDevice  *device,
-                              GdkScreen  *screen,
                               gdouble     x,
                               gdouble     y);
   void (* query_state)       (GdkDevice       *device,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 0844587..c2ee515 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -7358,7 +7358,7 @@ gdk_drag_begin_for_device (GdkWindow *window,
 {
   gint x, y;
 
-  gdk_device_get_position (device, NULL, &x, &y);
+  gdk_device_get_position (device, &x, &y);
 
   return gdk_drag_begin_from_point (window, device, targets, x, y);
 }
diff --git a/gdk/mir/gdkmirkeyboard.c b/gdk/mir/gdkmirkeyboard.c
index 01a1411..4eecca6 100644
--- a/gdk/mir/gdkmirkeyboard.c
+++ b/gdk/mir/gdkmirkeyboard.c
@@ -84,7 +84,6 @@ gdk_mir_keyboard_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_mir_keyboard_warp (GdkDevice *device,
-                       GdkScreen *screen,
                        gdouble    x,
                        gdouble    y)
 {
diff --git a/gdk/mir/gdkmirpointer.c b/gdk/mir/gdkmirpointer.c
index 08afee8..97edebc 100644
--- a/gdk/mir/gdkmirpointer.c
+++ b/gdk/mir/gdkmirpointer.c
@@ -123,7 +123,6 @@ gdk_mir_pointer_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_mir_pointer_warp (GdkDevice *device,
-                      GdkScreen *screen,
                       gdouble    x,
                       gdouble    y)
 {
diff --git a/gdk/quartz/gdkdevice-core-quartz.c b/gdk/quartz/gdkdevice-core-quartz.c
index 76f1152..a6f9582 100644
--- a/gdk/quartz/gdkdevice-core-quartz.c
+++ b/gdk/quartz/gdkdevice-core-quartz.c
@@ -51,7 +51,6 @@ static void gdk_quartz_device_core_set_window_cursor (GdkDevice *device,
                                                       GdkWindow *window,
                                                       GdkCursor *cursor);
 static void gdk_quartz_device_core_warp (GdkDevice *device,
-                                         GdkScreen *screen,
                                          gdouble    x,
                                          gdouble    y);
 static void gdk_quartz_device_core_query_state (GdkDevice        *device,
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 1a2ddcf..f31e07d 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -525,7 +525,6 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_wayland_device_warp (GdkDevice *device,
-                         GdkScreen *screen,
                          gdouble    x,
                          gdouble    y)
 {
diff --git a/gdk/win32/gdkdevice-virtual.c b/gdk/win32/gdkdevice-virtual.c
index 36c533b..6b8079b 100644
--- a/gdk/win32/gdkdevice-virtual.c
+++ b/gdk/win32/gdkdevice-virtual.c
@@ -123,7 +123,6 @@ gdk_device_virtual_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_device_virtual_warp (GdkDevice *device,
-                        GdkScreen *screen,
                         gdouble   x,
                         gdouble   y)
 {
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index fa74db6..711a0b7 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -65,7 +65,6 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_device_win32_warp (GdkDevice *device,
-                       GdkScreen *screen,
                        gdouble    x,
                        gdouble    y)
 {
diff --git a/gdk/win32/gdkdevice-wintab.c b/gdk/win32/gdkdevice-wintab.c
index 6e11036..884977b 100644
--- a/gdk/win32/gdkdevice-wintab.c
+++ b/gdk/win32/gdkdevice-wintab.c
@@ -100,7 +100,6 @@ gdk_device_wintab_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_device_wintab_warp (GdkDevice *device,
-                        GdkScreen *screen,
                         gdouble   x,
                         gdouble   y)
 {
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 07e5255..2d54ef9 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -2223,16 +2223,14 @@ gdk_window_win32_get_device_state (GdkWindow       *window,
 void
 gdk_display_warp_device (GdkDisplay *display,
                          GdkDevice  *device,
-                         GdkScreen  *screen,
                          gint        x,
                          gint        y)
 {
   g_return_if_fail (display == gdk_display_get_default ());
-  g_return_if_fail (screen == gdk_display_get_default_screen (display));
   g_return_if_fail (GDK_IS_DEVICE (device));
   g_return_if_fail (display == gdk_device_get_display (device));
 
-  GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
+  GDK_DEVICE_GET_CLASS (device)->warp (device, x, y);
 }
 
 static GdkEventMask
@@ -4471,8 +4469,7 @@ setup_drag_move_resize_context (GdkWindow                   *window,
            * the titlebar is, if any.
            */
           root_y = wy + wheight / 2;
-          gdk_device_warp (device, screen,
-                           root_x, root_y);
+          gdk_device_warp (device, root_x, root_y);
         }
     }
 
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index 418546c..09d3150 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -55,7 +55,6 @@ static void     gdk_x11_device_core_set_window_cursor (GdkDevice *device,
                                                        GdkWindow *window,
                                                        GdkCursor *cursor);
 static void     gdk_x11_device_core_warp (GdkDevice *device,
-                                          GdkScreen *screen,
                                           gdouble    x,
                                           gdouble    y);
 static void gdk_x11_device_core_query_state (GdkDevice        *device,
@@ -231,14 +230,15 @@ gdk_x11_device_core_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_x11_device_core_warp (GdkDevice *device,
-                          GdkScreen *screen,
                           gdouble    x,
                           gdouble    y)
 {
   Display *xdisplay;
   Window dest;
+  GdkScreen *screen;
 
   xdisplay = GDK_DISPLAY_XDISPLAY (gdk_device_get_display (device));
+  screen = gdk_display_get_default_screen (gdk_device_get_display (device));
   dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
 
   XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 328d000..82eed04 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -80,7 +80,6 @@ static void gdk_x11_device_xi2_set_window_cursor (GdkDevice *device,
                                                   GdkWindow *window,
                                                   GdkCursor *cursor);
 static void gdk_x11_device_xi2_warp (GdkDevice *device,
-                                     GdkScreen *screen,
                                      gdouble    x,
                                      gdouble    y);
 static void gdk_x11_device_xi2_query_state (GdkDevice        *device,
@@ -300,12 +299,12 @@ gdk_x11_device_xi2_set_window_cursor (GdkDevice *device,
 
 static void
 gdk_x11_device_xi2_warp (GdkDevice *device,
-                         GdkScreen *screen,
                          gdouble    x,
                          gdouble    y)
 {
   GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
   Window dest;
+  GdkScreen *screen = gdk_screen_get_default ();
 
   dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
 
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 7a9a69e..1236beb 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -3037,9 +3037,7 @@ gdk_dnd_handle_key_event (GdkDragContext    *context,
     {
       x11_context->last_x += dx;
       x11_context->last_y += dy;
-      gdk_device_warp (pointer,
-                       gdk_window_get_screen (x11_context->ipc_window),
-                       x11_context->last_x, x11_context->last_y);
+      gdk_device_warp (pointer, x11_context->last_x, x11_context->last_y);
     }
 
   gdk_drag_update (context, x11_context->last_x, x11_context->last_y, state,
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 4986bea..0b10b8c 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -1311,7 +1311,7 @@ gtk_drag_begin_internal (GtkWidget          *widget,
       start_y = (int)y;
     }
   else
-    gdk_device_get_position (pointer, NULL, &start_x, &start_y);
+    gdk_device_get_position (pointer, &start_x, &start_y);
 
   context = gdk_drag_begin_from_point (ipc_window, pointer, targets, start_x, start_y);
 
@@ -1347,10 +1347,7 @@ gtk_drag_begin_internal (GtkWidget          *widget,
   info->icon_widget = NULL;
   info->destroy_icon = FALSE;
 
-  if (event)
-    info->cur_screen = gdk_display_get_default_screen (gdk_event_get_display (event));
-  else
-    gdk_device_get_position (pointer, &info->cur_screen, NULL, NULL);
+  info->cur_screen = gdk_display_get_default_screen (gdk_event_get_display (event));
 
   info->start_x = start_x;
   info->start_y = start_y;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index e03bb77..51544ab 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -3799,7 +3799,7 @@ gtk_menu_position_legacy (GtkMenu  *menu,
 
   display = gtk_widget_get_display (widget);
   pointer = _gtk_menu_shell_get_grab_device (GTK_MENU_SHELL (menu));
-  gdk_device_get_position (pointer, NULL, &x, &y);
+  gdk_device_get_position (pointer, &x, &y);
 
   /* Realize so we have the proper width and height to figure out
    * the right place to popup the menu.
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 91671ad..3d7af77 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2974,8 +2974,7 @@ gtk_notebook_drag_end (GtkWidget      *widget,
       GtkNotebook *dest_notebook = NULL;
       gint x, y;
 
-      gdk_device_get_position (gdk_drag_context_get_device (context),
-                               NULL, &x, &y);
+      gdk_device_get_position (gdk_drag_context_get_device (context), &x, &y);
       g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
                      priv->detached_tab->child, x, y, &dest_notebook);
 
@@ -3024,8 +3023,7 @@ gtk_notebook_drag_failed (GtkWidget      *widget,
       GtkNotebook *dest_notebook = NULL;
       gint x, y;
 
-      gdk_device_get_position (gdk_drag_context_get_device (context),
-                               NULL, &x, &y);
+      gdk_device_get_position (gdk_drag_context_get_device (context), &x, &y);
 
       g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
                      priv->detached_tab->child, x, y, &dest_notebook);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 035bae5..9fd3158 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10518,7 +10518,6 @@ synth_crossing (GtkWidget       *widget,
   event->crossing.subwindow = g_object_ref (window);
   event->crossing.time = GDK_CURRENT_TIME;
   gdk_device_get_position_double (device,
-                                  NULL,
                                   &event->crossing.x_root,
                                   &event->crossing.y_root);
   gdk_window_get_device_position_double (window,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 804c178..c06b59d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -8375,7 +8375,7 @@ get_monitor_containing_pointer (GtkWindow *window)
   GdkDevice *pointer;
 
   pointer = gdk_seat_get_pointer (gdk_display_get_default_seat (priv->display));
-  gdk_device_get_position (pointer, NULL, &px, &py);
+  gdk_device_get_position (pointer, &px, &py);
 
   return gdk_display_get_monitor_at_point (priv->display, px, py);
 }
@@ -8542,7 +8542,7 @@ gtk_window_compute_configure_request (GtkWindow    *window,
 
             pointer = gdk_seat_get_pointer (gdk_display_get_default_seat (priv->display));
 
-            gdk_device_get_position (pointer, NULL, &px, &py);
+            gdk_device_get_position (pointer, &px, &py);
             monitor = gdk_display_get_monitor_at_point (priv->display, px, py);
 
             x = px - w / 2;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]