* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
* absolute position in the impl window. For child window with
* native windows the clip region is set on the native window
* as a window shape to make it clip against other non-native windows.
- */
+ */
#define USE_BACKING_STORE /* Appears to work on Win32, too, now. */
/* Global info */
static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask mask);
+ GdkGCValues *values,
+ GdkGCValuesMask mask);
static void gdk_window_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height);
+ GdkGC *gc,
+ gboolean filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
static void gdk_window_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
+ GdkGC *gc,
+ gboolean filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2);
static void gdk_window_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ gboolean filled,
+ GdkPoint *points,
+ gint npoints);
static void gdk_window_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length);
static void gdk_window_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length);
static void gdk_window_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
+ GdkGC *gc,
+ GdkPixmap *src,
GdkDrawable *original_src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
static void gdk_window_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
static void gdk_window_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs);
static void gdk_window_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
PangoGlyphString *glyphs);
static void gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
static void gdk_window_draw_pixbuf (GdkDrawable *drawable,
GdkGC *gc,
cairo_t *cr);
static void gdk_window_real_get_size (GdkDrawable *drawable,
- gint *width,
- gint *height);
+ gint *width,
+ gint *height);
static GdkVisual* gdk_window_real_get_visual (GdkDrawable *drawable);
static gint gdk_window_real_get_depth (GdkDrawable *drawable);
int dx, int dy);
static void gdk_window_invalidate_in_parent (GdkWindowObject *private);
static void move_native_children (GdkWindowObject *private);
-
+
static gpointer parent_class = NULL;
static const cairo_user_data_key_t gdk_window_cairo_key;
sizeof (GdkWindowObject),
(GInstanceInitFunc) gdk_window_init,
0);
-
+
return object_type;
}
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
-
+
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_finalize;
{
GdkWindow *window = GDK_WINDOW (object);
GdkWindowObject *obj = (GdkWindowObject *) object;
-
+
if (!GDK_WINDOW_DESTROYED (window))
{
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
g_object_unref (obj->impl_window);
obj->impl_window = NULL;
}
-
+
if (obj->shape)
gdk_region_destroy (obj->shape);
GdkRectangle r;
GList *l;
GdkRegion *shape;
-
+
for (l = private->children; l; l = l->next)
{
child = l->data;
if (child == until)
break;
-
+
if (!GDK_WINDOW_IS_MAPPED (child) || child->input_only || child->composited)
continue;
r.height = child->height;
child_region = gdk_region_rectangle (&r);
-
+
if (child->shape)
gdk_region_intersect (child_region, child->shape);
else if (private->window_type == GDK_WINDOW_FOREIGN)
}
}
}
-
+
gdk_region_subtract (region, child_region);
gdk_region_destroy (child_region);
if (private->parent != NULL && GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
{
gdk_region_intersect (new_clip, private->parent->clip_region);
-
+
/* Remove all overlapping children from parent */
remove_child_area (private->parent, private, FALSE, new_clip);
}
-
+
/* Convert from parent coords to window coords */
gdk_region_offset (new_clip, -private->x, -private->y);
if (private->clip_region == NULL ||
!gdk_region_equal (private->clip_region, new_clip))
clip_region_changed = TRUE;
-
+
if (private->clip_region)
gdk_region_destroy (private->clip_region);
private->clip_region = new_clip;
_gdk_windowing_set_cairo_surface_size (private->cairo_surface,
width, height);
- cairo_surface_set_device_offset (private->cairo_surface,
+ cairo_surface_set_device_offset (private->cairo_surface,
private->abs_x,
private->abs_y);
}
*
* Unless the window didn't change stacking order or size/pos, pass in TRUE
* for recalculate_siblings. (Mostly used internally for the recursion)
- *
+ *
* If a child window was removed (and you can't use that child for
* recompute_visible_regions), pass in TRUE for recalculate_children on the parent
*/
for (; l != NULL; l = l->prev)
{
w = l->data;
-
+
if (gdk_window_has_impl (w))
return w;
* the default root window for the default display.
* @attributes: attributes of the new window
* @attributes_mask: mask indicating which fields in @attributes are valid
- *
+ *
* Creates a new #GdkWindow using the attributes from
* @attributes. See #GdkWindowAttr and #GdkWindowAttributesType for
* more details. Note: to use this on displays other than the default
* display, @parent must be specified.
- *
+ *
* Return value: the new #GdkWindow
**/
GdkWindow*
gboolean native;
GdkEventMask event_mask;
GdkWindow *real_parent;
-
+
g_return_val_if_fail (attributes != NULL, NULL);
-
+
if (!parent)
{
GDK_NOTE (MULTIHEAD,
g_warning ("gdk_window_new(): no parent specified reverting to parent = default root window"));
-
+
screen = gdk_screen_get_default ();
parent = gdk_screen_get_root_window (screen);
}
screen = gdk_drawable_get_screen (parent);
g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
-
+
if (GDK_WINDOW_DESTROYED (parent))
return NULL;
x = attributes->x;
else
x = 0;
-
+
if (attributes_mask & GDK_WA_Y)
y = attributes->y;
else
y = 0;
-
+
private->x = x;
private->y = y;
private->width = (attributes->width > 1) ? (attributes->width) : (1);
private->height = (attributes->height > 1) ? (attributes->height) : (1);
#ifdef GDK_WINDOWING_X11
- /* Work around a bug where Xorg refuses to map toplevel InputOnly windows
+ /* Work around a bug where Xorg refuses to map toplevel InputOnly windows
* from an untrusted client: http://bugs.freedesktop.org/show_bug.cgi?id=6988
*/
if (attributes->wclass == GDK_INPUT_ONLY &&
attributes->wclass = GDK_INPUT_OUTPUT;
}
#endif
-
+
if (attributes->wclass == GDK_INPUT_ONLY)
{
/* Backwards compatiblity - we've always ignored
g_warning (G_STRLOC "cannot make windows of type %d", private->window_type);
return NULL;
}
-
+
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
else
{
private->input_only = FALSE;
private->depth = visual->depth;
-
+
private->bg_color.pixel = 0; // TODO: BlackPixel (xdisplay, screen_x11->screen_num);
private->bg_color.red = private->bg_color.green = private->bg_color.blue = 0;
{
GdkWindowObject *above;
GList listhead = {0};
-
+
event_mask = get_native_event_mask (private);
-
+
/* Create the impl */
_gdk_window_impl_new (window, real_parent, screen, visual, event_mask, attributes, attributes_mask);
private->impl_window = private;
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->restack_under ((GdkWindow *)above,
&listhead);
}
-
+
}
else
{
}
recompute_visible_regions (private, TRUE, FALSE);
-
+
if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
{
/* Inherit redirection from parent */
private->redirect = private->parent->redirect;
}
-
+
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
static gboolean
is_parent_of (GdkWindow *parent,
- GdkWindow *child)
+ GdkWindow *child)
{
GdkWindow *w;
if (old_impl_window != private)
g_object_unref (old_impl_window);
g_object_unref (old_impl);
-
+
for (l = private->children; l != NULL; l = l->next)
{
child = l->data;
*
* Reparents @window into the given @new_parent. The window being
* reparented will be unmapped as a side effect.
- *
+ *
**/
void
gdk_window_reparent (GdkWindow *window,
GdkWindowObject *old_parent;
gboolean show, was_toplevel, was_mapped;
gboolean do_reparent_to_impl;
-
+
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);
if (!new_parent)
new_parent = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (window));
-
+
private = (GdkWindowObject *) window;
new_parent_private = (GdkWindowObject *)new_parent;
/* Don't create loops in hierarchy */
if (is_parent_of (window, new_parent))
return;
-
+
if (private->cairo_surface)
{
/* This might be wrong in the new parent, e.g. for non-native surfaces.
cairo_surface_set_user_data (private->cairo_surface, &gdk_window_cairo_key,
NULL, NULL);
}
-
+
old_parent = private->parent;
/* Break up redirection if inherited */
if (old_parent)
old_parent->children = g_list_remove (old_parent->children, window);
-
+
private->parent = new_parent_private;
private->x = x;
private->y = y;
new_parent_private->children = g_list_prepend (new_parent_private->children, window);
-
+
/* Switch the window type as appropriate */
switch (GDK_WINDOW_TYPE (new_parent))
need to change the event mask too. */
if (gdk_window_has_impl (private))
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->set_events (window, get_native_event_mask (private));
-
+
/* Inherit parent redirect if we don't have our own */
if (private->parent && private->redirect == NULL)
{
{
GdkWindowObject *above;
GList listhead = {0};
-
+
/* The reparent will have put the native window topmost in the native parent,
* which may be wrong wrt other native windows in the non-native hierarchy,
* so restack */
if (obj->filters)
{
GList *tmp_list;
-
+
for (tmp_list = obj->filters; tmp_list; tmp_list = tmp_list->next)
g_free (tmp_list->data);
-
+
g_list_free (obj->filters);
obj->filters = NULL;
}
* _gdk_window_destroy_hierarchy:
* @window: a #GdkWindow
* @recursing: If TRUE, then this is being called because a parent
- * was destroyed.
+ * was destroyed.
* @recursing_native: If TRUE, then this is being called because a native parent
- * was destroyed. This generally means that the call to the
+ * was destroyed. This generally means that the call to the
* windowing system to destroy the window can be omitted, since
* it will be destroyed as a result of the parent being destroyed.
- * Unless @foreign_destroy.
- * @foreign_destroy: If TRUE, the window or a parent was destroyed by some
- * external agency. The window has already been destroyed and no
+ * Unless @foreign_destroy.
+ * @foreign_destroy: If TRUE, the window or a parent was destroyed by some
+ * external agency. The window has already been destroyed and no
* windowing system calls should be made. (This may never happen
* for some windowing systems.)
*
g_return_if_fail (GDK_IS_WINDOW (window));
private = (GdkWindowObject*) window;
-
+
if (GDK_WINDOW_DESTROYED (window))
return;
-
+
display = gdk_drawable_get_display (GDK_DRAWABLE (window));
screen = gdk_drawable_get_screen (GDK_DRAWABLE (window));
temp_window = g_object_get_qdata (G_OBJECT (screen), quark_pointer_window);
}
gdk_window_free_paint_stack (window);
-
+
if (private->bg_pixmap &&
- private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
- private->bg_pixmap != GDK_NO_BG)
+ private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
+ private->bg_pixmap != GDK_NO_BG)
{
g_object_unref (private->bg_pixmap);
private->bg_pixmap = NULL;
}
-
+
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_FOREIGN)
g_assert (private->children == NULL);
else
{
children = tmp = private->children;
private->children = NULL;
-
+
while (tmp)
{
temp_window = tmp->data;
tmp = tmp->next;
-
+
temp_private = (GdkWindowObject*) temp_window;
if (temp_private)
_gdk_window_destroy_hierarchy (temp_window,
- TRUE,
+ TRUE,
recursing_native || gdk_window_has_impl (private),
foreign_destroy);
}
-
+
g_list_free (children);
}
- _gdk_window_clear_update_area (window);
-
+ _gdk_window_clear_update_area (window);
+
if (private->cairo_surface)
{
cairo_surface_finish (private->cairo_surface);
window_remove_filters (window);
- gdk_drawable_set_colormap (GDK_DRAWABLE (window), NULL);
+ gdk_drawable_set_colormap (GDK_DRAWABLE (window), NULL);
/* If we own the redirect, free it */
if (private->redirect && private->redirect->redirected == private)
* this function for that. If GTK+ receives an event for a #GdkWindow,
* and the user data for the window is non-%NULL, GTK+ will assume the
* user data is a #GtkWidget, and forward the event to that widget.
- *
+ *
**/
void
gdk_window_set_user_data (GdkWindow *window,
*
* Retrieves the user data for @window, which is normally the widget
* that @window belongs to. See gdk_window_set_user_data().
- *
+ *
**/
void
gdk_window_get_user_data (GdkWindow *window,
/**
* gdk_window_get_window_type:
* @window: a #GdkWindow
- *
+ *
* Gets the type of the window. See #GdkWindowType.
- *
+ *
* Return value: type of window
**/
GdkWindowType
gdk_window_get_window_type (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), (GdkWindowType) -1);
-
+
return GDK_WINDOW_TYPE (window);
}
* received or processed.
*
* The position coordinates are relative to the window's parent window.
- *
+ *
**/
void
gdk_window_get_position (GdkWindow *window,
gint *y)
{
GdkWindowObject *obj;
-
+
g_return_if_fail (GDK_IS_WINDOW (window));
-
+
obj = (GdkWindowObject*) window;
-
+
if (x)
*x = obj->x;
if (y)
/**
* gdk_window_get_parent:
* @window: a #GdkWindow
- *
+ *
* Obtains the parent of @window, as known to GDK. Does not query the
* X server; thus this returns the parent as passed to gdk_window_new(),
* not the actual parent. This should never matter unless you're using
* Xlib calls mixed with GDK calls on the X11 platform. It may also
* matter for toplevel windows, because the window manager may choose
* to reparent them.
- *
+ *
* Return value: parent of @window
**/
GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-
+
return (GdkWindow*) ((GdkWindowObject*) window)->parent;
}
/**
* gdk_window_get_toplevel:
* @window: a #GdkWindow
- *
+ *
* Gets the toplevel window that's an ancestor of @window.
*
* Any window type but %GDK_WINDOW_CHILD is considered a
* toplevel window, as is a %GDK_WINDOW_CHILD window that
- * has a root window as parent.
- *
+ * has a root window as parent.
+ *
* Return value: the toplevel window containing @window
**/
GdkWindow*
gdk_window_get_toplevel (GdkWindow *window)
{
GdkWindowObject *obj;
-
+
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
obj = (GdkWindowObject *)window;
-
+
while (GDK_WINDOW_TYPE (obj) == GDK_WINDOW_CHILD)
{
if (obj->parent == NULL ||
break;
obj = obj->parent;
}
-
+
return GDK_WINDOW (obj);
}
/**
* gdk_window_get_children:
* @window: a #GdkWindow
- *
+ *
* Gets the list of children of @window known to GDK.
* This function only returns children created via GDK,
* so for example it's useless when used with the root window;
*
* The returned list must be freed, but the elements in the
* list need not be.
- *
+ *
* Return value: list of child windows inside @window
**/
GList*
/**
* gdk_window_peek_children:
* @window: a #GdkWindow
- *
+ *
* Like gdk_window_get_children(), but does not copy the list of
* children, so the list does not need to be freed.
- *
+ *
* Return value: a reference to the list of child windows in @window
**/
GList *
* See gdk_display_add_client_message_filter() if you are interested
* in X ClientMessage events.
**/
-void
+void
gdk_window_add_filter (GdkWindow *window,
GdkFilterFunc function,
gpointer data)
GdkWindowObject *private;
GList *tmp_list;
GdkEventFilter *filter;
-
+
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
private = (GdkWindowObject*) window;
ensure there is a native window. */
if (window)
gdk_window_ensure_native (window);
-
+
if (private)
tmp_list = private->filters;
else
tmp_list = _gdk_default_filters;
-
+
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
return;
tmp_list = tmp_list->next;
}
-
+
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
-
+
if (private)
private->filters = g_list_append (private->filters, filter);
else
* @data: user data for previously-added filter function
*
* Remove a filter previously added with gdk_window_add_filter().
- *
+ *
**/
void
gdk_window_remove_filter (GdkWindow *window,
GdkWindowObject *private;
GList *tmp_list, *node;
GdkEventFilter *filter;
-
+
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
private = (GdkWindowObject*) window;
-
+
if (private)
tmp_list = private->filters;
else
tmp_list = _gdk_default_filters;
-
+
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
node = tmp_list;
tmp_list = tmp_list->next;
-
+
if ((filter->function == function) && (filter->data == data))
{
if (private)
_gdk_default_filters = g_list_remove_link (_gdk_default_filters, node);
g_list_free_1 (node);
g_free (filter);
-
+
return;
}
}
/**
* gdk_screen_get_toplevel_windows:
* @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
* gdk_get_default_root_window()).
*
* The returned list should be freed with g_list_free(), but
* its elements need not be freed.
- *
+ *
* Return value: list of toplevel windows, free with g_list_free()
*
* Since: 2.2
GdkWindow * root_window;
GList *new_list = NULL;
GList *tmp_list;
-
+
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
+
root_window = gdk_screen_get_root_window (screen);
tmp_list = ((GdkWindowObject *)root_window)->children;
new_list = g_list_prepend (new_list, tmp_list->data);
tmp_list = tmp_list->next;
}
-
+
return new_list;
}
/**
* gdk_window_get_toplevels:
- *
+ *
* Obtains a list of all toplevel windows known to GDK on the default
* screen (see gdk_screen_get_toplevel_windows()).
* A toplevel window is a child of the root window (see
*
* The returned list should be freed with g_list_free(), but
* its elements need not be freed.
- *
+ *
* Return value: list of toplevel windows, free with g_list_free()
*
* Deprecated: 2.16: Use gdk_screen_get_toplevel_windows() instead.
/**
* gdk_window_is_visible:
* @window: a #GdkWindow
- *
+ *
* Checks whether the window has been mapped (with gdk_window_show() or
* gdk_window_show_unraised()).
- *
+ *
* Return value: %TRUE if the window is mapped
**/
-gboolean
+gboolean
gdk_window_is_visible (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
-
+
return GDK_WINDOW_IS_MAPPED (window);
}
/**
* gdk_window_is_viewable:
* @window: a #GdkWindow
- *
+ *
* Check if the window and all ancestors of the window are
* mapped. (This is not necessarily "viewable" in the X sense, since
* we only check as far as we have GDK window parents, not to the root
*
* Return value: %TRUE if the window is viewable
**/
-gboolean
+gboolean
gdk_window_is_viewable (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
screen = gdk_drawable_get_screen (window);
root_window = gdk_screen_get_root_window (screen);
-
- while (private &&
+
+ while (private &&
(private != (GdkWindowObject *)root_window) &&
(GDK_WINDOW_TYPE (private) != GDK_WINDOW_FOREIGN))
{
if (GDK_WINDOW_DESTROYED (private) || !GDK_WINDOW_IS_MAPPED (private))
return FALSE;
-
+
private = (GdkWindowObject *)private->parent;
}
-
+
return TRUE;
}
/**
* gdk_window_get_state:
* @window: a #GdkWindow
- *
+ *
* Gets the bitwise OR of the currently active window state flags,
* from the #GdkWindowState enumeration.
- *
+ *
* Return value: window state bitfield
**/
GdkWindowState
gdk_window_get_state (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
-
+
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
-
+
return private->state;
}
if (GDK_IS_PAINTABLE (private->impl))
return FALSE; /* Implementation does double buffering */
-
+
if (private->paint_stack != NULL ||
private->implicit_paint != NULL)
return FALSE; /* Don't stack implicit paints */
MAX (rect->width, 1), MAX (rect->height, 1), -1);
private->implicit_paint = paint;
-
+
return TRUE;
}
/* Reset clip region of the cached GdkGC */
gdk_gc_set_clip_region (tmp_gc, NULL);
}
-
+
g_object_unref (paint->pixmap);
g_free (paint);
}
* A convenience wrapper around gdk_window_begin_paint_region() which
* creates a rectangular region for you. See
* gdk_window_begin_paint_region() for details.
- *
+ *
**/
void
gdk_window_begin_paint_rect (GdkWindow *window,
- const GdkRectangle *rectangle)
+ const GdkRectangle *rectangle)
{
GdkRegion *region;
* the topmost backing store in the stack. One matching call to
* gdk_window_end_paint() is required for each call to
* gdk_window_begin_paint_region().
- *
+ *
**/
-void
+void
gdk_window_begin_paint_region (GdkWindow *window,
- const GdkRegion *region)
+ const GdkRegion *region)
{
#ifdef USE_BACKING_STORE
GdkWindowObject *private = (GdkWindowObject *)window;
if (GDK_WINDOW_DESTROYED (window))
return;
- if (GDK_IS_PAINTABLE (private->impl))
+ if (GDK_IS_PAINTABLE (private->impl))
{
GdkPaintableIface *iface = GDK_PAINTABLE_GET_IFACE (private->impl);
if (iface->begin_paint_region)
- iface->begin_paint_region ((GdkPaintable*)private->impl, window, region);
-
+ iface->begin_paint_region ((GdkPaintable*)private->impl, window, region);
+
return;
}
gdk_region_offset (paint->region, private->abs_x, private->abs_y);
/* Mark the region as valid on the implicit paint */
-
+
if (implicit_paint)
gdk_region_union (implicit_paint->region, paint->region);
/* Convert back to normal coords */
gdk_region_offset (paint->region, -private->abs_x, -private->abs_y);
-
+
if (implicit_paint)
{
int width, height;
-
+
paint->uses_implicit = TRUE;
paint->pixmap = g_object_ref (implicit_paint->pixmap);
paint->x_offset = -private->abs_x + implicit_paint->x_offset;
paint->y_offset = -private->abs_y + implicit_paint->y_offset;
-
+
/* It would be nice if we had some cairo support here so we
could set the clip rect on the cairo surface */
width = private->abs_x + private->width;
height = private->abs_y + private->height;
-
+
paint->surface = _gdk_drawable_create_cairo_surface (paint->pixmap, width, height);
}
MAX (clip_box.width, 1), MAX (clip_box.height, 1), -1);
paint->surface = _gdk_drawable_ref_cairo_surface (paint->pixmap);
}
-
+
if (paint->surface)
cairo_surface_set_device_offset (paint->surface,
-paint->x_offset, -paint->y_offset);
-
+
for (list = private->paint_stack; list != NULL; list = list->next)
{
GdkWindowPaint *tmp_paint = list->data;
gdk_region_subtract (tmp_paint->region, paint->region);
}
-
+
private->paint_stack = g_slist_prepend (private->paint_stack, paint);
if (!gdk_region_empty (paint->region))
int x_offset, y_offset;
toplevel = GDK_WINDOW (private->redirect->redirected);
-
+
/* Get the clip region for gc clip rect + window hierarchy in
window relative coords */
visible_region =
_gdk_window_calculate_full_clip_region (window, toplevel,
TRUE,
- &x_offset,
+ &x_offset,
&y_offset);
/* Compensate for the source pos/size */
* gdk_window_begin_paint_region() for full details. It is an error to
* call this function without a matching
* gdk_window_begin_paint_region() first.
- *
+ *
**/
void
gdk_window_end_paint (GdkWindow *window)
GdkPaintableIface *iface = GDK_PAINTABLE_GET_IFACE (private->impl);
if (iface->end_paint)
- iface->end_paint ((GdkPaintable*)private->impl);
+ iface->end_paint ((GdkPaintable*)private->impl);
return;
}
paint = private->paint_stack->data;
- private->paint_stack = g_slist_delete_link (private->paint_stack,
+ private->paint_stack = g_slist_delete_link (private->paint_stack,
private->paint_stack);
gdk_region_get_clipbox (paint->region, &clip_box);
if (!paint->uses_implicit)
{
gdk_window_flush_outstanding_moves (window);
-
+
full_clip = gdk_region_copy (private->clip_region_with_children);
gdk_region_intersect (full_clip, paint->region);
_gdk_gc_set_clip_region_internal (tmp_gc, full_clip, TRUE); /* Takes ownership of full_clip */
clip_box.x - x_offset, clip_box.y - y_offset,
clip_box.width, clip_box.height);
}
-
+
if (private->redirect)
{
int x_offset, y_offset;
clip_box.y + y_offset,
clip_box.width, clip_box.height);
}
-
+
/* Reset clip region of the cached GdkGC */
gdk_gc_set_clip_region (tmp_gc, NULL);
gdk_window_free_paint_stack (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
-
+
if (private->paint_stack)
{
GSList *tmp_list = private->paint_stack;
if (tmp_list == private->paint_stack)
g_object_unref (paint->pixmap);
-
+
gdk_region_destroy (paint->region);
g_free (paint);
gdk_region_offset (dest_region, dx, dy); /* back to dest area */
gdk_region_get_clipbox (dest_region, ©_rect);
-
+
gdk_gc_set_clip_region (tmp_gc, dest_region);
gdk_draw_drawable (impl_window->impl,
tmp_gc,
int dx, int dy)
{
GdkWindowRegionMove *move;
-
+
move = g_slice_new (GdkWindowRegionMove);
move->dest_region = gdk_region_copy (region);
move->dx = dx;
{
prev = l->prev;
old_move = l->data;
-
+
old_total_region = gdk_region_copy (old_move->dest_region);
gdk_region_offset (old_total_region, -old_move->dx, -old_move->dy);
gdk_region_union (old_total_region, old_move->dest_region);
gdk_region_subtract (non_overwritten, new_dest_region);
/* move to source region */
gdk_region_offset (non_overwritten, -old_move->dx, -old_move->dy);
-
+
gdk_region_intersect (non_overwritten, new_dest_region);
if (gdk_region_empty (non_overwritten))
{
move = gdk_window_region_move_new (new_dest_region,
dx + old_move->dx,
dy + old_move->dy);
-
+
impl_window->outstanding_moves =
g_list_insert_before (impl_window->outstanding_moves,
l, move);
gdk_region_destroy (source_overlaps_destination);
gdk_region_destroy (old_total_region);
- break;
+ break;
}
gdk_region_destroy (old_total_region);
}
gdk_region_destroy (new_total_region);
-
+
if (!added_move)
{
move = gdk_window_region_move_new (new_dest_region, dx, dy);
-
+
if (l == NULL)
impl_window->outstanding_moves =
g_list_prepend (impl_window->outstanding_moves,
gdk_region_destroy (region);
return;
}
-
+
impl_window = gdk_window_get_impl_window (private);
/* Move any old invalid regions in the copy source area by dx/dy */
{
GdkRegion *update_area;
update_area = gdk_region_copy (region);
-
+
/* Convert from target to source */
gdk_region_offset (update_area, -dx, -dy);
gdk_region_intersect (update_area, impl_window->update_area);
/* This area of the destination is now invalid,
so no need to copy to it. */
gdk_region_subtract (region, update_area);
-
+
gdk_region_destroy (update_area);
}
-
+
if (1) /* Enable flicker free handling of moves. */
append_move_region (impl_window, region, dx, dy);
else
do_move_region_bits_on_impl (impl_window,
region, dx, dy);
-
+
gdk_region_destroy (region);
}
GdkWindowRegionMove *move;
private = (GdkWindowObject *) window;
-
+
impl_window = gdk_window_get_impl_window (private);
-
+
for (l = impl_window->outstanding_moves; l != NULL; l = l->next)
{
move = l->data;
gdk_window_region_move_free (move);
}
-
+
g_list_free (impl_window->outstanding_moves);
impl_window->outstanding_moves = NULL;
}
{
GdkWindowObject *child;
GList *l;
-
+
for (l = window->children; l != NULL; l = l->next)
{
child = l->data;
/**
* gdk_window_get_internal_paint_info:
* @window: a #GdkWindow
- * @real_drawable: location to store the drawable to which drawing should be
+ * @real_drawable: location to store the drawable to which drawing should be
* done.
* @x_offset: location to store the X offset between coordinates in @window,
- * and the underlying window system primitive coordinates for
+ * and the underlying window system primitive coordinates for
* *@real_drawable.
* @y_offset: location to store the Y offset between coordinates in @window,
* and the underlying window system primitive coordinates for
* *@real_drawable.
- *
+ *
* If you bypass the GDK layer and use windowing system primitives to
* draw directly onto a #GdkWindow, then you need to deal with two
* details: there may be an offset between GDK coordinates and windowing
gint *y_offset)
{
gint x_off, y_off;
-
+
GdkWindowObject *private;
g_return_if_fail (GDK_IS_WINDOW (window));
if (private->window_type == GDK_WINDOW_ROOT)
return;
-
+
if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
clip = private->clip_region_with_children;
else
clip = private->clip_region;
-
+
_gdk_gc_add_drawable_clip (gc,
private->clip_tag,
clip,
#define OFFSET_GC(gc) \
- gint x_offset, y_offset; \
+ gint x_offset, y_offset; \
gint old_clip_x = gc->clip_x_origin; \
gint old_clip_y = gc->clip_y_origin; \
gint old_ts_x = gc->ts_x_origin; \
gint old_ts_y = gc->ts_y_origin; \
gdk_window_get_offsets (drawable, &x_offset, &y_offset); \
- if (x_offset != 0 || y_offset != 0) \
+ if (x_offset != 0 || y_offset != 0) \
{ \
- gdk_gc_set_clip_origin (gc, old_clip_x - x_offset, \
- old_clip_y - y_offset); \
- gdk_gc_set_ts_origin (gc, old_ts_x - x_offset, \
- old_ts_y - y_offset); \
+ gdk_gc_set_clip_origin (gc, old_clip_x - x_offset, \
+ old_clip_y - y_offset); \
+ gdk_gc_set_ts_origin (gc, old_ts_x - x_offset, \
+ old_ts_y - y_offset); \
}
#define RESTORE_GC(gc) \
- if (x_offset != 0 || y_offset != 0) \
+ if (x_offset != 0 || y_offset != 0) \
{ \
gdk_gc_set_clip_origin (gc, old_clip_x, old_clip_y); \
gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y); \
}
#define SETUP_PAINT_GC_CLIP(gc) \
- if (paint->uses_implicit) \
+ if (paint->uses_implicit) \
setup_clip_for_paint (drawable, paint, gc, old_clip_x, \
- old_clip_y);
+ old_clip_y);
-#define RESTORE_PAINT_GC_CLIP(gc)
+#define RESTORE_PAINT_GC_CLIP(gc)
#define SETUP_DIRECT_GC_CLIP(gc) \
static GdkGC *
gdk_window_create_gc (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask mask)
+ GdkGCValues *values,
+ GdkGCValuesMask mask)
{
g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
-
+
if (GDK_WINDOW_DESTROYED (drawable))
return NULL;
return gdk_gc_new_with_values (((GdkWindowObject *) drawable)->impl,
- values, mask);
+ values, mask);
}
/* After having set up the drawable clip rect on a GC we need
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
gdk_draw_rectangle (pixmap_impl (paint->pixmap), gc, filled,
- x - x_offset, y - y_offset, width, height);
+ x - x_offset, y - y_offset, width, height);
RESTORE_PAINT_GC_CLIP (gc);
}
else
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
-
+
OFFSET_GC (gc);
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (x_offset != 0 || y_offset != 0)
{
int i;
-
+
new_points = g_new (GdkPoint, npoints);
for (i=0; i<npoints; i++)
{
gdk_draw_polygon (private->impl, gc, filled, new_points, npoints);
RESTORE_DIRECT_GC_CLIP(gc);
}
-
+
if (new_points != points)
g_free (new_points);
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_text (pixmap_impl (paint->pixmap), font, gc,
+ gdk_draw_text (pixmap_impl (paint->pixmap), font, gc,
x - x_offset, y - y_offset, text, text_length);
RESTORE_PAINT_GC_CLIP (gc);
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
- gdk_draw_text_wc (pixmap_impl (paint->pixmap), font, gc,
+ gdk_draw_text_wc (pixmap_impl (paint->pixmap), font, gc,
x - x_offset, y - y_offset, text, text_length);
RESTORE_PAINT_GC_CLIP (gc);
}
x - x_offset, y - y_offset, text, text_length);
RESTORE_DIRECT_GC_CLIP(gc);
}
-
+
RESTORE_GC (gc);
}
private = (GdkWindowObject *) window;
if (GDK_DRAWABLE_GET_CLASS (private->impl)->get_source_drawable)
return GDK_DRAWABLE_GET_CLASS (private->impl)->get_source_drawable (private->impl);
-
+
return drawable;
}
static GdkDrawable *
gdk_window_get_composite_drawable (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height,
- gint *composite_x_offset,
- gint *composite_y_offset)
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset)
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
GSList *list;
{
GdkWindowPaint *paint = list->data;
GdkOverlapType overlap;
-
+
overlap = gdk_region_rect_in (paint->region, &rect);
-
+
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)
rect.x += private->abs_x;
rect.y += private->abs_y;
-
+
overlap = gdk_region_rect_in (implicit_paint->region, &rect);
if (overlap == GDK_OVERLAP_RECTANGLE_IN)
{
*composite_x_offset = -private->abs_x + implicit_paint->x_offset;
*composite_y_offset = -private->abs_y + implicit_paint->y_offset;
-
+
return g_object_ref (implicit_paint->pixmap);
}
else if (overlap == GDK_OVERLAP_RECTANGLE_PART)
if (!overlap_buffer)
return g_object_ref (_gdk_drawable_get_source_drawable (drawable));
-
+
tmp_pixmap = gdk_pixmap_new (drawable, width, height, -1);
tmp_gc = _gdk_drawable_get_scratch_gc (tmp_pixmap, FALSE);
source = _gdk_drawable_get_source_drawable (drawable);
-
+
/* Copy the current window contents */
gdk_draw_drawable (tmp_pixmap,
- tmp_gc,
- GDK_WINDOW_OBJECT (source)->impl,
- x - *composite_x_offset,
- y - *composite_y_offset,
- 0, 0,
- width, height);
+ tmp_gc,
+ GDK_WINDOW_OBJECT (source)->impl,
+ x - *composite_x_offset,
+ y - *composite_y_offset,
+ 0, 0,
+ width, height);
/* paint the backing stores */
if (implicit_paint)
{
GdkWindowPaint *paint = list->data;
-
+
gdk_gc_set_clip_region (tmp_gc, paint->region);
gdk_gc_set_clip_origin (tmp_gc, -x - paint->x_offset, -y - paint->y_offset);
-
+
gdk_draw_drawable (tmp_pixmap, tmp_gc, paint->pixmap,
x - paint->x_offset,
y - paint->y_offset,
0, 0, width, height);
}
-
+
for (list = private->paint_stack; list != NULL; list = list->next)
{
GdkWindowPaint *paint = list->data;
if (paint->uses_implicit)
continue; /* We already copied this above */
-
+
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);
while (tmp_list)
{
GdkWindowPaint *paint = tmp_list->data;
-
+
gdk_region_union (paint_region, paint->region);
- tmp_list = tmp_list->next;
+ tmp_list = tmp_list->next;
}
gdk_region_intersect (result, paint_region);
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
-
+
OFFSET_GC (gc);
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
gdk_draw_segments (private->impl, gc, new_segs, nsegs);
RESTORE_DIRECT_GC_CLIP(gc);
}
-
+
if (new_segs != segs)
g_free (new_segs);
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
else if (GDK_PANGO_UNITS_OVERFLOWS (x_offset, y_offset))
{
PangoMatrix identity = PANGO_MATRIX_INIT;
-
+
tmp_matrix = identity;
tmp_matrix.x0 -= x_offset;
tmp_matrix.y0 -= y_offset;
y -= y_offset * PANGO_SCALE;
}
}
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
clip = gdk_region_copy (paint->region);
gdk_region_intersect (clip, region);
gdk_region_get_clipbox (clip, &clipbox);
-
-
+
+
if (method.cr)
{
g_assert (method.gc == NULL);
}
gdk_region_destroy (clip);
-
+
#if 0
g_timer_destroy (timer);
#endif
gint x_offset, y_offset;
BackingRectMethod method;
GdkWindowPaint paint;
-
+
if (GDK_WINDOW_DESTROYED (window))
return;
/* Convert region to pixmap coords */
gdk_region_offset (clip_region, x_offset, y_offset);
-
+
paint.x_offset = 0;
paint.y_offset = 0;
paint.pixmap = redirect->pixmap;
paint.surface = _gdk_drawable_ref_cairo_surface (redirect->pixmap);
-
+
method.cr = NULL;
method.gc = NULL;
setup_backing_rect_method (&method, window, &paint, -x_offset, -y_offset);
GdkWindowPaint paint;
GdkRegion *clip;
GdkRectangle clipbox;
-
+
if (GDK_WINDOW_DESTROYED (window))
return;
paint.y_offset = 0;
paint.pixmap = window;
paint.surface = _gdk_drawable_ref_cairo_surface (window);
-
+
method.cr = NULL;
method.gc = NULL;
setup_backing_rect_method (&method, window, &paint, 0, 0);
clip = gdk_region_copy (private->clip_region_with_children);
gdk_region_intersect (clip, region);
gdk_region_get_clipbox (clip, &clipbox);
-
+
if (method.cr)
{
g_assert (method.gc == NULL);
g_object_unref (method.gc);
}
-
+
gdk_region_destroy (clip);
cairo_surface_destroy (paint.surface);
}
/**
* gdk_window_clear:
* @window: a #GdkWindow
- *
+ *
* Clears an entire @window to the background color or background pixmap.
**/
void
g_return_if_fail (GDK_IS_WINDOW (window));
gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
-
+
gdk_window_clear_area (window, 0, 0,
- width, height);
+ width, height);
}
static void
gboolean send_expose)
{
GdkWindowObject *private = (GdkWindowObject *)window;
-
+
if (private->paint_stack)
gdk_window_clear_backing_region (window, region);
else
{
if (private->redirect)
gdk_window_clear_backing_region_redirect (window, region);
-
+
gdk_window_clear_backing_region_direct (window, region);
if (send_expose)
gdk_window_invalidate_region (window, region, FALSE);
GdkRegion *region;
g_return_if_fail (GDK_IS_WINDOW (window));
-
+
/* This is what XClearArea does, and e.g. GtkCList uses it,
so we need to duplicate that */
if (width == 0)
region,
FALSE);
gdk_region_destroy (region);
-
+
}
/**
* @height: height of rectangle to clear
*
* Clears an area of @window to the background color or background pixmap.
- *
+ *
**/
void
gdk_window_clear_area (GdkWindow *window,
*
* This function has a stupid name because it dates back to the mists
* time, pre-GDK-1.0.
- *
+ *
**/
void
gdk_window_clear_area_e (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
gdk_window_clear_area_internal (window,
x, y,
static void
gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
SETUP_PAINT_GC_CLIP (gc);
gdk_draw_image (pixmap_impl (paint->pixmap), gc, image, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ xdest - x_offset, ydest - y_offset,
+ width, height);
RESTORE_PAINT_GC_CLIP (gc);
}
/* Need block to make OFFSET_GC macro to work */
{
OFFSET_GC (gc);
-
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
dither, x_dither, y_dither);
RESTORE_DIRECT_GC_CLIP(gc);
}
-
+
RESTORE_GC (gc);
}
}
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
gdk_draw_trapezoids (private->impl, gc, trapezoids, n_trapezoids);
RESTORE_DIRECT_GC_CLIP(gc);
}
-
+
g_free (new_trapezoids);
RESTORE_GC (gc);
static void
gdk_window_real_get_size (GdkDrawable *drawable,
- gint *width,
- gint *height)
+ gint *width,
+ gint *height)
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
static void
gdk_window_real_set_colormap (GdkDrawable *drawable,
- GdkColormap *cmap)
+ GdkColormap *cmap)
{
GdkWindowObject *private;
-
- g_return_if_fail (GDK_IS_WINDOW (drawable));
+
+ g_return_if_fail (GDK_IS_WINDOW (drawable));
if (GDK_WINDOW_DESTROYED (drawable))
return;
if (!private->input_only &&
cmap != gdk_drawable_get_colormap ((GdkDrawable *)(private->parent)))
gdk_window_ensure_native ((GdkWindow *)drawable);
-
+
gdk_drawable_set_colormap (private->impl, cmap);
}
if (GDK_WINDOW_DESTROYED (drawable))
return NULL;
-
+
return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
}
-
+
static GdkImage*
gdk_window_copy_to_image (GdkDrawable *drawable,
GdkImage *image,
{
GdkWindowObject *private = (GdkWindowObject *) drawable;
gint x_offset, y_offset;
-
+
g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
-
+
if (GDK_WINDOW_DESTROYED (drawable))
return NULL;
/* TODO: Is this right? */
x_offset = 0;
- y_offset = 0;
-
+ y_offset = 0;
+
return gdk_drawable_copy_to_image (private->impl,
image,
src_x - x_offset,
}
else
{
-
+
/* This will be drawing directly to the window, so flush implicit paint */
gdk_window_flush ((GdkWindow *)drawable);
-
+
if (!private->cairo_surface)
{
int width, height;
/* TODO: Avoid the typecheck crap by adding virtual call */
private->cairo_surface = _gdk_drawable_create_cairo_surface (source, width, height);
-
+
if (private->cairo_surface)
{
- cairo_surface_set_device_offset (private->cairo_surface,
+ cairo_surface_set_device_offset (private->cairo_surface,
private->abs_x,
private->abs_y);
-
+
cairo_surface_set_user_data (private->cairo_surface, &gdk_window_cairo_key,
drawable, gdk_window_cairo_surface_destroy);
}
}
else
cairo_surface_reference (private->cairo_surface);
-
+
surface = private->cairo_surface;
}
cairo_identity_matrix (cr);
cairo_reset_clip (cr);
-
+
cairo_new_path (cr);
gdk_cairo_region (cr, private->clip_region);
-
+
cairo_restore (cr);
cairo_clip (cr);
}
{
cairo_save (cr);
cairo_identity_matrix (cr);
-
+
cairo_reset_clip (cr);
-
+
cairo_new_path (cr);
gdk_cairo_region (cr, paint->region);
cairo_restore (cr);
-
+
cairo_clip (cr);
}
}
static inline gboolean
gdk_window_is_ancestor (GdkWindow *window,
- GdkWindow *ancestor)
+ GdkWindow *ancestor)
{
while (window)
{
GdkWindow *parent = (GdkWindow*) ((GdkWindowObject*) window)->parent;
if (parent == ancestor)
- return TRUE;
+ return TRUE;
window = parent;
}
* children of "window" or from a differen hierarchy
*/
if (!has_ancestor_in_list && gdk_window_is_ancestor (window, tmp->data))
- has_ancestor_in_list = TRUE;
+ has_ancestor_in_list = TRUE;
/* insert in reverse stacking order when adding around siblings,
* so processing updates properly paints over lower stacked windows
*/
if (parent == GDK_WINDOW_OBJECT (tmp->data)->parent)
- {
- gint index = g_list_index (parent->children, window);
- for (; tmp && parent == GDK_WINDOW_OBJECT (tmp->data)->parent; tmp = tmp->next)
- {
- gint sibling_index = g_list_index (parent->children, tmp->data);
- if (index > sibling_index)
- break;
- prev = tmp;
- }
- /* here, tmp got advanced past all lower stacked siblings */
- tmp = g_slist_prepend (tmp, window);
- if (prev)
- prev->next = tmp;
- else
- update_windows = tmp;
- return;
- }
+ {
+ gint index = g_list_index (parent->children, window);
+ for (; tmp && parent == GDK_WINDOW_OBJECT (tmp->data)->parent; tmp = tmp->next)
+ {
+ gint sibling_index = g_list_index (parent->children, tmp->data);
+ if (index > sibling_index)
+ break;
+ prev = tmp;
+ }
+ /* here, tmp got advanced past all lower stacked siblings */
+ tmp = g_slist_prepend (tmp, window);
+ if (prev)
+ prev->next = tmp;
+ else
+ update_windows = tmp;
+ return;
+ }
/* if "window" has an ancestor in the list and tmp is one of
* "window's" children, insert "window" before tmp
*/
if (has_ancestor_in_list && gdk_window_is_ancestor (tmp->data, window))
- {
- tmp = g_slist_prepend (tmp, window);
+ {
+ tmp = g_slist_prepend (tmp, window);
- if (prev)
- prev->next = tmp;
- else
- update_windows = tmp;
- return;
- }
+ if (prev)
+ prev->next = tmp;
+ else
+ update_windows = tmp;
+ return;
+ }
/* if we're at the end of the list and had an ancestor it it,
* append to the list
*/
if (! tmp->next && has_ancestor_in_list)
- {
- tmp = g_slist_append (tmp, window);
- return;
- }
+ {
+ tmp = g_slist_append (tmp, window);
+ return;
+ }
prev = tmp;
}
gdk_window_update_idle (gpointer data)
{
gdk_window_process_all_updates ();
-
+
return FALSE;
}
void
_gdk_window_process_updates_recurse (GdkWindow *window,
- GdkRegion *expose_region)
+ GdkRegion *expose_region)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowObject *child;
if (gdk_region_empty (expose_region))
return;
-
+
/* Iterate over children, starting at topmost */
for (l = private->children; l != NULL; l = l->next)
{
child = l->data;
-
+
if (!GDK_WINDOW_IS_MAPPED (child) || child->input_only || child->composited)
continue;
r.y = child->y;
r.width = child->width;
r.height = child->height;
-
+
child_region = gdk_region_rectangle (&r);
if (child->shape)
gdk_region_intersect (child_region, child->shape);
-
- if (child->impl == private->impl)
+
+ if (child->impl == private->impl)
{
/* Client side child, expose */
gdk_region_intersect (child_region, expose_region);
gdk_region_offset (child_region, -child->x, -child->y);
_gdk_window_process_updates_recurse ((GdkWindow *)child, child_region);
}
- else
+ else
{
/* Native child, just remove area from expose region */
gdk_region_subtract (expose_region, child_region);
if (private->event_mask & GDK_EXPOSURE_MASK)
{
GdkEvent event;
-
+
event.expose.type = GDK_EXPOSE;
event.expose.window = g_object_ref (window);
event.expose.send_event = FALSE;
event.expose.count = 0;
event.expose.region = expose_region;
gdk_region_get_clipbox (expose_region, &event.expose.area);
-
+
(*_gdk_event_func) (&event, _gdk_event_data);
-
+
g_object_unref (window);
}
else if (private->bg_pixmap != GDK_NO_BG)
*
* We use begin/end_paint around the clear so that we can
* piggyback on the implicit paint */
-
+
gdk_window_begin_paint_region (window, expose_region);
gdk_window_clear_region_internal (window, expose_region, FALSE);
gdk_window_end_paint (window);
{
GdkRegion *update_area = private->update_area;
private->update_area = NULL;
-
+
if (_gdk_event_func && gdk_window_is_viewable (window) &&
private->window_type != GDK_WINDOW_FOREIGN)
{
/* Clip to part visible in toplevel */
gdk_region_intersect (update_area, private->clip_region);
-
- if (debug_updates)
- {
- /* Make sure we see the red invalid area before redrawing. */
- gdk_display_sync (gdk_drawable_get_display (window));
- g_usleep (70000);
- }
+
+ if (debug_updates)
+ {
+ /* Make sure we see the red invalid area before redrawing. */
+ gdk_display_sync (gdk_drawable_get_display (window));
+ g_usleep (70000);
+ }
save_region = GDK_WINDOW_IMPL_GET_IFACE (private->impl)->queue_antiexpose (window, update_area);
if (save_region)
expose_region = gdk_region_copy (update_area);
else
expose_region = update_area;
-
+
window_rect.x = 0;
window_rect.y = 0;
window_rect.width = private->width;
GdkWindowRegionMove *move;
GdkRegion *remove;
GList *l, *prev;
-
+
remove = gdk_region_copy (update_area);
for (l = g_list_last (private->outstanding_moves); l != NULL; l = prev)
{
move = l->data;
/* Don't need this area */
gdk_region_subtract (move->dest_region, remove);
-
+
/* However if any of the destination we do need has a source
in the updated region we do need that as a destination for
the earlier moves */
}
gdk_region_destroy (remove);
}
-
+
gdk_region_get_clipbox (expose_region, &clip_box);
end_implicit = gdk_window_begin_implicit_paint (window, &clip_box);
if (end_implicit) /* rendering is not double buffered, do moves now */
gdk_window_flush_outstanding_moves (window);
gdk_window_end_implicit_paint (window);
}
-
+
if (expose_region != update_area)
gdk_region_destroy (expose_region);
}
if (!save_region)
gdk_region_destroy (update_area);
}
-
+
if (private->outstanding_moves)
{
/* Flush any outstanding moves, may happen if we moved a window but got
*
* Calls gdk_window_process_updates() for all windows (see #GdkWindow)
* in the application.
- *
+ *
**/
void
gdk_window_process_all_updates (void)
if (update_idle)
g_source_remove (update_idle);
-
+
update_windows = NULL;
update_idle = 0;
_gdk_windowing_before_process_all_updates ();
g_slist_foreach (old_update_windows, (GFunc)g_object_ref, NULL);
-
+
while (tmp_list)
{
GdkWindowObject *private = (GdkWindowObject *)tmp_list->data;
-
+
if (!GDK_WINDOW_DESTROYED (tmp_list->data))
- {
+ {
if (private->update_freeze_count ||
gdk_window_is_toplevel_frozen (tmp_list->data))
gdk_window_add_update_window ((GdkWindow *) private);
* @window: a #GdkWindow
* @update_children: whether to also process updates for child windows
*
- * Sends one or more expose events to @window. The areas in each
+ * Sends one or more expose events to @window. The areas in each
* expose event will cover the entire update area for the window (see
* gdk_window_invalidate_region() for details). Normally GDK calls
* gdk_window_process_all_updates() on your behalf, so there's no
* to be delivered immediately and synchronously (vs. the usual
* case, where GDK delivers them in an idle handler). Occasionally
* this is useful to produce nicer scrolling behavior, for example.
- *
+ *
**/
void
gdk_window_process_updates (GdkWindow *window,
impl_window->outstanding_moves) &&
!impl_window->update_freeze_count &&
!gdk_window_is_toplevel_frozen (window))
- {
+ {
gdk_window_process_updates_internal ((GdkWindow *)impl_window);
gdk_window_remove_update_window ((GdkWindow *)impl_window);
}
*/
GList *node;
for (node = g_list_last (private->children); node; node = node->prev)
- gdk_window_process_updates (node->data, TRUE);
+ gdk_window_process_updates (node->data, TRUE);
}
}
**/
void
gdk_window_invalidate_rect (GdkWindow *window,
- const GdkRectangle *rect,
- gboolean invalidate_children)
+ const GdkRectangle *rect,
+ gboolean invalidate_children)
{
GdkRectangle window_rect;
GdkRegion *region;
if (GDK_WINDOW_DESTROYED (window))
return;
-
+
if (private->input_only || !GDK_WINDOW_IS_MAPPED (window))
return;
window_rect.x = 0;
window_rect.y = 0;
gdk_drawable_get_size (GDK_DRAWABLE (window),
- &window_rect.width,
- &window_rect.height);
+ &window_rect.width,
+ &window_rect.height);
rect = &window_rect;
}
static void
draw_ugly_color (GdkWindow *window,
- const GdkRegion *region)
+ const GdkRegion *region)
{
/* Draw ugly color all over the newly-invalid region */
GdkColor ugly_color = { 0, 50000, 10000, 10000 };
GdkGC *ugly_gc;
GdkRectangle clipbox;
-
+
ugly_gc = gdk_gc_new (window);
gdk_gc_set_rgb_fg_color (ugly_gc, &ugly_color);
gdk_gc_set_clip_region (ugly_gc, region);
gdk_region_get_clipbox (region, &clipbox);
-
+
gdk_draw_rectangle (window,
ugly_gc,
TRUE,
clipbox.x, clipbox.y,
clipbox.width, clipbox.height);
-
+
g_object_unref (ugly_gc);
}
**/
void
gdk_window_invalidate_maybe_recurse (GdkWindow *window,
- const GdkRegion *region,
- gboolean (*child_func) (GdkWindow *,
- gpointer),
+ const GdkRegion *region,
+ gboolean (*child_func) (GdkWindow *,
+ gpointer),
gpointer user_data)
{
GdkWindowObject *private = (GdkWindowObject *)window;
while (tmp_list)
{
GdkWindowObject *child = tmp_list->data;
-
+
if (!child->input_only)
{
GdkRegion *child_region;
child_rect.width = child->width;
child_rect.height = child->height;
child_region = gdk_region_rectangle (&child_rect);
-
+
/* remove child area from the invalid area of the parent */
if (GDK_WINDOW_IS_MAPPED (child) && !child->shaped &&
!child->composited &&
- !gdk_window_is_offscreen (child))
+ !gdk_window_is_offscreen (child))
gdk_region_subtract (visible_region, child_region);
-
+
if (child_func && (*child_func) ((GdkWindow *)child, user_data))
{
- GdkRegion *tmp = gdk_region_copy (region);
+ GdkRegion *tmp = gdk_region_copy (region);
gdk_region_offset (tmp, - child_rect.x, - child_rect.y);
gdk_region_offset (child_region, - child_rect.x, - child_rect.y);
gdk_region_intersect (child_region, tmp);
-
+
gdk_window_invalidate_maybe_recurse ((GdkWindow *)child,
child_region, child_func, user_data);
-
+
gdk_region_destroy (tmp);
}
}
impl_window = gdk_window_get_impl_window (private);
-
+
if (!gdk_region_empty (visible_region) ||
/* Even if we're not exposing anything, make sure we process
idles for windows with outstanding moves */
impl_window->update_area == NULL))
{
if (debug_updates)
- draw_ugly_color (window, region);
-
+ draw_ugly_color (window, region);
+
/* Convert to impl coords */
gdk_region_offset (visible_region, private->abs_x, private->abs_y);
if (impl_window->update_area)
{
gdk_window_add_update_window ((GdkWindow *)impl_window);
impl_window->update_area = gdk_region_copy (visible_region);
-
+
gdk_window_schedule_update ((GdkWindow *)impl_window);
}
}
* gdk_window_invalidate_region:
* @window: a #GdkWindow
* @region: a #GdkRegion
- * @invalidate_children: %TRUE to also invalidate child windows
+ * @invalidate_children: %TRUE to also invalidate child windows
*
* Adds @region to the update area for @window. The update area is the
* region that needs to be redrawn, or "dirty region." The call
{
gdk_window_invalidate_maybe_recurse (window, region,
invalidate_children ?
- true_predicate : (gboolean (*) (GdkWindow *, gpointer))NULL,
+ true_predicate : (gboolean (*) (GdkWindow *, gpointer))NULL,
NULL);
}
* This version of invalidation is used when you recieve expose events
* from the native window system. It exposes the native window, plus
* any non-native child windows (but not native child windows, as those would
- * have gotten their own expose events).
+ * have gotten their own expose events).
**/
void
_gdk_window_invalidate_for_expose (GdkWindow *window,
/**
* gdk_window_get_update_area:
* @window: a #GdkWindow
- *
+ *
* Transfers ownership of the update area from @window to the caller
* of the function. That is, after calling this function, @window will
* no longer have an invalid/dirty region; the update area is removed
* from @window and handed to you. If a window has no update area,
* gdk_window_get_update_area() returns %NULL. You are responsible for
* calling gdk_region_destroy() on the returned region if it's non-%NULL.
- *
+ *
* Return value: the update area for @window
**/
GdkRegion *
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
impl_window = gdk_window_get_impl_window (private);
-
+
if (impl_window->update_area)
{
tmp_region = gdk_region_copy (private->clip_region_with_children);
{
gdk_region_destroy (impl_window->update_area);
impl_window->update_area = NULL;
-
+
gdk_window_remove_update_window ((GdkWindow *)impl_window);
}
-
+
/* Convert from impl coords */
gdk_region_offset (tmp_region, -private->abs_x, -private->abs_y);
return tmp_region;
/**
* _gdk_window_clear_update_area:
* @window: a #GdkWindow.
- *
+ *
* Internal function to clear the update area for a window. This
* is called when the window is hidden or destroyed.
**/
/**
* gdk_window_freeze_updates:
* @window: a #GdkWindow
- *
+ *
* Temporarily freezes a window such that it won't receive expose
* events. The window will begin receiving expose events again when
* gdk_window_thaw_updates() is called. If gdk_window_freeze_updates()
/**
* gdk_window_thaw_updates:
* @window: a #GdkWindow
- *
+ *
* Thaws a window frozen with gdk_window_freeze_updates().
**/
void
impl_window = gdk_window_get_impl_window (private);
g_return_if_fail (impl_window->update_freeze_count > 0);
-
+
if (--impl_window->update_freeze_count == 0)
gdk_window_schedule_update (GDK_WINDOW (impl_window));
}
/**
* gdk_window_thaw_toplevel_updates_libgtk_only:
* @window: a #GdkWindow
- *
+ *
* Thaws a window frozen with
* gdk_window_freeze_toplevel_updates_libgtk_only().
*
* usually more useful than calling gdk_window_set_debug_updates()
* yourself, though you might want to use this function to enable
* updates sometime after application startup time.
- *
+ *
**/
void
gdk_window_set_debug_updates (gboolean setting)
* @height: desired height of the window
* @new_width: location to store resulting width
* @new_height: location to store resulting height
- *
- * Constrains a desired width and height according to a
+ *
+ * Constrains a desired width and height according to a
* set of geometry hints (such as minimum and maximum size).
*/
void
gint yinc = 1;
gint max_width = G_MAXINT;
gint max_height = G_MAXINT;
-
+
#define FLOOR(value, base) ( ((gint) ((value) / (base))) * (base) )
if ((flags & GDK_HINT_BASE_SIZE) && (flags & GDK_HINT_MIN_SIZE))
xinc = MAX (xinc, geometry->width_inc);
yinc = MAX (yinc, geometry->height_inc);
}
-
+
/* clamp width and height to min and max values
*/
width = CLAMP (width, min_width, max_width);
height = CLAMP (height, min_height, max_height);
-
+
/* shrink to base + N * inc
*/
width = base_width + FLOOR (width - base_width, xinc);
/* constrain aspect ratio, according to:
*
- * width
+ * width
* min_aspect <= -------- <= max_aspect
- * height
+ * height
*/
-
+
if (flags & GDK_HINT_ASPECT &&
geometry->min_aspect > 0 &&
geometry->max_aspect > 0)
if (height - delta >= min_height)
height -= delta;
else
- {
+ {
delta = FLOOR (height * geometry->min_aspect - width, xinc);
- if (width + delta <= max_width)
+ if (width + delta <= max_width)
width += delta;
}
}
-
+
if (geometry->max_aspect * height < width)
{
delta = FLOOR (width - height * geometry->max_aspect, xinc);
- if (width - delta >= min_width)
+ if (width - delta >= min_width)
width -= delta;
else
{
}
#undef FLOOR
-
+
*new_width = width;
*new_height = height;
}
* modifier mask
*
* Obtains the current pointer position and modifier state.
- * The position is given in coordinates relative to the upper left
+ * The position is given in coordinates relative to the upper left
* corner of @window.
- *
+ *
* Return value: the window containing the pointer (as with
* gdk_window_at_pointer()), or %NULL if the window containing the
* pointer isn't known to GDK
gint tmp_x, tmp_y;
GdkModifierType tmp_mask;
GdkWindow *child;
-
+
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (window)
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"));
*mask = tmp_mask;
_gdk_display_enable_motion_hints (display);
-
+
return child;
}
* gdk_window_at_pointer:
* @win_x: return location for origin of the window under the pointer
* @win_y: return location for origin of the window under the pointer
- *
+ *
* 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 (if the window
*
* NOTE: For multihead-aware widgets or applications use
* gdk_display_get_window_at_pointer() instead.
- *
+ *
* Return value: window under the mouse pointer
**/
GdkWindow*
/**
* gdk_get_default_root_window:
- *
+ *
* Obtains the root window (parent all other windows are inside)
* for the default display and screen.
- *
+ *
* Return value: the default root window
**/
GdkWindow *
/**
* gdk_window_foreign_new:
* @anid: a native window handle.
- *
+ *
* Wraps a native window for the default display in a #GdkWindow.
* This may fail if the window has been destroyed.
*
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
- *
- * Return value: the newly-created #GdkWindow wrapper for the
+ *
+ * Return value: the newly-created #GdkWindow wrapper for the
* native window or %NULL if the window has been destroyed.
**/
GdkWindow *
{
GdkWindowObject *child;
GList *l;
-
+
for (l = private->children; l != NULL; l = l->next)
{
child = l->data;
for (l = native_children; l != NULL; l = l->next)
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->raise (l->data);
}
-
+
g_list_free (native_children);
}
-
+
}
}
{
GdkWindowObject *child;
GList *l;
-
+
for (l = private->children; l != NULL; l = l->next)
{
child = l->data;
if (GDK_WINDOW_IS_MAPPED (child))
show_all_visible_impls (child);
}
-
+
if (gdk_window_has_impl (private))
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->show ((GdkWindow *)private);
}
return;
was_mapped = GDK_WINDOW_IS_MAPPED (window);
-
+
if (raise)
/* Keep children in (reverse) stacking order */
gdk_window_raise_internal (window);
if (gdk_window_is_viewable (window))
show_all_visible_impls (private);
-
+
if (!was_mapped)
{
if (private->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (private), GDK_MAP, NULL, FALSE);
-
+
if (private->parent && private->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (private), GDK_MAP, NULL, FALSE);
}
for (l = native_children; l != NULL; l = l->next)
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->raise (l->data);
}
-
+
g_list_free (native_children);
}
-
+
}
}
if (private->parent == NULL ||
GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
return;
-
+
/* get the visible rectangle of the parent */
r.x = r.y = 0;
r.width = private->parent->width;
gdk_window_lower_internal (window);
recompute_visible_regions (private, TRUE, FALSE);
-
+
_gdk_syntesize_crossing_events_for_geometry_change (window);
gdk_window_invalidate_in_parent (private);
}
{
GdkWindowObject *child;
GList *l;
-
+
for (l = private->children; l != NULL; l = l->next)
{
child = l->data;
-
+
if (GDK_WINDOW_IS_MAPPED (child))
hide_all_visible_impls (child);
}
-
+
if (gdk_window_has_impl (private))
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->hide ((GdkWindow *)private);
}
was_mapped = GDK_WINDOW_IS_MAPPED (private);
was_viewable = gdk_window_is_viewable (window);
-
+
if (gdk_window_has_impl (private))
{
if (GDK_WINDOW_IS_MAPPED (window))
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_WITHDRAWN);
+ gdk_synthesize_window_state (window,
+ 0,
+ GDK_WINDOW_STATE_WITHDRAWN);
}
else if (was_mapped)
{
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
}
}
-
+
private->state = GDK_WINDOW_STATE_WITHDRAWN;
}
{
if (private->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (private), GDK_UNMAP, NULL, FALSE);
-
+
if (private->parent && private->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (private), GDK_UNMAP, NULL, FALSE);
-
+
_gdk_syntesize_crossing_events_for_geometry_change (GDK_WINDOW (private->parent));
}
-
+
/* Invalidate the rect */
gdk_window_invalidate_in_parent (private);
}
return;
was_mapped = GDK_WINDOW_IS_MAPPED (private);
-
+
if (gdk_window_has_impl (private))
{
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->withdraw (window);
-
+
if (was_mapped)
{
if (private->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (private), GDK_UNMAP, NULL, FALSE);
-
+
if (private->parent && private->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_WINDOW (private), GDK_UNMAP, NULL, FALSE);
-
+
_gdk_syntesize_crossing_events_for_geometry_change (GDK_WINDOW (private->parent));
}
-
+
recompute_visible_regions (private, TRUE, FALSE);
}
}
{
GdkWindowObject *private;
GdkDisplay *display;
-
+
g_return_if_fail (GDK_IS_WINDOW (window));
if ((private->event_mask & GDK_POINTER_MOTION_HINT_MASK) &&
!(event_mask & GDK_POINTER_MOTION_HINT_MASK))
_gdk_display_enable_motion_hints (display);
-
+
private->event_mask = event_mask;
if (gdk_window_has_impl (private))
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->set_events (window,
get_native_event_mask (private));
-
+
}
/**
old_y = private->y;
is_resize = (width != -1) || (height != -1);
-
+
if (GDK_WINDOW_IS_MAPPED (window) &&
!private->input_only)
{
expose = TRUE;
old_region = gdk_region_copy (private->clip_region);
}
-
+
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->move_resize (window, with_move, x, y, width, height);
dx = private->x - old_x;
dy = private->y - old_y;
-
+
old_abs_x = private->abs_x;
old_abs_y = private->abs_y;
/* Avoid recomputing for pure toplevel moves, for performance reasons */
if (is_resize)
recompute_visible_regions (private, TRUE, FALSE);
-
+
if (expose)
{
new_region = gdk_region_copy (private->clip_region);
-
+
/* This is the newly exposed area (due to any resize),
* X will expose it, but lets do that without the
* roundtrip
*/
gdk_region_subtract (new_region, old_region);
gdk_window_invalidate_region (window, new_region, TRUE);
-
+
gdk_region_destroy (old_region);
gdk_region_destroy (new_region);
}
{
GList *l;
GdkWindowObject *child;
-
+
for (l = private->children; l; l = l->next)
{
child = l->data;
-
+
if (child->impl != private->impl)
GDK_WINDOW_IMPL_GET_IFACE (child->impl)->move_resize ((GdkWindow *)child, TRUE, child->x, child->y, child->width, child->height);
else
GdkWindowObject *child;
GdkRegion *tmp;
GList *l;
-
+
for (l = window->children; l != NULL; l = l->next)
{
child = l->data;
x_offset + child->x,
y_offset + child->y);
}
-
+
return FALSE;
}
gboolean include_this)
{
GdkRegion *region;
-
+
if (include_this && gdk_window_has_impl (window))
return gdk_region_copy (window->clip_region);
region = NULL;
-
+
collect_native_child_region_helper (window, window->impl, ®ion, 0, 0);
-
+
return region;
}
}
/* Handle child windows */
-
+
expose = FALSE;
old_region = NULL;
!private->input_only)
{
expose = TRUE;
-
+
old_region = gdk_region_copy (private->clip_region);
/* Adjust region to parent window coords */
gdk_region_offset (old_region, private->x, private->y);
{
/* Adjust region to parent window coords */
gdk_region_offset (old_native_child_region, private->x, private->y);
-
+
/* Any native window move will immediately copy stuff to the destination, which may overwrite a
* source or destination for a delayed GdkWindowRegionMove. So, we need
* to flush those here for the parent window and all overlapped subwindows
*/
gdk_window_flush_recursive (private->parent);
}
-
+
/* Set the new position and size */
if (with_move)
{
height = 1;
private->height = height;
}
-
+
dx = private->x - old_x;
dy = private->y - old_y;
-
+
old_abs_x = private->abs_x;
old_abs_y = private->abs_y;
/* Adjust region to parent window coords */
gdk_region_offset (new_native_child_region, private->x, private->y);
}
-
+
if (gdk_window_has_impl (private))
{
/* Do the actual move after recomputing things, as this will have set the shape to
else if (old_abs_x != private->abs_x ||
old_abs_y != private->abs_y)
move_native_children (private);
-
+
if (expose)
{
new_region = gdk_region_copy (private->clip_region);
*
* new_region:
* Everything in the old and new regions that is not copied must be
- * invalidated (including children) as this is newly exposed
+ * invalidated (including children) as this is newly exposed
*/
copy_area = gdk_region_copy (new_region);
-
+
gdk_region_union (new_region, old_region);
if (old_native_child_region)
gdk_region_offset (new_native_child_region, dx, dy);
gdk_region_subtract (copy_area, new_native_child_region);
}
-
+
gdk_region_subtract (new_region, copy_area);
/* Convert old region to impl coords */
gdk_region_destroy (old_native_child_region);
gdk_region_destroy (new_native_child_region);
}
-
+
_gdk_syntesize_crossing_events_for_geometry_change (window);
}
gdk_window_flush_recursive (private);
}
-
+
/* First move all child windows, without causing invalidation */
-
+
tmp_list = private->children;
while (tmp_list)
{
GdkWindow *child = GDK_WINDOW (tmp_list->data);
GdkWindowObject *child_obj = GDK_WINDOW_OBJECT (child);
-
+
/* Just update the positions, the bits will move with the copy */
child_obj->x += dx;
child_obj->y += dy;
-
+
tmp_list = tmp_list->next;
}
new_native_child_region = NULL;
if (old_native_child_region)
new_native_child_region = collect_native_child_region (private, FALSE);
-
+
move_native_children (private);
-
+
/* Then copy the actual bits of the window w/ child windows */
-
+
impl_window = gdk_window_get_impl_window (private);
/* Calculate the area that can be gotten by copying the old area */
* the native window move.
*/
gdk_region_subtract (copy_area, old_native_child_region);
-
+
/* Don't copy any bits that would cause a read from the moved
native windows, as we can't read that data */
gdk_region_subtract (copy_area, new_native_child_region);
gdk_region_offset (copy_area, private->abs_x, private->abs_y);
move_region_on_impl (impl_window, copy_area, dx, dy); /* takes ownership of copy_area */
-
+
/* Invalidate not copied regions */
gdk_window_invalidate_region (window, noncopy_area, TRUE);
gdk_region_destroy (old_native_child_region);
gdk_region_destroy (new_native_child_region);
}
-
+
_gdk_syntesize_crossing_events_for_geometry_change (window);
}
return;
impl_window = gdk_window_get_impl_window (private);
-
+
/* compute source regions */
copy_area = gdk_region_copy (region);
gdk_region_intersect (copy_area, private->clip_region_with_children);
/* convert from window coords to impl */
gdk_region_offset (copy_area, private->abs_x, private->abs_y);
-
+
move_region_on_impl (impl_window, copy_area, dx, dy); /* Takes ownership of copy_area */
}
g_return_if_fail (GDK_IS_WINDOW (window));
private = (GdkWindowObject *) window;
-
+
private->bg_color = *color;
gdk_colormap_query_color (colormap, private->bg_color.pixel, &private->bg_color);
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG)
g_object_unref (private->bg_pixmap);
-
+
private->bg_pixmap = NULL;
if (!GDK_WINDOW_DESTROYED (window) &&
g_warning ("gdk_window_set_back_pixmap(): pixmap must have a colormap");
return;
}
-
+
if (private->bg_pixmap &&
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG)
private->bg_pixmap = g_object_ref (pixmap);
else
private->bg_pixmap = GDK_NO_BG;
-
+
if (!GDK_WINDOW_DESTROYED (window) &&
gdk_window_has_impl (private) &&
!private->input_only)
{
GdkWindowObject *pointer_window, *cursor_window;
GdkPointerGrabInfo *grab;
-
+
pointer_window = (GdkWindowObject *)display->pointer_info.window_under_pointer;
-
+
cursor_window = pointer_window;
while (cursor_window->cursor == NULL &&
cursor_window->parent != NULL &&
* @window: a #GdkWindow
* @cursor: a cursor
*
- * Sets the mouse pointer for a #GdkWindow. Use gdk_cursor_new_for_display()
- * or gdk_cursor_new_from_pixmap() to create the cursor. To make the cursor
- * invisible, use %GDK_BLANK_CURSOR. Passing %NULL for the @cursor argument
- * to gdk_window_set_cursor() means that @window will use the cursor of its
+ * Sets the mouse pointer for a #GdkWindow. Use gdk_cursor_new_for_display()
+ * or gdk_cursor_new_from_pixmap() to create the cursor. To make the cursor
+ * invisible, use %GDK_BLANK_CURSOR. Passing %NULL for the @cursor argument
+ * to gdk_window_set_cursor() means that @window will use the cursor of its
* parent window. Most windows should use this default.
*/
void
{
GDK_NOTE (MULTIHEAD,
g_message ("gdk_window_get_geometry(): Window needs "
- "to be non-NULL to be multi head safe"));
+ "to be non-NULL to be multi head safe"));
window = gdk_screen_get_root_window ((gdk_screen_get_default ()));
}
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
private = (GdkWindowObject *) window;
-
+
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_origin (window, x, y);
if (x)
*x += private->abs_x;
if (y)
*y += private->abs_y;
-
+
return TRUE;
}
* @window: a toplevel #GdkWindow
* @x: return location for X coordinate
* @y: return location for Y coordinate
- *
+ *
* This gets the origin of a #GdkWindow relative to
* an Enlightenment-window-manager desktop. As long as you don't
* assume that the user's desktop/workspace covers the entire
* root window (i.e. you don't assume that the desktop begins
* at root window coordinate 0,0) this function is not necessary.
* It's deprecated for that reason.
- *
+ *
* Return value: not meaningful
**/
gboolean
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject *) window;
-
+
if (!GDK_WINDOW_DESTROYED (window))
{
return_val = GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_deskrelative_origin (window, &tx, &ty);
-
+
if (x)
*x = tx + private->abs_x;
if (y)
*y = ty + private->abs_y;
}
-
+
return return_val;
}
gdk_window_shape_combine_mask (GdkWindow *window,
GdkBitmap *mask,
gint x,
- gint y)
+ gint y)
{
GdkWindowObject *private;
GdkRegion *region;
*/
void
gdk_window_shape_combine_region (GdkWindow *window,
- const GdkRegion *shape_region,
- gint offset_x,
- gint offset_y)
+ const GdkRegion *shape_region,
+ gint offset_x,
+ gint offset_y)
{
GdkWindowObject *private;
GdkRegion *old_region, *new_region, *diff;
if (private->shape)
gdk_region_destroy (private->shape);
-
+
old_region = NULL;
if (GDK_WINDOW_IS_MAPPED (window))
old_region = gdk_region_copy (private->clip_region);
if (shape_region)
{
private->shape = gdk_region_copy (shape_region);
- gdk_region_offset (private->shape, offset_x, offset_y);
+ gdk_region_offset (private->shape, offset_x, offset_y);
}
else
private->shape = NULL;
-
+
recompute_visible_regions (private, TRUE, FALSE);
if (old_region)
/* New area in the non-root parent window, needs invalidation */
diff = gdk_region_copy (old_region);
gdk_region_subtract (diff, new_region);
-
+
/* Adjust region to parent window coords */
gdk_region_offset (diff, private->x, private->y);
-
+
gdk_window_invalidate_region (GDK_WINDOW (private->parent), diff, TRUE);
-
+
gdk_region_destroy (diff);
}
GdkRegion *region;
private = (GdkWindowObject *) window;
-
+
r.x = 0;
r.y = 0;
r.width = private->width;
r.height = private->height;
-
+
region = gdk_region_rectangle (&r);
remove_child_area (private, NULL, FALSE, region);
if (merge && private->shape)
gdk_region_subtract (region, private->shape);
-
+
gdk_window_shape_combine_region (window, region, 0, 0);
}
* @mask: shape mask
* @x: X position of shape mask with respect to @window
* @y: Y position of shape mask with respect to @window
- *
+ *
* Like gdk_window_shape_combine_mask(), but the shape applies
* only to event handling. Mouse events which happen while
- * the pointer position corresponds to an unset bit in the
+ * the pointer position corresponds to an unset bit in the
* mask will be passed on the window below @window.
*
* An input shape is typically used with RGBA windows.
- * The alpha channel of the window defines which pixels are
+ * The alpha channel of the window defines which pixels are
* invisible and allows for nicely antialiased borders,
* and the input shape controls where the window is
* "clickable".
*
* Since: 2.10
*/
-void
+void
gdk_window_input_shape_combine_mask (GdkWindow *window,
GdkBitmap *mask,
gint x,
gdk_window_input_shape_combine_region (window,
region,
x, y);
-
+
gdk_region_destroy (region);
}
* @shape_region: region of window to be non-transparent
* @offset_x: X position of @shape_region in @window coordinates
* @offset_y: Y position of @shape_region in @window coordinates
- *
+ *
* Like gdk_window_shape_combine_region(), but the shape applies
* only to event handling. Mouse events which happen while
- * the pointer position corresponds to an unset bit in the
+ * the pointer position corresponds to an unset bit in the
* mask will be passed on the window below @window.
*
* An input shape is typically used with RGBA windows.
- * The alpha channel of the window defines which pixels are
+ * The alpha channel of the window defines which pixels are
* invisible and allows for nicely antialiased borders,
* and the input shape controls where the window is
* "clickable".
*
* Since: 2.10
*/
-void
+void
gdk_window_input_shape_combine_region (GdkWindow *window,
const GdkRegion *shape_region,
gint offset_x,
if (shape_region)
{
private->input_shape = gdk_region_copy (shape_region);
- gdk_region_offset (private->input_shape, offset_x, offset_y);
+ gdk_region_offset (private->input_shape, offset_x, offset_y);
}
else
private->input_shape = NULL;
GdkRegion *region;
private = (GdkWindowObject *) window;
-
+
r.x = 0;
r.y = 0;
r.width = private->width;
r.height = private->height;
-
+
region = gdk_region_rectangle (&r);
remove_child_area (private, NULL, TRUE, region);
gdk_region_subtract (region, private->shape);
if (merge && private->input_shape)
gdk_region_subtract (region, private->input_shape);
-
+
gdk_window_input_shape_combine_region (window, region, 0, 0);
}
/**
* gdk_window_set_child_input_shapes:
* @window: a #GdkWindow
- *
+ *
* Sets the input shape mask of @window to the union of input shape masks
* for all children of @window, ignoring the input shape mask of @window
* itself. Contrast with gdk_window_merge_child_input_shapes() which includes
*
* Since: 2.10
**/
-void
+void
gdk_window_set_child_input_shapes (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
-
+
do_child_input_shapes (window, FALSE);
}
/**
* gdk_window_merge_child_input_shapes:
* @window: a #GdkWindow
- *
+ *
* Merges the input shape masks for any child windows into the
* input shape mask for @window. i.e. the union of all input masks
* for @window and its children will become the new input mask
* for @window. See gdk_window_input_shape_combine_mask().
*
* This function is distinct from gdk_window_set_child_input_shapes()
- * because it includes @window's input shape mask in the set of
+ * because it includes @window's input shape mask in the set of
* shapes to be merged.
*
* Since: 2.10
**/
-void
+void
gdk_window_merge_child_input_shapes (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
-
+
do_child_input_shapes (window, TRUE);
}
if (gdk_window_has_impl (private))
return GDK_WINDOW_IMPL_GET_IFACE (private->impl)->set_static_gravities (window, use_static);
-
+
return FALSE;
}
* @window: a #GdkWindow
* @composited: %TRUE to set the window as composited
*
- * Sets a #GdkWindow as composited, or unsets it. Composited
- * windows do not automatically have their contents drawn to
- * the screen. Drawing is redirected to an offscreen buffer
- * and an expose event is emitted on the parent of the composited
+ * Sets a #GdkWindow as composited, or unsets it. Composited
+ * windows do not automatically have their contents drawn to
+ * the screen. Drawing is redirected to an offscreen buffer
+ * and an expose event is emitted on the parent of the composited
* window. It is the responsibility of the parent's expose handler
* to manually merge the off-screen content onto the screen in
* whatever way it sees fit. See <xref linkend="composited-window-example"/>
* window are also no longer clipped by the child.
*
* This call is only supported on some systems (currently,
- * only X11 with new enough Xcomposite and Xdamage extensions).
+ * only X11 with new enough Xcomposite and Xdamage extensions).
* You must call gdk_display_supports_composite() to check if
* setting a window as composited is supported before
* attempting to do so.
*/
void
gdk_window_set_composited (GdkWindow *window,
- gboolean composited)
+ gboolean composited)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkDisplay *display;
if (GDK_WINDOW_IS_MAPPED (window))
gdk_window_invalidate_in_parent (private);
-
+
private->composited = composited;
}
static void
remove_redirect_from_children (GdkWindowObject *private,
- GdkWindowRedirect *redirect)
+ GdkWindowRedirect *redirect)
{
GList *l;
GdkWindowObject *child;
static void
apply_redirect_to_children (GdkWindowObject *private,
- GdkWindowRedirect *redirect)
+ GdkWindowRedirect *redirect)
{
GList *l;
GdkWindowObject *child;
gdk_window_redirect_to_drawable (GdkWindow *window,
GdkDrawable *drawable,
gint src_x,
- gint src_y,
+ gint src_y,
gint dest_x,
- gint dest_y,
+ gint dest_y,
gint width,
- gint height)
+ gint height)
{
GdkWindowObject *private;
if (height == -1)
height = h;
}
-
+
private->redirect = g_new0 (GdkWindowRedirect, 1);
private->redirect->redirected = private;
private->redirect->pixmap = g_object_ref (drawable);
static void
window_get_size_rectangle (GdkWindow *window,
- GdkRectangle *rect)
+ GdkRectangle *rect)
{
GdkWindowObject *private = (GdkWindowObject *) window;
-
+
rect->x = rect->y = 0;
rect->width = private->width;
rect->height = private->height;
*base_x_offset = 0;
if (base_y_offset)
*base_y_offset = 0;
-
+
if (!GDK_WINDOW_IS_MAPPED (window) || private->input_only)
return gdk_region_new ();
parentwin = lastwin;
else
parentwin = lastwin->parent;
-
+
/* Remove the areas of all overlapping windows above parentwin in the hiearachy */
for (; parentwin != NULL &&
- (parentwin == private || lastwin != (GdkWindowObject*) base_window);
+ (parentwin == private || lastwin != (GdkWindowObject*) base_window);
lastwin = parentwin, parentwin = lastwin->parent)
{
GList *cur;
/* children is ordered in reverse stack order */
for (cur = parentwin->children;
- cur && cur->data != lastwin;
- cur = cur->next)
+ cur && cur->data != lastwin;
+ cur = cur->next)
{
GdkWindow *child = cur->data;
GdkWindowObject *child_private = (GdkWindowObject *)child;
if (!GDK_WINDOW_IS_MAPPED (child) || child_private->input_only)
continue;
- /* Ignore offscreen children, as they don't draw in their parent and
+ /* Ignore offscreen children, as they don't draw in their parent and
* don't take part in the clipping */
if (gdk_window_is_offscreen (child_private))
continue;
- window_get_size_rectangle (child, &visible_rect);
+ window_get_size_rectangle (child, &visible_rect);
/* Convert rect to "window" coords */
visible_rect.x += child_private->x - x_offset;
visible_rect.y += child_private->y - y_offset;
-
+
/* This shortcut is really necessary for performance when there are a lot of windows */
gdk_region_get_clipbox (real_clip_region, &real_clip_rect);
if (visible_rect.x >= real_clip_rect.x + real_clip_rect.width ||
visible_rect.y >= real_clip_rect.y + real_clip_rect.height ||
visible_rect.y + visible_rect.height <= real_clip_rect.y)
continue;
-
+
tmpreg = gdk_region_rectangle (&visible_rect);
gdk_region_subtract (real_clip_region, tmpreg);
gdk_region_destroy (tmpreg);
}
-
+
/* Clip to the parent */
window_get_size_rectangle ((GdkWindow *)parentwin, &visible_rect);
/* Convert rect to "window" coords */
visible_rect.x += - x_offset;
visible_rect.y += - y_offset;
-
+
tmpreg = gdk_region_rectangle (&visible_rect);
gdk_region_intersect (real_clip_region, tmpreg);
gdk_region_destroy (tmpreg);
y += private->y;
private = private->parent;
}
-
+
*toplevel_x = x;
*toplevel_y = y;
-
+
return (GdkWindow *)private;
}
GList *children, *l;
private = GDK_WINDOW_OBJECT (window);
-
+
x = toplevel_x;
y = toplevel_y;
for (l = children; l != NULL; l = l->next)
convert_coords_to_child (l->data, x, y, &x, &y);
-
+
g_list_free (children);
-
+
*window_x = x;
*window_y = y;
}
GList *l;
private = (GdkWindowObject *)toplevel;
-
+
if (point_in_window (private, x, y))
{
- do
+ do
{
/* Children is ordered in reverse stack order, i.e. first is topmost */
for (l = private->children; l != NULL; l = l->next)
{
sub = l->data;
- if (!GDK_WINDOW_IS_MAPPED (sub))
- continue;
-
+ if (!GDK_WINDOW_IS_MAPPED (sub))
+ continue;
+
convert_coords_to_child (sub,
x, y,
&child_x, &child_y);
*found_x = x;
if (found_y)
*found_y = y;
-
+
return (GdkWindow *)private;
}
/* send motion events if the right buttons are down */
static guint
update_evmask_for_button_motion (guint evmask,
- GdkModifierType mask)
+ GdkModifierType mask)
{
if (evmask & GDK_BUTTON_MOTION_MASK &&
mask & (GDK_BUTTON1_MASK |
is_button_type (GdkEventType type)
{
return type == GDK_BUTTON_PRESS ||
- type == GDK_2BUTTON_PRESS ||
- type == GDK_3BUTTON_PRESS ||
- type == GDK_BUTTON_RELEASE ||
- type == GDK_SCROLL;
+ type == GDK_2BUTTON_PRESS ||
+ type == GDK_3BUTTON_PRESS ||
+ type == GDK_BUTTON_RELEASE ||
+ type == GDK_SCROLL;
}
static gboolean
is_motion_type (GdkEventType type)
{
return type == GDK_MOTION_NOTIFY ||
- type == GDK_ENTER_NOTIFY ||
- type == GDK_LEAVE_NOTIFY;
+ type == GDK_ENTER_NOTIFY ||
+ type == GDK_LEAVE_NOTIFY;
}
static GdkWindowObject *
GdkEvent *event;
guint32 event_mask;
GdkPointerGrabInfo *grab;
-
+
grab = _gdk_display_has_pointer_grab (display, serial);
-
+
if (grab != NULL &&
!grab->owner_events &&
(GdkWindow *)window != grab->window)
return;
-
+
if (type == GDK_LEAVE_NOTIFY)
event_mask = GDK_LEAVE_NOTIFY_MASK;
else
event->crossing.state = mask;
}
}
-
+
/* The coordinates are in the toplevel window that src/dest are in.
* src and dest are always (if != NULL) in the same toplevel, as
GdkNotifyType notify_type;
/* TODO: Don't send events to toplevel, as we get those from the windowing system */
-
+
a = (GdkWindowObject *)src;
b = (GdkWindowObject *)dest;
if (a == b)
if (a) /* There might not be a source (i.e. if no previous pointer_in_window) */
{
toplevel = (GdkWindowObject *)gdk_window_get_toplevel ((GdkWindow *)a);
-
+
/* Traverse up from a to (excluding) c sending leave events */
if (non_linear)
notify_type = GDK_NOTIFY_NONLINEAR;
mask, time_,
event_in_queue,
serial);
-
+
if (c != a)
{
if (non_linear)
notify_type = GDK_NOTIFY_NONLINEAR_VIRTUAL;
else
notify_type = GDK_NOTIFY_VIRTUAL;
-
+
last = a;
win = a->parent;
while (win != c && GDK_WINDOW_TYPE (win) != GDK_WINDOW_ROOT)
mask, time_,
event_in_queue,
serial);
-
+
last = win;
win = win->parent;
}
if (b) /* Might not be a dest, e.g. if we're moving out of the window */
{
toplevel = (GdkWindowObject *)gdk_window_get_toplevel ((GdkWindow *)b);
-
+
/* Traverse down from c to b */
if (c != b)
{
path = g_list_prepend (path, win);
win = win->parent;
}
-
+
if (non_linear)
notify_type = GDK_NOTIFY_NONLINEAR_VIRTUAL;
else
notify_type = GDK_NOTIFY_VIRTUAL;
-
+
list = path;
while (list)
{
notify_type = GDK_NOTIFY_ANCESTOR;
else
notify_type = GDK_NOTIFY_INFERIOR;
-
+
send_crossing_event (display, toplevel,
b, GDK_ENTER_NOTIFY,
mode,
get_toplevel (GdkWindow *w)
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (w);
-
+
while (private->parent != NULL &&
(GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT))
private = private->parent;
!grab->owner_events &&
pointer_window != grab->window)
pointer_window = NULL;
-
+
return pointer_window;
}
gulong serial;
display = gdk_drawable_get_display (changed_window);
-
+
serial = _gdk_windowing_window_get_next_serial (display);
changed_toplevel = get_toplevel (changed_window);
-
+
if (changed_toplevel == display->pointer_info.toplevel_under_pointer)
{
new_window_under_pointer =
evmask = update_evmask_for_button_motion (evmask, mask);
grab_window = grab->window;
-
+
if (evmask & type_masks[type])
{
if (evmask_out)
state, time_,
source_event,
serial);
-
+
_gdk_display_set_window_under_pointer (display, NULL);
return TRUE;
}
-
+
pointer_window = get_pointer_window (display, toplevel_window,
toplevel_x, toplevel_y, serial);
-
+
if (((source_event->type == GDK_ENTER_NOTIFY &&
source_event->crossing.detail == GDK_NOTIFY_INFERIOR) ||
(source_event->type == GDK_LEAVE_NOTIFY &&
state, time_,
source_event,
serial);
-
+
/* Send enter events from event window to pointer_window */
_gdk_syntesize_crossing_events (display,
event_window,
{
/* Either a toplevel crossing notify that ended up inside a child window,
or a motion notify that got into another child window */
-
+
/* Different than last time, send crossing events */
_gdk_syntesize_crossing_events (display,
display->pointer_info.window_under_pointer,
serial);
is_hint = FALSE;
-
+
if (event_win &&
(evmask & GDK_POINTER_MOTION_HINT_MASK))
{
display->pointer_info.motion_hint_serial = G_MAXULONG;
}
}
-
+
if (event_win && !display->ignore_core_events)
{
event = _gdk_make_event (event_win, GDK_MOTION_NOTIFY, source_event, FALSE);
}
#define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
- GDK_BUTTON2_MASK | \
- GDK_BUTTON3_MASK | \
- GDK_BUTTON4_MASK | \
- GDK_BUTTON5_MASK)
+ GDK_BUTTON2_MASK | \
+ GDK_BUTTON3_MASK | \
+ GDK_BUTTON4_MASK | \
+ GDK_BUTTON5_MASK)
static gboolean
proxy_button_event (GdkEvent *source_event,
pointer_window = get_pointer_window (display, toplevel_window,
toplevel_x, toplevel_y,
serial);
-
+
event_win = get_event_window (display,
pointer_window,
type, state,
if (event_win == NULL || display->ignore_core_events)
return TRUE;
-
+
event = _gdk_make_event (event_win, type, source_event, FALSE);
-
+
switch (type)
{
case GDK_BUTTON_PRESS:
event->button.y_root = source_event->button.y_root;
event->button.state = state;
event->button.device = source_event->button.device;
-
+
if (type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
return TRUE;
-
+
case GDK_SCROLL:
event->scroll.direction = source_event->scroll.direction;
convert_toplevel_coords_to_window (event_win,
event->scroll.state = state;
event->scroll.device = source_event->scroll.device;
return TRUE;
-
+
default:
return FALSE;
}
int indent)
{
GdkRectangle r;
-
+
g_print ("%*s%p: [%s] %d,%d %dx%d", indent, "", window,
window->user_data ? g_type_name_from_instance (window->user_data) : "no widget",
window->x, window->y,
g_print (" impl(0x%lx)", gdk_x11_drawable_get_xid (GDK_DRAWABLE (window)));
#endif
}
-
+
if (window->input_only)
g_print (" input-only");
if (!gdk_window_is_visible ((GdkWindow *)window))
g_print (" hidden");
-
+
g_print (" abs[%d,%d]",
window->abs_x, window->abs_y);
-
+
gdk_region_get_clipbox (window->clip_region, &r);
if (gdk_region_empty (window->clip_region))
g_print (" clipbox[empty]");
else
g_print (" clipbox[%d,%d %dx%d]", r.x, r.y, r.width, r.height);
-
+
g_print ("\n");
}
if (private->input_only && !include_input_only)
return;
-
+
gdk_window_print (private, indent);
for (l = private->children; l != NULL; l = l->next)
if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
display->last_event_time = gdk_event_get_time (event);
-
+
_gdk_display_pointer_grab_update (display,
serial);
-
+
event_window = event->any.window;
if (!event_window)
return;
-
+
event_private = GDK_WINDOW_OBJECT (event_window);
-#ifdef DEBUG_WINDOW_PRINTING
+#ifdef DEBUG_WINDOW_PRINTING
if (event->type == GDK_KEY_PRESS &&
(event->key.keyval == 0xa7 ||
event->key.keyval == 0xbd))
is_toplevel =
event_private->parent == NULL ||
GDK_WINDOW_TYPE (event_private->parent) == GDK_WINDOW_ROOT;
-
+
if ((event->type == GDK_ENTER_NOTIFY ||
event->type == GDK_LEAVE_NOTIFY) &&
(event->crossing.mode == GDK_CROSSING_GRAB ||
* so we ignore the native ones caused by our native pointer_grab
* calls. Otherwise we would proxy these crossing event and cause
* multiple copies of crossing events for grabs.
- *
+ *
* We do want to handle grabs from other clients though, as for
* instance alt-tab in metacity causes grabs like these and
* we want to handle those. Thus the has_pointer_grab check.
- *
+ *
* Implicit grabs on child windows create some grabbing events
* that are sent before the button press. This means we can't
* detect these with the has_pointer_grab check (as the implicit
* grab is only noticed when we get button press event), so we
- * detect these events by checking for INFERIOR enter or leave
+ * detect these events by checking for INFERIOR enter or leave
* events. These should never be a problem to filter out.
*/
g_object_unref (display->pointer_info.toplevel_under_pointer);
display->pointer_info.toplevel_under_pointer = g_object_ref (event_window);
}
-
+
unlink_event = TRUE;
goto out;
}
-
+
/* Track toplevel_under_pointer */
if (is_toplevel)
{
/* Store last pointer window and position/state */
old_state = display->pointer_info.state;
old_button = display->pointer_info.button;
-
+
gdk_event_get_coords (event, &x, &y);
convert_coords_to_toplevel (event_window, x, y, &x, &y);
display->pointer_info.toplevel_x = x;
if (display->pointer_info.state != old_state ||
display->pointer_info.button != old_button)
_gdk_display_enable_motion_hints (display);
-
+
unlink_event = FALSE;
if (is_motion_type (event->type))
unlink_event = proxy_pointer_event (display,
- event,
+ event,
serial);
else if (is_button_type (event->type))
unlink_event = proxy_button_event (event,