* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
+#include <config.h>
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdk.h" /* For gdk_rectangle_union() */
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,
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,
static void gdk_window_init (GdkWindowObject *window);
static void gdk_window_class_init (GdkWindowObjectClass *klass);
static void gdk_window_finalize (GObject *object);
+static void gdk_window_clear_backing_rect (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
static gpointer parent_class = NULL;
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;
}
_gdk_windowing_window_destroy (window, recursing, foreign_destroy);
+ private->parent = NULL;
private->destroyed = TRUE;
if (private->filters)
* 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)
/**
* 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
* 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)
gdk_window_is_viewable (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
- GdkScreen *screen = gdk_drawable_get_screen (window);
- GdkWindow *root_window = gdk_screen_get_root_window (screen);
+ GdkScreen *screen;
+ GdkWindow *root_window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
+
+ screen = gdk_drawable_get_screen (window);
+ root_window = gdk_screen_get_root_window (screen);
while (private &&
(private != (GdkWindowObject *)root_window) &&
(GDK_WINDOW_TYPE (private) != GDK_WINDOW_FOREIGN))
{
- if (!GDK_WINDOW_IS_MAPPED (window))
+ if (GDK_WINDOW_DESTROYED (window) || !GDK_WINDOW_IS_MAPPED (window))
return FALSE;
private = (GdkWindowObject *)private->parent;
gdk_region_destroy (region);
}
-static GdkGC *
-gdk_window_get_bg_gc (GdkWindow *window, GdkWindowPaint *paint)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- guint gc_mask = 0;
- GdkGCValues gc_values;
-
- if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
- {
- GdkWindowPaint tmp_paint = *paint;
- tmp_paint.x_offset += private->x;
- tmp_paint.y_offset += private->y;
-
- return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
- }
- else if (private->bg_pixmap &&
- private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
- private->bg_pixmap != GDK_NO_BG)
- {
- gc_values.fill = GDK_TILED;
- gc_values.tile = private->bg_pixmap;
- gc_values.ts_x_origin = - paint->x_offset;
- gc_values.ts_y_origin = - paint->y_offset;
-
- gc_mask = (GDK_GC_FILL | GDK_GC_TILE |
- GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN);
- }
- else
- {
- gc_values.foreground = private->bg_color;
- gc_mask = GDK_GC_FOREGROUND;
- }
-
- return gdk_gc_new_with_values (paint->pixmap, &gc_values, gc_mask);
-}
-
-static void
-gdk_window_paint_init_bg (GdkWindow *window,
- GdkWindowPaint *paint,
- GdkRegion *init_region)
-{
- GdkGC *tmp_gc;
-
- tmp_gc = gdk_window_get_bg_gc (window, paint);
-
- gdk_region_offset (init_region,
- - paint->x_offset,
- - paint->y_offset);
- gdk_gc_set_clip_region (tmp_gc, init_region);
-
- gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE, 0, 0, -1, -1);
- g_object_unref (tmp_gc);
-}
-
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
#endif
GdkWindowObject *private = (GdkWindowObject *)window;
GdkRectangle clip_box;
GdkWindowPaint *paint;
- GdkRegion *init_region;
- GdkGC *tmp_gc;
+ GSList *list;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
-
- paint = g_new (GdkWindowPaint, 1);
- paint->region = gdk_region_copy (region);
+ gdk_region_get_clipbox (region, &clip_box);
- init_region = gdk_region_copy (region);
- gdk_region_get_clipbox (paint->region, &clip_box);
+ paint = g_new (GdkWindowPaint, 1);
+ paint->region = gdk_region_copy (region);
+ paint->x_offset = clip_box.x;
+ paint->y_offset = clip_box.y;
+ paint->pixmap =
+ gdk_pixmap_new (window,
+ MAX (clip_box.width, 1), MAX (clip_box.height, 1), -1);
- if (private->paint_stack)
+ for (list = private->paint_stack; list != NULL; list = list->next)
{
- gint old_width, old_height;
- GdkWindowPaint *tmp_paint = private->paint_stack->data;
- GdkRectangle old_rect, new_rect;
- GSList *tmp_list;
-
- gdk_drawable_get_size (tmp_paint->pixmap, &old_width, &old_height);
- old_rect.x = tmp_paint->x_offset;
- old_rect.y = tmp_paint->y_offset;
- old_rect.width = old_width;
- old_rect.height = old_height;
-
- gdk_rectangle_union (&clip_box, &old_rect, &new_rect);
-
- if (new_rect.width > old_rect.width || new_rect.height > old_rect.height)
- {
- paint->pixmap = gdk_pixmap_new (window,
- new_rect.width, new_rect.height, -1);
- tmp_gc = gdk_gc_new (paint->pixmap);
- gdk_draw_drawable (paint->pixmap, tmp_gc, tmp_paint->pixmap,
- 0, 0,
- old_rect.x - new_rect.x, old_rect.y - new_rect.y,
- old_rect.width, old_rect.height);
- g_object_unref (tmp_gc);
- g_object_unref (tmp_paint->pixmap);
-
- paint->x_offset = new_rect.x;
- paint->y_offset = new_rect.y;
-
- tmp_list = private->paint_stack;
- while (tmp_list)
- {
- tmp_paint = tmp_list->data;
- gdk_region_subtract (init_region, tmp_paint->region);
-
- tmp_paint->pixmap = paint->pixmap;
- tmp_paint->x_offset = paint->x_offset;
- tmp_paint->y_offset = paint->y_offset;
-
- tmp_list = tmp_list->next;
- }
- }
- else
- {
- paint->x_offset = tmp_paint->x_offset;
- paint->y_offset = tmp_paint->y_offset;
- paint->pixmap = tmp_paint->pixmap;
+ GdkWindowPaint *tmp_paint = list->data;
- tmp_list = private->paint_stack;
- while (tmp_list)
- {
- tmp_paint = tmp_list->data;
- gdk_region_subtract (init_region, tmp_paint->region);
-
- tmp_list = tmp_list->next;
- }
- }
- }
- else
- {
- paint->x_offset = clip_box.x;
- paint->y_offset = clip_box.y;
- paint->pixmap = gdk_pixmap_new (window,
- clip_box.width, clip_box.height, -1);
+ gdk_region_subtract (tmp_paint->region, paint->region);
}
-
- if (!gdk_region_empty (init_region))
- gdk_window_paint_init_bg (window, paint, init_region);
-
- gdk_region_destroy (init_region);
private->paint_stack = g_slist_prepend (private->paint_stack, paint);
+
+ if (!gdk_region_empty (region))
+ {
+ gdk_window_clear_backing_rect (window,
+ clip_box.x, clip_box.y,
+ clip_box.width, clip_box.height);
+ }
#endif /* USE_BACKING_STORE */
}
gdk_region_get_clipbox (paint->region, &clip_box);
- tmp_gc = gdk_gc_new (window);
+ tmp_gc = _gdk_drawable_get_scratch_gc (window, FALSE);
_gdk_windowing_window_get_offsets (window, &x_offset, &y_offset);
gdk_gc_set_clip_region (tmp_gc, paint->region);
- gdk_gc_set_clip_origin (tmp_gc, -x_offset, -y_offset);
+ gdk_gc_set_clip_origin (tmp_gc, - x_offset, - y_offset);
gdk_draw_drawable (private->impl, tmp_gc, paint->pixmap,
clip_box.x - paint->x_offset,
clip_box.y - paint->y_offset,
clip_box.x - x_offset, clip_box.y - y_offset,
clip_box.width, clip_box.height);
- g_object_unref (tmp_gc);
-
- if (private->paint_stack)
- {
- GSList *tmp_list = private->paint_stack;
- while (tmp_list)
- {
- GdkWindowPaint *tmp_paint = tmp_list->data;
- gdk_region_subtract (tmp_paint->region, paint->region);
-
- tmp_list = tmp_list->next;
- }
- }
- else
- g_object_unref (paint->pixmap);
+ /* Reset clip region of the cached GdkGC */
+ gdk_gc_set_clip_region (tmp_gc, NULL);
+
+ g_object_unref (paint->pixmap);
gdk_region_destroy (paint->region);
g_free (paint);
#endif /* USE_BACKING_STORE */
static void
gdk_window_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
- gint filled,
+ gboolean filled,
gint x,
gint y,
gint width,
static void
gdk_window_draw_arc (GdkDrawable *drawable,
GdkGC *gc,
- gint filled,
+ gboolean filled,
gint x,
gint y,
gint width,
static void
gdk_window_draw_polygon (GdkDrawable *drawable,
GdkGC *gc,
- gint filled,
+ gboolean filled,
GdkPoint *points,
gint npoints)
{
}
static GdkDrawable*
-gdk_window_get_composite_drawable (GdkDrawable *window,
+gdk_window_get_composite_drawable (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint *composite_x_offset,
gint *composite_y_offset)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowPaint *paint;
- GdkRegion *buffered_region;
- GSList *tmp_list;
- GdkPixmap *buffer;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
+ GSList *list;
GdkPixmap *tmp_pixmap;
GdkRectangle rect;
- GdkRegion *rect_region;
GdkGC *tmp_gc;
- gint windowing_x_offset, windowing_y_offset;
- gint buffer_x_offset, buffer_y_offset;
+ gboolean overlap_buffer;
- if (GDK_WINDOW_DESTROYED (window) || private->paint_stack == NULL)
- {
- /* No backing store */
- _gdk_windowing_window_get_offsets (window,
- composite_x_offset,
- composite_y_offset);
-
- return g_object_ref (window);
- }
+ _gdk_windowing_window_get_offsets (drawable,
+ composite_x_offset,
+ composite_y_offset);
- buffered_region = NULL;
- buffer = NULL;
-
- /* All GtkWindowPaint structs have the same pixmap and offsets, just
- * get the first one. (should probably be cleaned up so that the
- * pixmap is stored in the window)
- */
- paint = private->paint_stack->data;
- buffer = paint->pixmap;
- buffer_x_offset = paint->x_offset;
- buffer_y_offset = paint->y_offset;
-
- tmp_list = private->paint_stack;
- while (tmp_list != NULL)
+ if ((GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable))
+ || private->paint_stack == NULL)
{
- paint = tmp_list->data;
-
- if (buffered_region == NULL)
- buffered_region = gdk_region_copy (paint->region);
- else
- gdk_region_union (buffered_region, paint->region);
-
- tmp_list = g_slist_next (tmp_list);
+ /* No backing store */
+ return g_object_ref (drawable);
}
/* See if the buffered part is overlapping the part we want
rect.width = width;
rect.height = height;
- rect_region = gdk_region_rectangle (&rect);
+ overlap_buffer = FALSE;
- gdk_region_intersect (buffered_region, rect_region);
-
- gdk_region_destroy (rect_region);
-
- if (gdk_region_empty (buffered_region))
+ for (list = private->paint_stack; list != NULL; list = list->next)
{
- gdk_region_destroy (buffered_region);
+ GdkWindowPaint *paint = list->data;
+ GdkOverlapType overlap;
- _gdk_windowing_window_get_offsets (window,
- composite_x_offset,
- composite_y_offset);
+ overlap = gdk_region_rect_in (paint->region, &rect);
- return g_object_ref (window);
+ if (overlap == GDK_OVERLAP_RECTANGLE_IN)
+ {
+ *composite_x_offset = paint->x_offset;
+ *composite_y_offset = paint->y_offset;
+
+ return g_object_ref (paint->pixmap);
+ }
+ else if (overlap == GDK_OVERLAP_RECTANGLE_PART)
+ {
+ overlap_buffer = TRUE;
+ break;
+ }
}
-
- tmp_pixmap = gdk_pixmap_new (window,
- width, height,
- -1);
- tmp_gc = gdk_gc_new (tmp_pixmap);
+ if (!overlap_buffer)
+ return g_object_ref (drawable);
+
+ tmp_pixmap = gdk_pixmap_new (drawable, width, height, -1);
+ tmp_gc = _gdk_drawable_get_scratch_gc (tmp_pixmap, FALSE);
- _gdk_windowing_window_get_offsets (window,
- &windowing_x_offset,
- &windowing_y_offset);
-
/* Copy the current window contents */
gdk_draw_drawable (tmp_pixmap,
tmp_gc,
private->impl,
- x - windowing_x_offset,
- y - windowing_y_offset,
+ x - *composite_x_offset,
+ y - *composite_y_offset,
0, 0,
width, height);
- /* Make buffered_region relative to the tmp_pixmap */
- gdk_region_offset (buffered_region,
- - x,
- - y);
-
- /* Set the clip mask to avoid drawing over non-buffered areas of
- * tmp_pixmap.
- */
-
- gdk_gc_set_clip_region (tmp_gc, buffered_region);
- gdk_region_destroy (buffered_region);
-
- /* Draw backing pixmap onto the tmp_pixmap, offsetting
- * appropriately.
- */
- gdk_draw_drawable (tmp_pixmap,
- tmp_gc,
- buffer,
- x - buffer_x_offset,
- y - buffer_y_offset,
- 0, 0,
- width, height);
-
+ /* paint the backing stores */
+ for (list = private->paint_stack; list != NULL; list = list->next)
+ {
+ GdkWindowPaint *paint = list->data;
+
+ gdk_gc_set_clip_region (tmp_gc, paint->region);
+ gdk_gc_set_clip_origin (tmp_gc, -x, -y);
+
+ gdk_draw_drawable (tmp_pixmap, tmp_gc, paint->pixmap,
+ x - paint->x_offset,
+ y - paint->y_offset,
+ 0, 0, width, height);
+ }
+
+ /* Reset clip region of the cached GdkGC */
+ gdk_gc_set_clip_region (tmp_gc, NULL);
+
/* Set these to location of tmp_pixmap within the window */
*composite_x_offset = x;
*composite_y_offset = y;
- g_object_unref (tmp_gc);
-
return tmp_pixmap;
}
RESTORE_GC (gc);
}
-/* Fixme - this is just like gdk_window_paint_init_bg */
+static GdkGC *
+gdk_window_get_bg_gc (GdkWindow *window,
+ GdkWindowPaint *paint)
+{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+
+ guint gc_mask = 0;
+ GdkGCValues gc_values;
+
+ if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
+ {
+ GdkWindowPaint tmp_paint = *paint;
+ tmp_paint.x_offset += private->x;
+ tmp_paint.y_offset += private->y;
+
+ return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
+ }
+ else if (private->bg_pixmap &&
+ private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
+ private->bg_pixmap != GDK_NO_BG)
+ {
+ gc_values.fill = GDK_TILED;
+ gc_values.tile = private->bg_pixmap;
+
+ gc_mask = GDK_GC_FILL | GDK_GC_TILE;
+
+ return gdk_gc_new_with_values (paint->pixmap, &gc_values, gc_mask);
+ }
+ else
+ {
+ GdkGC *gc = _gdk_drawable_get_scratch_gc (paint->pixmap, FALSE);
+
+ gdk_gc_set_foreground (gc, &(private->bg_color));
+
+ return g_object_ref (gc);
+ }
+}
+
static void
gdk_window_clear_backing_rect (GdkWindow *window,
gint x,
if (GDK_WINDOW_DESTROYED (window))
return;
-
+
tmp_gc = gdk_window_get_bg_gc (window, paint);
- gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE,
- x - paint->x_offset, y - paint->y_offset, width, height);
+ gdk_gc_set_clip_region (tmp_gc, paint->region);
+
+ gdk_draw_rectangle (window, tmp_gc, TRUE,
+ x, y, width, height);
+
+ gdk_gc_set_clip_region (tmp_gc, NULL);
+
g_object_unref (tmp_gc);
}
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);
}
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);
}
}
_gdk_windowing_window_get_offsets (drawable, &x_offset, &y_offset);
- return _gdk_drawable_copy_to_image (((GdkWindowObject*)drawable)->impl,
- image,
- src_x - x_offset,
- src_y - y_offset,
- dest_x, dest_y,
- width, height);
+ return gdk_drawable_copy_to_image (((GdkWindowObject*)drawable)->impl,
+ image,
+ src_x - x_offset,
+ src_y - y_offset,
+ dest_x, dest_y,
+ width, height);
}
/* Code for dirty-region queueing
}
}
+static void
+flush_all_displays (void)
+{
+ GSList *displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ GSList *tmp_list;
+
+ for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
+ gdk_display_flush (tmp_list->data);
+
+ g_slist_free (displays);
+}
+
/**
* gdk_window_process_all_updates:
*
g_slist_free (old_update_windows);
- gdk_flush();
+ flush_all_displays ();
}
static gboolean
/* This copy could be saved with a little more complexity */
child_region = gdk_region_copy (visible_region);
- gdk_region_offset (child_region, -x, -y);
+ gdk_region_offset (child_region, - x, - y);
gdk_window_invalidate_maybe_recurse ((GdkWindow *)child, child_region, child_func, user_data);
if (geometry->min_aspect * height > width)
{
- delta = FLOOR (height - width * geometry->min_aspect, yinc);
+ delta = FLOOR (height - width / geometry->min_aspect, yinc);
if (height - delta >= min_height)
height -= delta;
else
*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
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;
}
/**
*
* 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
**/
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);
}
/**