]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdkwindow.c
Skip insensitive widgets. (#84061)
[~andy/gtk] / gdk / gdkwindow.c
index 5ed1ac06586078db0f087a4b1c5172f084a47755..4687626121123fd8cdb6f95eb115baf700d8a8ed 100644 (file)
@@ -44,26 +44,19 @@ struct _GdkWindowPaint
   gint y_offset;
 };
 
-static const GdkPointerHooks default_pointer_hooks = {
-  _gdk_windowing_window_get_pointer,
-  _gdk_windowing_window_at_pointer
-};
-
-const GdkPointerHooks *_gdk_current_pointer_hooks = &default_pointer_hooks;
-
 static GdkGC *gdk_window_create_gc      (GdkDrawable     *drawable,
                                          GdkGCValues     *values,
                                          GdkGCValuesMask  mask);
 static void   gdk_window_draw_rectangle (GdkDrawable     *drawable,
                                          GdkGC           *gc,
-                                         gint             filled,
+                                         gboolean         filled,
                                          gint             x,
                                          gint             y,
                                          gint             width,
                                          gint             height);
 static void   gdk_window_draw_arc       (GdkDrawable     *drawable,
                                          GdkGC           *gc,
-                                         gint             filled,
+                                         gboolean         filled,
                                          gint             x,
                                          gint             y,
                                          gint             width,
@@ -72,7 +65,7 @@ static void   gdk_window_draw_arc       (GdkDrawable     *drawable,
                                          gint             angle2);
 static void   gdk_window_draw_polygon   (GdkDrawable     *drawable,
                                          GdkGC           *gc,
-                                         gint             filled,
+                                         gboolean         filled,
                                          GdkPoint        *points,
                                          gint             npoints);
 static void   gdk_window_draw_text      (GdkDrawable     *drawable,
@@ -240,7 +233,7 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
   drawable_class->draw_lines = gdk_window_draw_lines;
   drawable_class->draw_glyphs = gdk_window_draw_glyphs;
   drawable_class->draw_image = gdk_window_draw_image;
-  drawable_class->_draw_pixbuf = gdk_window_draw_pixbuf;
+  drawable_class->draw_pixbuf = gdk_window_draw_pixbuf;
   drawable_class->get_depth = gdk_window_real_get_depth;
   drawable_class->get_screen = gdk_window_real_get_screen;
   drawable_class->get_size = gdk_window_real_get_size;
@@ -409,14 +402,13 @@ _gdk_window_destroy (GdkWindow *window,
  * gdk_window_destroy:
  * @window: a #GdkWindow
  *
- * Destroys @window (destroys the server-side resource associated with
- * @window).  Memory allocated for @window may not be freed until all
- * references to @window are dropped. All children of @window are also
- * destroyed.
+ * Destroys the window system resources associated with @window and decrements @window's
+ * reference count. The window system resources for all children of @window are also
+ * destroyed, but the children's reference counts are not decremented.
+ *
+ * Note that a window will not be destroyed automatically when its reference count
+ * reaches zero. You must call this function yourself before that happens.
  *
- * There's normally no need to use this function, window are automatically
- * destroyed when their reference count reaches 0.
- * 
  **/
 void
 gdk_window_destroy (GdkWindow *window)
@@ -702,7 +694,7 @@ gdk_window_remove_filter (GdkWindow     *window,
 
 /**
  * gdk_screen_get_toplevel_windows:
- * @screen : The #GdkScreen where the toplevels are located.
+ * @screen: The #GdkScreen where the toplevels are located.
  * 
  * Obtains a list of all toplevel windows known to GDK on the screen @screen.
  * A toplevel window is a child of the root window (see
@@ -712,6 +704,8 @@ gdk_window_remove_filter (GdkWindow     *window,
  * its elements need not be freed.
  * 
  * Return value: list of toplevel windows, free with g_list_free()
+ *
+ * Since: 2.2
  **/
 GList *
 gdk_screen_get_toplevel_windows (GdkScreen *screen)
@@ -1265,7 +1259,7 @@ gdk_window_create_gc (GdkDrawable     *drawable,
 static void
 gdk_window_draw_rectangle (GdkDrawable *drawable,
                           GdkGC       *gc,
-                          gint         filled,
+                          gboolean     filled,
                           gint         x,
                           gint         y,
                           gint         width,
@@ -1293,7 +1287,7 @@ gdk_window_draw_rectangle (GdkDrawable *drawable,
 static void
 gdk_window_draw_arc (GdkDrawable *drawable,
                     GdkGC       *gc,
-                    gint         filled,
+                    gboolean     filled,
                     gint         x,
                     gint         y,
                     gint         width,
@@ -1324,7 +1318,7 @@ gdk_window_draw_arc (GdkDrawable *drawable,
 static void
 gdk_window_draw_polygon (GdkDrawable *drawable,
                         GdkGC       *gc,
-                        gint         filled,
+                        gboolean     filled,
                         GdkPoint    *points,
                         gint         npoints)
 {
@@ -1945,16 +1939,16 @@ gdk_window_draw_pixbuf (GdkDrawable     *drawable,
       if (private->paint_stack)
        {
          GdkWindowPaint *paint = private->paint_stack->data;
-         _gdk_draw_pixbuf (paint->pixmap, gc, pixbuf, src_x, src_y,
-                           dest_x - x_offset, dest_y - y_offset,
-                           width, height,
-                           dither, x_dither - x_offset, y_dither - y_offset);
+         gdk_draw_pixbuf (paint->pixmap, gc, pixbuf, src_x, src_y,
+                          dest_x - x_offset, dest_y - y_offset,
+                          width, height,
+                          dither, x_dither - x_offset, y_dither - y_offset);
        }
       else
-       _gdk_draw_pixbuf (private->impl, gc, pixbuf, src_x, src_y,
-                         dest_x - x_offset, dest_y - y_offset,
-                         width, height,
-                         dither, x_dither, y_dither);
+       gdk_draw_pixbuf (private->impl, gc, pixbuf, src_x, src_y,
+                        dest_x - x_offset, dest_y - y_offset,
+                        width, height,
+                        dither, x_dither, y_dither);
       
       RESTORE_GC (gc);
     }
@@ -1966,16 +1960,16 @@ gdk_window_draw_pixbuf (GdkDrawable     *drawable,
       if (private->paint_stack)
        {
          GdkWindowPaint *paint = private->paint_stack->data;
-         _gdk_draw_pixbuf (paint->pixmap, gc, pixbuf, src_x, src_y,
-                           dest_x - x_offset, dest_y - y_offset,
-                           width, height,
+         gdk_draw_pixbuf (paint->pixmap, gc, pixbuf, src_x, src_y,
+                          dest_x - x_offset, dest_y - y_offset,
+                          width, height,
                            dither, x_dither - x_offset, y_dither - y_offset);
        }
       else
-       _gdk_draw_pixbuf (private->impl, gc, pixbuf, src_x, src_y,
-                         dest_x - x_offset, dest_y - y_offset,
-                         width, height,
-                         dither, x_dither, y_dither);
+       gdk_draw_pixbuf (private->impl, gc, pixbuf, src_x, src_y,
+                        dest_x - x_offset, dest_y - y_offset,
+                        width, height,
+                        dither, x_dither, y_dither);
     }
 }
 
@@ -2698,33 +2692,6 @@ gdk_window_constrain_size (GdkGeometry *geometry,
   *new_height = height;
 }
 
-/**
- * gdk_set_pointer_hooks:
- * @new_hooks: a table of pointers to functions for getting
- *   quantities related to the current pointer position,
- *   or %NULL to restore the default table.
- * 
- * This function allows for hooking into the operation
- * of getting the current location of the pointer. This
- * is only useful for such low-level tools as an
- * event recorder. Applications should never have any
- * reason to use this facility
- * 
- * Return value: the previous pointer hook table
- **/
-GdkPointerHooks *
-gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks)
-{
-  const GdkPointerHooks *result = _gdk_current_pointer_hooks;
-
-  if (new_hooks)
-    _gdk_current_pointer_hooks = new_hooks;
-  else
-    _gdk_current_pointer_hooks = &default_pointer_hooks;
-
-  return (GdkPointerHooks *)result;
-}
-
 /**
  * gdk_window_get_pointer:
  * @window: a #GdkWindow
@@ -2743,11 +2710,41 @@ GdkWindow*
 gdk_window_get_pointer (GdkWindow        *window,
                        gint              *x,
                        gint              *y,
-                       GdkModifierType *mask)
+                       GdkModifierType   *mask)
 {
-  g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
+  GdkDisplay *display;
+  gint tmp_x, tmp_y;
+  GdkModifierType tmp_mask;
+  GdkWindow *child;
   
-  return _gdk_current_pointer_hooks->get_pointer (window, x, y, mask); 
+  g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
+
+  if (window)
+    {
+      display = gdk_drawable_get_display (window);
+    }
+  else
+    {
+      GdkScreen *screen = gdk_screen_get_default ();
+
+      display = gdk_screen_get_display (screen);
+      window = gdk_screen_get_root_window (screen);
+      
+      GDK_NOTE (MULTIHEAD,
+               g_message ("Passing NULL for window to gdk_window_get_pointer()\n"
+                          "is not multihead safe"));
+    }
+
+  child = display->pointer_hooks->window_get_pointer (display, window, &tmp_x, &tmp_y, &tmp_mask);
+
+  if (x)
+    *x = tmp_x;
+  if (y)
+    *y = tmp_y;
+  if (mask)
+    *mask = tmp_mask;
+
+  return child;
 }
 
 /**
@@ -2757,11 +2754,12 @@ gdk_window_get_pointer (GdkWindow         *window,
  * 
  * Obtains the window underneath the mouse pointer, returning the
  * location of that window in @win_x, @win_y. Returns %NULL if the
- * window under the mouse pointer is not known to GDK (for example,
- * belongs to another application).
+ * window under the mouse pointer is not known to GDK (if the window
+ * belongs to another application and a #GdkWindow hasn't been created
+ * for it with gdk_window_foreign_new())
  *
  * NOTE: For multihead-aware widgets or applications use
- * gdk_screen_get_window_at_pointer() instead.
+ * gdk_display_get_window_at_pointer() instead.
  * 
  * Return value: window under the mouse pointer
  **/
@@ -2769,7 +2767,7 @@ GdkWindow*
 gdk_window_at_pointer (gint *win_x,
                       gint *win_y)
 {
-  return gdk_screen_get_window_at_pointer (gdk_screen_get_default (), win_x, win_y);
+  return gdk_display_get_window_at_pointer (gdk_display_get_default (), win_x, win_y);
 }
 
 /**