gdk_window_set_composited
gdk_pointer_grab
gdk_window_beep
-gdk_window_set_has_offscreen_children
-gdk_window_get_has_offscreen_children
-gdk_window_offscreen_children_changed
+gdk_window_geometry_changed
gdk_window_ensure_native
#endif
#endif
#if IN_HEADER(__GDK_WINDOW_H__)
#if IN_FILE(__GDK_OFFSCREEN_WINDOW_C__)
-gdk_window_get_offscreen_pixmap
+gdk_offscreen_window_get_pixmap
+gdk_offscreen_window_set_embedder
+gdk_offscreen_window_get_embedder
#endif
#endif
}
}
-static GdkWindow *
-gdk_window_get_offscreen_parent (GdkWindow *window)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindow *res;
-
- res = NULL;
- g_signal_emit_by_name (private->impl_window,
- "get-offscreen-parent",
- &res);
-
- return res;
-}
-
/* Gets the toplevel for a window as used for events,
i.e. including offscreen parents */
static GdkWindowObject *
get_event_parent (GdkWindowObject *window)
{
- if (window->window_type ==GDK_WINDOW_OFFSCREEN)
- return (GdkWindowObject *)gdk_window_get_offscreen_parent ((GdkWindow *)window);
+ if (window->window_type == GDK_WINDOW_OFFSCREEN)
+ return (GdkWindowObject *)gdk_offscreen_window_get_embedder ((GdkWindow *)window);
else
return window->parent;
}
guint effective_visibility : 2;
guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
guint native_visibility : 2; /* the native visibility of a impl windows */
- guint has_offscreen_children : 1;
+ guint num_offscreen_children;
GdkWindowPaint *implicit_paint;
GdkInputWindow *input_window; /* only set for impl windows */
GdkScreen *screen;
GdkPixmap *pixmap;
+ GdkWindow *embedder;
};
struct _GdkOffscreenWindowClass
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
+ gdk_offscreen_window_set_embedder (window, NULL);
+
if (!recursing)
gdk_offscreen_window_hide (window);
return was_mapped;
}
-
-static GdkWindow *
-get_offscreen_parent (GdkWindow *window)
-{
- GdkWindowObject *private;
- GdkWindow *res;
-
- private = (GdkWindowObject *)window;
-
- res = NULL;
- g_signal_emit_by_name (private->impl_window,
- "get-offscreen-parent",
- &res);
-
- return res;
-}
-
static void
-from_parent (GdkWindow *window,
- double parent_x, double parent_y,
- double *offscreen_x, double *offscreen_y)
+from_embedder (GdkWindow *window,
+ double embedder_x, double embedder_y,
+ double *offscreen_x, double *offscreen_y)
{
GdkWindowObject *private;
private = (GdkWindowObject *)window;
g_signal_emit_by_name (private->impl_window,
- "from_parent",
- parent_x, parent_y,
+ "from-embedder",
+ embedder_x, embedder_y,
offscreen_x, offscreen_y,
NULL);
}
static void
-to_parent (GdkWindow *window,
- double offscreen_x, double offscreen_y,
- double *parent_x, double *parent_y)
+to_embedder (GdkWindow *window,
+ double offscreen_x, double offscreen_y,
+ double *embedder_x, double *embedder_y)
{
GdkWindowObject *private;
private = (GdkWindowObject *)window;
g_signal_emit_by_name (private->impl_window,
- "to_parent",
+ "to-embedder",
offscreen_x, offscreen_y,
- parent_x, parent_y,
+ embedder_x, embedder_y,
NULL);
}
gint *root_x,
gint *root_y)
{
- GdkWindow *parent;
+ GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
+ GdkOffscreenWindow *offscreen;
int tmpx, tmpy;
tmpx = x;
tmpy = y;
- parent = get_offscreen_parent (window);
- if (parent)
+ offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
+ if (offscreen->embedder)
{
double dx, dy;
- to_parent (window,
- x, y,
- &dx, &dy);
+ to_embedder (window,
+ x, y,
+ &dx, &dy);
tmpx = floor (dx + 0.5);
tmpy = floor (dy + 0.5);
- gdk_window_get_root_coords (parent,
+ gdk_window_get_root_coords (offscreen->embedder,
tmpx, tmpy,
&tmpx, &tmpy);
gint *x,
gint *y)
{
- GdkWindow *parent;
+ GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
+ GdkOffscreenWindow *offscreen;
int tmpx, tmpy;
tmpx = 0;
tmpy = 0;
- parent = get_offscreen_parent (window);
- if (parent)
+ offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
+ if (offscreen->embedder)
{
double dx, dy;
- gdk_window_get_deskrelative_origin (parent,
+ gdk_window_get_deskrelative_origin (offscreen->embedder,
&tmpx, &tmpy);
- to_parent (window,
- 0, 0,
- &dx, &dy);
+ to_embedder (window,
+ 0, 0,
+ &dx, &dy);
tmpx = floor (tmpx + dx + 0.5);
tmpy = floor (tmpy + dy + 0.5);
}
gint *y,
GdkModifierType *mask)
{
+ GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
+ GdkOffscreenWindow *offscreen;
int tmpx, tmpy;
double dtmpx, dtmpy;
GdkModifierType tmpmask;
- GdkWindow *parent;
tmpx = 0;
tmpy = 0;
tmpmask = 0;
- parent = get_offscreen_parent (window);
- if (parent != NULL)
+ offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
+ if (offscreen->embedder != NULL)
{
- gdk_window_get_pointer (parent, &tmpx, &tmpy, &tmpmask);
- from_parent (window,
- tmpx, tmpy,
- &dtmpx, &dtmpy);
+ gdk_window_get_pointer (offscreen->embedder, &tmpx, &tmpy, &tmpmask);
+ from_embedder (window,
+ tmpx, tmpy,
+ &dtmpx, &dtmpy);
tmpx = floor (dtmpx + 0.5);
tmpy = floor (dtmpy + 0.5);
}
}
/**
- * gdk_window_get_offscreen_pixmap:
+ * gdk_offscreen_window_get_pixmap:
* @window: a #GdkWindow
*
* Gets the offscreen pixmap that an offscreen window renders into. If
* Returns: The offscreen pixmap, or NULL if not offscreen
**/
GdkPixmap *
-gdk_window_get_offscreen_pixmap (GdkWindow *window)
+gdk_offscreen_window_get_pixmap (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
}
static void
-gdk_offscreen_window_show (GdkWindow *window)
+gdk_offscreen_window_show (GdkWindow *window,
+ gboolean already_mapped)
{
GdkWindowObject *private = (GdkWindowObject *)window;
{
}
+void
+gdk_offscreen_window_set_embedder (GdkWindow *window,
+ GdkWindow *embedder)
+{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ GdkOffscreenWindow *offscreen;
+
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ if (!GDK_IS_OFFSCREEN_WINDOW (private->impl))
+ return;
+
+ offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
+
+ if (embedder)
+ {
+ g_object_ref (embedder);
+ GDK_WINDOW_OBJECT (embedder)->num_offscreen_children++;
+ }
+
+ if (offscreen->embedder)
+ {
+ g_object_unref (offscreen->embedder);
+ GDK_WINDOW_OBJECT (offscreen->embedder)->num_offscreen_children--;
+ }
+
+ offscreen->embedder = embedder;
+}
+
+GdkWindow *
+gdk_offscreen_window_get_embedder (GdkWindow *window)
+{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ GdkOffscreenWindow *offscreen;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ if (!GDK_IS_OFFSCREEN_WINDOW (private->impl))
+ return NULL;
+
+ offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
+
+ return offscreen->embedder;
+}
static void
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
#define GDK_VISIBILITY_NOT_VIEWABLE 3
enum {
- GET_OFFSCREEN_PARENT,
- PICK_OFFSCREEN_CHILD, /* only called if has_offscreen_children */
- TO_PARENT,
- FROM_PARENT,
+ PICK_EMBEDDED_CHILD, /* only called if children are embedded */
+ TO_EMBEDDER,
+ FROM_EMBEDDER,
LAST_SIGNAL
};
GdkRegion *region, /* In impl window coords */
int dx, int dy);
static void gdk_window_invalidate_in_parent (GdkWindowObject *private);
-static GdkWindow *gdk_window_get_offscreen_parent (GdkWindow *window);
static void move_native_children (GdkWindowObject *private);
static void update_cursor (GdkDisplay *display);
static gboolean is_event_parent_of (GdkWindow *parent,
quark_pointer_window = g_quark_from_static_string ("gtk-pointer-window");
- signals[GET_OFFSCREEN_PARENT] =
- g_signal_new (g_intern_static_string ("get-offscreen-parent"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- accumulate_get_window, NULL,
- gdk_marshal_OBJECT__VOID,
- GDK_TYPE_WINDOW,
- 0);
- signals[PICK_OFFSCREEN_CHILD] =
- g_signal_new (g_intern_static_string ("pick-offscreen-child"),
+ signals[PICK_EMBEDDED_CHILD] =
+ g_signal_new (g_intern_static_string ("pick-embedded-child"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0,
2,
G_TYPE_DOUBLE,
G_TYPE_DOUBLE);
- signals[TO_PARENT] =
- g_signal_new (g_intern_static_string ("to-parent"),
+ signals[TO_EMBEDDER] =
+ g_signal_new (g_intern_static_string ("to-embedder"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0,
G_TYPE_DOUBLE,
G_TYPE_POINTER,
G_TYPE_POINTER);
- signals[FROM_PARENT] =
- g_signal_new (g_intern_static_string ("from-parent"),
+ signals[FROM_EMBEDDER] =
+ g_signal_new (g_intern_static_string ("from-embedder"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0,
static GdkWindowObject *
get_event_parent (GdkWindowObject *window)
{
- if (window->window_type ==GDK_WINDOW_OFFSCREEN)
- return (GdkWindowObject *)gdk_window_get_offscreen_parent ((GdkWindow *)window);
+ if (window->window_type == GDK_WINDOW_OFFSCREEN)
+ return (GdkWindowObject *)gdk_offscreen_window_get_embedder ((GdkWindow *)window);
else
return window->parent;
}
}
static void
-from_parent (GdkWindowObject *window,
- double parent_x, double parent_y,
- double *offscreen_x, double *offscreen_y)
+from_embedder (GdkWindowObject *window,
+ double embedder_x, double embedder_y,
+ double *offscreen_x, double *offscreen_y)
{
g_signal_emit (window,
- signals[FROM_PARENT], 0,
- parent_x, parent_y,
+ signals[FROM_EMBEDDER], 0,
+ embedder_x, embedder_y,
offscreen_x, offscreen_y,
NULL);
}
{
if (gdk_window_is_offscreen (child))
{
- from_parent (child, x, y,
- child_x, child_y);
+ from_embedder (child, x, y,
+ child_x, child_y);
}
else
{
}
static GdkWindowObject *
-pick_offscreen_child (GdkWindowObject *window,
+pick_embedded_child (GdkWindowObject *window,
double x, double y)
{
GdkWindowObject *res;
res = NULL;
g_signal_emit (window,
- signals[PICK_OFFSCREEN_CHILD], 0,
+ signals[PICK_EMBEDDED_CHILD], 0,
x, y, &res);
return res;
return (GdkWindow *)sub;
}
- if (private->has_offscreen_children)
+ if (private->num_offscreen_children > 0)
{
- sub = pick_offscreen_child (private,
- x, y);
+ sub = pick_embedded_child (private,
+ x, y);
if (sub)
return (GdkWindow *)sub;
}
}
}
if (!found &&
- private->has_offscreen_children)
+ private->num_offscreen_children > 0)
{
- sub = pick_offscreen_child (private,
- x, y);
+ sub = pick_embedded_child (private,
+ x, y);
if (sub)
{
found = TRUE;
private = sub;
- from_parent (sub, x, y, &x, &y);
+ from_embedder (sub, x, y, &x, &y);
}
}
}
_gdk_display_enable_motion_hints (display);
}
-static GdkWindow *
-gdk_window_get_offscreen_parent (GdkWindow *window)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindow *res;
-
- res = NULL;
- g_signal_emit (private->impl_window,
- signals[GET_OFFSCREEN_PARENT], 0,
- &res);
-
- return res;
-}
-
/*
*--------------------------------------------------------------
* gdk_pointer_grab
native = gdk_window_get_toplevel (window);
while (gdk_window_is_offscreen ((GdkWindowObject *)native))
{
- native = gdk_window_get_offscreen_parent (native);
+ native = gdk_offscreen_window_get_embedder (native);
if (native == NULL ||
(!_gdk_window_has_impl (native) &&
}
void
-gdk_window_set_has_offscreen_children (GdkWindow *window,
- gboolean has_offscreen_children)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- private->has_offscreen_children = !!has_offscreen_children;
-}
-
-gboolean
-gdk_window_get_has_offscreen_children (GdkWindow *window)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- return private->has_offscreen_children;
-}
-
-void
-gdk_window_offscreen_children_changed (GdkWindow *window)
+gdk_window_geometry_changed (GdkWindow *window)
{
_gdk_synthesize_crossing_events_for_geometry_change (window);
}
GdkWindow *gdk_get_default_root_window (void);
/* Offscreen redirection */
-GdkPixmap *gdk_window_get_offscreen_pixmap (GdkWindow *window);
-void gdk_window_set_has_offscreen_children (GdkWindow *window,
- gboolean has_offscreen_children);
-gboolean gdk_window_get_has_offscreen_children (GdkWindow *window);
-void gdk_window_offscreen_children_changed (GdkWindow *window);
+GdkPixmap *gdk_offscreen_window_get_pixmap (GdkWindow *window);
+void gdk_offscreen_window_set_embedder (GdkWindow *window,
+ GdkWindow *embedder);
+GdkWindow *gdk_offscreen_window_get_embedder (GdkWindow *window);
+void gdk_window_geometry_changed (GdkWindow *window);
void gdk_window_redirect_to_drawable (GdkWindow *window,
GdkDrawable *drawable,
return g_object_new (GTK_TYPE_OFFSCREEN_BOX, NULL);
}
-static GdkWindow *
-get_offscreen_parent (GdkWindow *offscreen_window,
- GtkOffscreenBox *offscreen_box)
-{
- return GTK_WIDGET (offscreen_box)->window;
-}
-
static GdkWindow *
pick_offscreen_child (GdkWindow *offscreen_window,
double widget_x, double widget_y,
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
- gdk_window_set_has_offscreen_children (widget->window, TRUE);
- g_signal_connect (widget->window, "pick-offscreen-child",
+ g_signal_connect (widget->window, "pick-embedded-child",
G_CALLBACK (pick_offscreen_child), offscreen_box);
attributes.window_type = GDK_WINDOW_OFFSCREEN;
if (offscreen_box->child1)
gtk_widget_set_parent_window (offscreen_box->child1, offscreen_box->offscreen_window1);
- g_signal_connect (offscreen_box->offscreen_window1, "get-offscreen-parent",
- G_CALLBACK (get_offscreen_parent), offscreen_box);
- g_signal_connect (offscreen_box->offscreen_window1, "to_parent",
+ gdk_offscreen_window_set_embedder (offscreen_box->offscreen_window1,
+ widget->window);
+
+ g_signal_connect (offscreen_box->offscreen_window1, "to-embedder",
G_CALLBACK (offscreen_window_to_parent1), offscreen_box);
- g_signal_connect (offscreen_box->offscreen_window1, "from_parent",
+ g_signal_connect (offscreen_box->offscreen_window1, "from-embedder",
G_CALLBACK (offscreen_window_from_parent1), offscreen_box);
/* Child 2 */
gdk_window_set_user_data (offscreen_box->offscreen_window2, widget);
if (offscreen_box->child2)
gtk_widget_set_parent_window (offscreen_box->child2, offscreen_box->offscreen_window2);
- g_signal_connect (offscreen_box->offscreen_window2, "get-offscreen-parent",
- G_CALLBACK (get_offscreen_parent), offscreen_box);
- g_signal_connect (offscreen_box->offscreen_window2, "to_parent",
+ gdk_offscreen_window_set_embedder (offscreen_box->offscreen_window2,
+ widget->window);
+ g_signal_connect (offscreen_box->offscreen_window2, "to-embedder",
G_CALLBACK (offscreen_window_to_parent2), offscreen_box);
- g_signal_connect (offscreen_box->offscreen_window2, "from_parent",
+ g_signal_connect (offscreen_box->offscreen_window2, "from-embedder",
G_CALLBACK (offscreen_window_from_parent2), offscreen_box);
widget->style = gtk_style_attach (widget->style, widget->window);
if (offscreen_box->child1 && GTK_WIDGET_VISIBLE (offscreen_box->child1))
{
- pixmap = gdk_window_get_offscreen_pixmap (offscreen_box->offscreen_window1);
+ pixmap = gdk_offscreen_window_get_pixmap (offscreen_box->offscreen_window1);
child_area = offscreen_box->child1->allocation;
cr = gdk_cairo_create (widget->window);
{
gint w, h;
- pixmap = gdk_window_get_offscreen_pixmap (offscreen_box->offscreen_window2);
+ pixmap = gdk_offscreen_window_get_pixmap (offscreen_box->offscreen_window2);
child_area = offscreen_box->child2->allocation;
cr = gdk_cairo_create (widget->window);