[gtk+] gdk: Simplify code



commit 22676022954a80759f36624a9226cae1eb662e4b
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 3 17:01:36 2011 +0100

    gdk: Simplify code
    
    Fold the previous vfunc into the only caller.

 gdk/gdkwindow.c |   54 ++++++++++++------------------------------------------
 1 files changed, 12 insertions(+), 42 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index b818cfc..30d5c8d 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4938,38 +4938,6 @@ gdk_window_get_pointer (GdkWindow	  *window,
   return gdk_window_get_device_position (window, display->core_pointer, x, y, mask);
 }
 
-static GdkWindow *
-gdk_window_real_window_get_device_position (GdkDisplay       *display,
-                                            GdkDevice        *device,
-                                            GdkWindow        *window,
-                                            gint             *x,
-                                            gint             *y,
-                                            GdkModifierType  *mask)
-{
-  gint tmpx, tmpy;
-  GdkModifierType tmp_mask;
-  gboolean normal_child;
-
-  normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
-                                                                              device,
-                                                                              &tmpx, &tmpy,
-                                                                              &tmp_mask);
-  /* We got the coords on the impl, convert to the window */
-  tmpx -= window->abs_x;
-  tmpy -= window->abs_y;
-
-  if (x)
-    *x = tmpx;
-  if (y)
-    *y = tmpy;
-  if (mask)
-    *mask = tmp_mask;
-
-  if (normal_child)
-    return _gdk_window_find_child_at (window, tmpx, tmpy);
-  return NULL;
-}
-
 /**
  * gdk_window_get_device_position:
  * @window: a #GdkWindow.
@@ -4994,21 +4962,21 @@ gdk_window_get_device_position (GdkWindow       *window,
                                 gint            *y,
                                 GdkModifierType *mask)
 {
-  GdkDisplay *display;
   gint tmp_x, tmp_y;
   GdkModifierType tmp_mask;
-  GdkWindow *child;
+  gboolean normal_child;
 
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
   g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
   g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
 
-  tmp_x = 0;
-  tmp_y = 0;
-
-  display = gdk_window_get_display (window);
-  child = gdk_window_real_window_get_device_position (display, device, window,
-                                                      &tmp_x, &tmp_y, &tmp_mask);
+  normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
+                                                                             device,
+                                                                             &tmp_x, &tmp_y,
+                                                                             &tmp_mask);
+  /* We got the coords on the impl, convert to the window */
+  tmp_x -= window->abs_x;
+  tmp_y -= window->abs_y;
 
   if (x)
     *x = tmp_x;
@@ -5017,9 +4985,11 @@ gdk_window_get_device_position (GdkWindow       *window,
   if (mask)
     *mask = tmp_mask;
 
-  _gdk_display_enable_motion_hints (display, device);
+  _gdk_display_enable_motion_hints (gdk_window_get_display (window), device);
 
-  return child;
+  if (normal_child)
+    return _gdk_window_find_child_at (window, tmp_x, tmp_y);
+  return NULL;
 }
 
 /**



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