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,
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_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)
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)
{
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);
}
}
*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);
}
/**