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, TRUE);
}
- g_object_unref (G_OBJECT (obj->impl));
+ g_object_unref (obj->impl);
obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG)
{
- gdk_pixmap_unref (private->bg_pixmap);
+ g_object_unref (private->bg_pixmap);
private->bg_pixmap = NULL;
}
* 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_window_destroy_hierarchy (window, FALSE, FALSE);
- gdk_drawable_unref (window);
+ g_object_unref (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_gc_set_clip_region (tmp_gc, init_region);
gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE, 0, 0, -1, -1);
- gdk_gc_unref (tmp_gc);
+ g_object_unref (tmp_gc);
}
#ifdef GDK_WINDOWING_X11
0, 0,
old_rect.x - new_rect.x, old_rect.y - new_rect.y,
old_rect.width, old_rect.height);
- gdk_gc_unref (tmp_gc);
- gdk_drawable_unref (tmp_paint->pixmap);
+ g_object_unref (tmp_gc);
+ g_object_unref (tmp_paint->pixmap);
paint->x_offset = new_rect.x;
paint->y_offset = new_rect.y;
clip_box.y - paint->y_offset,
clip_box.x - x_offset, clip_box.y - y_offset,
clip_box.width, clip_box.height);
- gdk_gc_unref (tmp_gc);
+ g_object_unref (tmp_gc);
if (private->paint_stack)
{
}
}
else
- gdk_drawable_unref (paint->pixmap);
+ g_object_unref (paint->pixmap);
gdk_region_destroy (paint->region);
g_free (paint);
GdkWindowPaint *paint = tmp_list->data;
if (tmp_list == private->paint_stack)
- gdk_drawable_unref (paint->pixmap);
+ g_object_unref (paint->pixmap);
gdk_region_destroy (paint->region);
g_free (paint);
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)
{
composite_x_offset,
composite_y_offset);
- return GDK_DRAWABLE (g_object_ref (G_OBJECT (window)));
+ return g_object_ref (window);
}
buffered_region = NULL;
composite_x_offset,
composite_y_offset);
- return GDK_DRAWABLE (g_object_ref (G_OBJECT (window)));
+ return g_object_ref (window);
}
tmp_pixmap = gdk_pixmap_new (window,
*composite_x_offset = x;
*composite_y_offset = y;
- g_object_unref (G_OBJECT (tmp_gc));
+ g_object_unref (tmp_gc);
return tmp_pixmap;
}
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_unref (tmp_gc);
+ 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);
}
}
save_region = _gdk_windowing_window_queue_antiexpose (window, update_area);
event.expose.type = GDK_EXPOSE;
- event.expose.window = gdk_window_ref (window);
+ event.expose.window = g_object_ref (window);
event.expose.count = 0;
if (save_region)
if (expose_region != update_area)
gdk_region_destroy (expose_region);
- gdk_window_unref (window);
+ g_object_unref (window);
}
if (!save_region)
gdk_region_destroy (update_area);
gdk_region_get_clipbox (region, &clipbox);
gdk_draw_rectangle (window,
- ugly_gc,
- TRUE,
- clipbox.x, clipbox.y,
- clipbox.width, clipbox.height);
+ ugly_gc,
+ TRUE,
+ clipbox.x, clipbox.y,
+ clipbox.width, clipbox.height);
- g_object_unref (G_OBJECT (ugly_gc));
+ g_object_unref (ugly_gc);
}
/**
*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);
}
/**