Clean up embedding api
we now use gdk_offscreen_window_set_embedder() instead of a signal to get the parent. This also replaces set_has_offscreen_changes. Rename "parent" in all embedding related names to "embedder" to make it more obviously different than the normal parent. Rename gdk_window_get_offscreen_pixmap to gdk_offscreen_window_get_pixmap to match the other offscreen calls. Rename gdk_window_offscreen_children_changed to gdk_window_geometry_changed as this is more descriptive.
This commit is contained in:
parent
681c3c288b
commit
10bf7ca744
@ -717,16 +717,16 @@ gdk_window_thaw_updates
|
|||||||
gdk_window_set_composited
|
gdk_window_set_composited
|
||||||
gdk_pointer_grab
|
gdk_pointer_grab
|
||||||
gdk_window_beep
|
gdk_window_beep
|
||||||
gdk_window_set_has_offscreen_children
|
gdk_window_geometry_changed
|
||||||
gdk_window_get_has_offscreen_children
|
|
||||||
gdk_window_offscreen_children_changed
|
|
||||||
gdk_window_ensure_native
|
gdk_window_ensure_native
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IN_HEADER(__GDK_WINDOW_H__)
|
#if IN_HEADER(__GDK_WINDOW_H__)
|
||||||
#if IN_FILE(__GDK_OFFSCREEN_WINDOW_C__)
|
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1070,27 +1070,13 @@ _gdk_display_pointer_grab_update (GdkDisplay *display,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
/* Gets the toplevel for a window as used for events,
|
||||||
i.e. including offscreen parents */
|
i.e. including offscreen parents */
|
||||||
static GdkWindowObject *
|
static GdkWindowObject *
|
||||||
get_event_parent (GdkWindowObject *window)
|
get_event_parent (GdkWindowObject *window)
|
||||||
{
|
{
|
||||||
if (window->window_type ==GDK_WINDOW_OFFSCREEN)
|
if (window->window_type == GDK_WINDOW_OFFSCREEN)
|
||||||
return (GdkWindowObject *)gdk_window_get_offscreen_parent ((GdkWindow *)window);
|
return (GdkWindowObject *)gdk_offscreen_window_get_embedder ((GdkWindow *)window);
|
||||||
else
|
else
|
||||||
return window->parent;
|
return window->parent;
|
||||||
}
|
}
|
||||||
|
@ -260,8 +260,8 @@ struct _GdkWindowObject
|
|||||||
guint effective_visibility : 2;
|
guint effective_visibility : 2;
|
||||||
guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
|
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 native_visibility : 2; /* the native visibility of a impl windows */
|
||||||
guint has_offscreen_children : 1;
|
|
||||||
|
|
||||||
|
guint num_offscreen_children;
|
||||||
GdkWindowPaint *implicit_paint;
|
GdkWindowPaint *implicit_paint;
|
||||||
GdkInputWindow *input_window; /* only set for impl windows */
|
GdkInputWindow *input_window; /* only set for impl windows */
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ struct _GdkOffscreenWindow
|
|||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
|
GdkWindow *embedder;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkOffscreenWindowClass
|
struct _GdkOffscreenWindowClass
|
||||||
@ -113,6 +114,8 @@ gdk_offscreen_window_destroy (GdkWindow *window,
|
|||||||
|
|
||||||
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||||
|
|
||||||
|
gdk_offscreen_window_set_embedder (window, NULL);
|
||||||
|
|
||||||
if (!recursing)
|
if (!recursing)
|
||||||
gdk_offscreen_window_hide (window);
|
gdk_offscreen_window_hide (window);
|
||||||
|
|
||||||
@ -685,26 +688,9 @@ gdk_offscreen_window_reparent (GdkWindow *window,
|
|||||||
return was_mapped;
|
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
|
static void
|
||||||
from_parent (GdkWindow *window,
|
from_embedder (GdkWindow *window,
|
||||||
double parent_x, double parent_y,
|
double embedder_x, double embedder_y,
|
||||||
double *offscreen_x, double *offscreen_y)
|
double *offscreen_x, double *offscreen_y)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private;
|
GdkWindowObject *private;
|
||||||
@ -712,25 +698,25 @@ from_parent (GdkWindow *window,
|
|||||||
private = (GdkWindowObject *)window;
|
private = (GdkWindowObject *)window;
|
||||||
|
|
||||||
g_signal_emit_by_name (private->impl_window,
|
g_signal_emit_by_name (private->impl_window,
|
||||||
"from_parent",
|
"from-embedder",
|
||||||
parent_x, parent_y,
|
embedder_x, embedder_y,
|
||||||
offscreen_x, offscreen_y,
|
offscreen_x, offscreen_y,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
to_parent (GdkWindow *window,
|
to_embedder (GdkWindow *window,
|
||||||
double offscreen_x, double offscreen_y,
|
double offscreen_x, double offscreen_y,
|
||||||
double *parent_x, double *parent_y)
|
double *embedder_x, double *embedder_y)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private;
|
GdkWindowObject *private;
|
||||||
|
|
||||||
private = (GdkWindowObject *)window;
|
private = (GdkWindowObject *)window;
|
||||||
|
|
||||||
g_signal_emit_by_name (private->impl_window,
|
g_signal_emit_by_name (private->impl_window,
|
||||||
"to_parent",
|
"to-embedder",
|
||||||
offscreen_x, offscreen_y,
|
offscreen_x, offscreen_y,
|
||||||
parent_x, parent_y,
|
embedder_x, embedder_y,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,22 +727,23 @@ gdk_offscreen_window_get_root_coords (GdkWindow *window,
|
|||||||
gint *root_x,
|
gint *root_x,
|
||||||
gint *root_y)
|
gint *root_y)
|
||||||
{
|
{
|
||||||
GdkWindow *parent;
|
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
|
||||||
|
GdkOffscreenWindow *offscreen;
|
||||||
int tmpx, tmpy;
|
int tmpx, tmpy;
|
||||||
|
|
||||||
tmpx = x;
|
tmpx = x;
|
||||||
tmpy = y;
|
tmpy = y;
|
||||||
|
|
||||||
parent = get_offscreen_parent (window);
|
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||||
if (parent)
|
if (offscreen->embedder)
|
||||||
{
|
{
|
||||||
double dx, dy;
|
double dx, dy;
|
||||||
to_parent (window,
|
to_embedder (window,
|
||||||
x, y,
|
x, y,
|
||||||
&dx, &dy);
|
&dx, &dy);
|
||||||
tmpx = floor (dx + 0.5);
|
tmpx = floor (dx + 0.5);
|
||||||
tmpy = floor (dy + 0.5);
|
tmpy = floor (dy + 0.5);
|
||||||
gdk_window_get_root_coords (parent,
|
gdk_window_get_root_coords (offscreen->embedder,
|
||||||
tmpx, tmpy,
|
tmpx, tmpy,
|
||||||
&tmpx, &tmpy);
|
&tmpx, &tmpy);
|
||||||
|
|
||||||
@ -775,20 +762,21 @@ gdk_offscreen_window_get_deskrelative_origin (GdkWindow *window,
|
|||||||
gint *x,
|
gint *x,
|
||||||
gint *y)
|
gint *y)
|
||||||
{
|
{
|
||||||
GdkWindow *parent;
|
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
|
||||||
|
GdkOffscreenWindow *offscreen;
|
||||||
int tmpx, tmpy;
|
int tmpx, tmpy;
|
||||||
|
|
||||||
tmpx = 0;
|
tmpx = 0;
|
||||||
tmpy = 0;
|
tmpy = 0;
|
||||||
|
|
||||||
parent = get_offscreen_parent (window);
|
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||||
if (parent)
|
if (offscreen->embedder)
|
||||||
{
|
{
|
||||||
double dx, dy;
|
double dx, dy;
|
||||||
gdk_window_get_deskrelative_origin (parent,
|
gdk_window_get_deskrelative_origin (offscreen->embedder,
|
||||||
&tmpx, &tmpy);
|
&tmpx, &tmpy);
|
||||||
|
|
||||||
to_parent (window,
|
to_embedder (window,
|
||||||
0, 0,
|
0, 0,
|
||||||
&dx, &dy);
|
&dx, &dy);
|
||||||
tmpx = floor (tmpx + dx + 0.5);
|
tmpx = floor (tmpx + dx + 0.5);
|
||||||
@ -810,20 +798,21 @@ gdk_offscreen_window_get_pointer (GdkWindow *window,
|
|||||||
gint *y,
|
gint *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
|
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
|
||||||
|
GdkOffscreenWindow *offscreen;
|
||||||
int tmpx, tmpy;
|
int tmpx, tmpy;
|
||||||
double dtmpx, dtmpy;
|
double dtmpx, dtmpy;
|
||||||
GdkModifierType tmpmask;
|
GdkModifierType tmpmask;
|
||||||
GdkWindow *parent;
|
|
||||||
|
|
||||||
tmpx = 0;
|
tmpx = 0;
|
||||||
tmpy = 0;
|
tmpy = 0;
|
||||||
tmpmask = 0;
|
tmpmask = 0;
|
||||||
|
|
||||||
parent = get_offscreen_parent (window);
|
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||||
if (parent != NULL)
|
if (offscreen->embedder != NULL)
|
||||||
{
|
{
|
||||||
gdk_window_get_pointer (parent, &tmpx, &tmpy, &tmpmask);
|
gdk_window_get_pointer (offscreen->embedder, &tmpx, &tmpy, &tmpmask);
|
||||||
from_parent (window,
|
from_embedder (window,
|
||||||
tmpx, tmpy,
|
tmpx, tmpy,
|
||||||
&dtmpx, &dtmpy);
|
&dtmpx, &dtmpy);
|
||||||
tmpx = floor (dtmpx + 0.5);
|
tmpx = floor (dtmpx + 0.5);
|
||||||
@ -840,7 +829,7 @@ gdk_offscreen_window_get_pointer (GdkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_window_get_offscreen_pixmap:
|
* gdk_offscreen_window_get_pixmap:
|
||||||
* @window: a #GdkWindow
|
* @window: a #GdkWindow
|
||||||
*
|
*
|
||||||
* Gets the offscreen pixmap that an offscreen window renders into. If
|
* Gets the offscreen pixmap that an offscreen window renders into. If
|
||||||
@ -850,7 +839,7 @@ gdk_offscreen_window_get_pointer (GdkWindow *window,
|
|||||||
* Returns: The offscreen pixmap, or NULL if not offscreen
|
* Returns: The offscreen pixmap, or NULL if not offscreen
|
||||||
**/
|
**/
|
||||||
GdkPixmap *
|
GdkPixmap *
|
||||||
gdk_window_get_offscreen_pixmap (GdkWindow *window)
|
gdk_offscreen_window_get_pixmap (GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||||
GdkOffscreenWindow *offscreen;
|
GdkOffscreenWindow *offscreen;
|
||||||
@ -970,7 +959,8 @@ gdk_offscreen_window_move_resize (GdkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_offscreen_window_show (GdkWindow *window)
|
gdk_offscreen_window_show (GdkWindow *window,
|
||||||
|
gboolean already_mapped)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||||
|
|
||||||
@ -1165,6 +1155,50 @@ gdk_offscreen_window_queue_translation (GdkWindow *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
|
static void
|
||||||
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||||
|
@ -122,10 +122,9 @@
|
|||||||
#define GDK_VISIBILITY_NOT_VIEWABLE 3
|
#define GDK_VISIBILITY_NOT_VIEWABLE 3
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
GET_OFFSCREEN_PARENT,
|
PICK_EMBEDDED_CHILD, /* only called if children are embedded */
|
||||||
PICK_OFFSCREEN_CHILD, /* only called if has_offscreen_children */
|
TO_EMBEDDER,
|
||||||
TO_PARENT,
|
FROM_EMBEDDER,
|
||||||
FROM_PARENT,
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -312,7 +311,6 @@ static void do_move_region_bits_on_impl (GdkWindowObject *private,
|
|||||||
GdkRegion *region, /* In impl window coords */
|
GdkRegion *region, /* In impl window coords */
|
||||||
int dx, int dy);
|
int dx, int dy);
|
||||||
static void gdk_window_invalidate_in_parent (GdkWindowObject *private);
|
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 move_native_children (GdkWindowObject *private);
|
||||||
static void update_cursor (GdkDisplay *display);
|
static void update_cursor (GdkDisplay *display);
|
||||||
static gboolean is_event_parent_of (GdkWindow *parent,
|
static gboolean is_event_parent_of (GdkWindow *parent,
|
||||||
@ -448,17 +446,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
|||||||
quark_pointer_window = g_quark_from_static_string ("gtk-pointer-window");
|
quark_pointer_window = g_quark_from_static_string ("gtk-pointer-window");
|
||||||
|
|
||||||
|
|
||||||
signals[GET_OFFSCREEN_PARENT] =
|
signals[PICK_EMBEDDED_CHILD] =
|
||||||
g_signal_new (g_intern_static_string ("get-offscreen-parent"),
|
g_signal_new (g_intern_static_string ("pick-embedded-child"),
|
||||||
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"),
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
@ -468,8 +457,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
|||||||
2,
|
2,
|
||||||
G_TYPE_DOUBLE,
|
G_TYPE_DOUBLE,
|
||||||
G_TYPE_DOUBLE);
|
G_TYPE_DOUBLE);
|
||||||
signals[TO_PARENT] =
|
signals[TO_EMBEDDER] =
|
||||||
g_signal_new (g_intern_static_string ("to-parent"),
|
g_signal_new (g_intern_static_string ("to-embedder"),
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
@ -481,8 +470,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
|||||||
G_TYPE_DOUBLE,
|
G_TYPE_DOUBLE,
|
||||||
G_TYPE_POINTER,
|
G_TYPE_POINTER,
|
||||||
G_TYPE_POINTER);
|
G_TYPE_POINTER);
|
||||||
signals[FROM_PARENT] =
|
signals[FROM_EMBEDDER] =
|
||||||
g_signal_new (g_intern_static_string ("from-parent"),
|
g_signal_new (g_intern_static_string ("from-embedder"),
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
@ -7854,8 +7843,8 @@ gdk_window_redirect_free (GdkWindowRedirect *redirect)
|
|||||||
static GdkWindowObject *
|
static GdkWindowObject *
|
||||||
get_event_parent (GdkWindowObject *window)
|
get_event_parent (GdkWindowObject *window)
|
||||||
{
|
{
|
||||||
if (window->window_type ==GDK_WINDOW_OFFSCREEN)
|
if (window->window_type == GDK_WINDOW_OFFSCREEN)
|
||||||
return (GdkWindowObject *)gdk_window_get_offscreen_parent ((GdkWindow *)window);
|
return (GdkWindowObject *)gdk_offscreen_window_get_embedder ((GdkWindow *)window);
|
||||||
else
|
else
|
||||||
return window->parent;
|
return window->parent;
|
||||||
}
|
}
|
||||||
@ -7923,13 +7912,13 @@ update_cursor (GdkDisplay *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
from_parent (GdkWindowObject *window,
|
from_embedder (GdkWindowObject *window,
|
||||||
double parent_x, double parent_y,
|
double embedder_x, double embedder_y,
|
||||||
double *offscreen_x, double *offscreen_y)
|
double *offscreen_x, double *offscreen_y)
|
||||||
{
|
{
|
||||||
g_signal_emit (window,
|
g_signal_emit (window,
|
||||||
signals[FROM_PARENT], 0,
|
signals[FROM_EMBEDDER], 0,
|
||||||
parent_x, parent_y,
|
embedder_x, embedder_y,
|
||||||
offscreen_x, offscreen_y,
|
offscreen_x, offscreen_y,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@ -7941,7 +7930,7 @@ convert_coords_to_child (GdkWindowObject *child,
|
|||||||
{
|
{
|
||||||
if (gdk_window_is_offscreen (child))
|
if (gdk_window_is_offscreen (child))
|
||||||
{
|
{
|
||||||
from_parent (child, x, y,
|
from_embedder (child, x, y,
|
||||||
child_x, child_y);
|
child_x, child_y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -8026,14 +8015,14 @@ convert_toplevel_coords_to_window (GdkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GdkWindowObject *
|
static GdkWindowObject *
|
||||||
pick_offscreen_child (GdkWindowObject *window,
|
pick_embedded_child (GdkWindowObject *window,
|
||||||
double x, double y)
|
double x, double y)
|
||||||
{
|
{
|
||||||
GdkWindowObject *res;
|
GdkWindowObject *res;
|
||||||
|
|
||||||
res = NULL;
|
res = NULL;
|
||||||
g_signal_emit (window,
|
g_signal_emit (window,
|
||||||
signals[PICK_OFFSCREEN_CHILD], 0,
|
signals[PICK_EMBEDDED_CHILD], 0,
|
||||||
x, y, &res);
|
x, y, &res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@ -8066,9 +8055,9 @@ _gdk_window_find_child_at (GdkWindow *window,
|
|||||||
return (GdkWindow *)sub;
|
return (GdkWindow *)sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (private->has_offscreen_children)
|
if (private->num_offscreen_children > 0)
|
||||||
{
|
{
|
||||||
sub = pick_offscreen_child (private,
|
sub = pick_embedded_child (private,
|
||||||
x, y);
|
x, y);
|
||||||
if (sub)
|
if (sub)
|
||||||
return (GdkWindow *)sub;
|
return (GdkWindow *)sub;
|
||||||
@ -8117,15 +8106,15 @@ _gdk_window_find_descendant_at (GdkWindow *toplevel,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found &&
|
if (!found &&
|
||||||
private->has_offscreen_children)
|
private->num_offscreen_children > 0)
|
||||||
{
|
{
|
||||||
sub = pick_offscreen_child (private,
|
sub = pick_embedded_child (private,
|
||||||
x, y);
|
x, y);
|
||||||
if (sub)
|
if (sub)
|
||||||
{
|
{
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
private = sub;
|
private = sub;
|
||||||
from_parent (sub, x, y, &x, &y);
|
from_embedder (sub, x, y, &x, &y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8648,20 +8637,6 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display,
|
|||||||
_gdk_display_enable_motion_hints (display);
|
_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
|
* gdk_pointer_grab
|
||||||
@ -8719,7 +8694,7 @@ gdk_pointer_grab (GdkWindow * window,
|
|||||||
native = gdk_window_get_toplevel (window);
|
native = gdk_window_get_toplevel (window);
|
||||||
while (gdk_window_is_offscreen ((GdkWindowObject *)native))
|
while (gdk_window_is_offscreen ((GdkWindowObject *)native))
|
||||||
{
|
{
|
||||||
native = gdk_window_get_offscreen_parent (native);
|
native = gdk_offscreen_window_get_embedder (native);
|
||||||
|
|
||||||
if (native == NULL ||
|
if (native == NULL ||
|
||||||
(!_gdk_window_has_impl (native) &&
|
(!_gdk_window_has_impl (native) &&
|
||||||
@ -8755,24 +8730,7 @@ gdk_pointer_grab (GdkWindow * window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gdk_window_set_has_offscreen_children (GdkWindow *window,
|
gdk_window_geometry_changed (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_synthesize_crossing_events_for_geometry_change (window);
|
_gdk_synthesize_crossing_events_for_geometry_change (window);
|
||||||
}
|
}
|
||||||
|
@ -660,11 +660,11 @@ GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
|
|||||||
GdkWindow *gdk_get_default_root_window (void);
|
GdkWindow *gdk_get_default_root_window (void);
|
||||||
|
|
||||||
/* Offscreen redirection */
|
/* Offscreen redirection */
|
||||||
GdkPixmap *gdk_window_get_offscreen_pixmap (GdkWindow *window);
|
GdkPixmap *gdk_offscreen_window_get_pixmap (GdkWindow *window);
|
||||||
void gdk_window_set_has_offscreen_children (GdkWindow *window,
|
void gdk_offscreen_window_set_embedder (GdkWindow *window,
|
||||||
gboolean has_offscreen_children);
|
GdkWindow *embedder);
|
||||||
gboolean gdk_window_get_has_offscreen_children (GdkWindow *window);
|
GdkWindow *gdk_offscreen_window_get_embedder (GdkWindow *window);
|
||||||
void gdk_window_offscreen_children_changed (GdkWindow *window);
|
void gdk_window_geometry_changed (GdkWindow *window);
|
||||||
|
|
||||||
void gdk_window_redirect_to_drawable (GdkWindow *window,
|
void gdk_window_redirect_to_drawable (GdkWindow *window,
|
||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
|
@ -140,13 +140,6 @@ gtk_offscreen_box_new (void)
|
|||||||
return g_object_new (GTK_TYPE_OFFSCREEN_BOX, NULL);
|
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 *
|
static GdkWindow *
|
||||||
pick_offscreen_child (GdkWindow *offscreen_window,
|
pick_offscreen_child (GdkWindow *offscreen_window,
|
||||||
double widget_x, double widget_y,
|
double widget_x, double widget_y,
|
||||||
@ -273,8 +266,7 @@ gtk_offscreen_box_realize (GtkWidget *widget)
|
|||||||
&attributes, attributes_mask);
|
&attributes, attributes_mask);
|
||||||
gdk_window_set_user_data (widget->window, widget);
|
gdk_window_set_user_data (widget->window, widget);
|
||||||
|
|
||||||
gdk_window_set_has_offscreen_children (widget->window, TRUE);
|
g_signal_connect (widget->window, "pick-embedded-child",
|
||||||
g_signal_connect (widget->window, "pick-offscreen-child",
|
|
||||||
G_CALLBACK (pick_offscreen_child), offscreen_box);
|
G_CALLBACK (pick_offscreen_child), offscreen_box);
|
||||||
|
|
||||||
attributes.window_type = GDK_WINDOW_OFFSCREEN;
|
attributes.window_type = GDK_WINDOW_OFFSCREEN;
|
||||||
@ -293,11 +285,12 @@ gtk_offscreen_box_realize (GtkWidget *widget)
|
|||||||
if (offscreen_box->child1)
|
if (offscreen_box->child1)
|
||||||
gtk_widget_set_parent_window (offscreen_box->child1, offscreen_box->offscreen_window1);
|
gtk_widget_set_parent_window (offscreen_box->child1, offscreen_box->offscreen_window1);
|
||||||
|
|
||||||
g_signal_connect (offscreen_box->offscreen_window1, "get-offscreen-parent",
|
gdk_offscreen_window_set_embedder (offscreen_box->offscreen_window1,
|
||||||
G_CALLBACK (get_offscreen_parent), offscreen_box);
|
widget->window);
|
||||||
g_signal_connect (offscreen_box->offscreen_window1, "to_parent",
|
|
||||||
|
g_signal_connect (offscreen_box->offscreen_window1, "to-embedder",
|
||||||
G_CALLBACK (offscreen_window_to_parent1), offscreen_box);
|
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);
|
G_CALLBACK (offscreen_window_from_parent1), offscreen_box);
|
||||||
|
|
||||||
/* Child 2 */
|
/* Child 2 */
|
||||||
@ -313,11 +306,11 @@ gtk_offscreen_box_realize (GtkWidget *widget)
|
|||||||
gdk_window_set_user_data (offscreen_box->offscreen_window2, widget);
|
gdk_window_set_user_data (offscreen_box->offscreen_window2, widget);
|
||||||
if (offscreen_box->child2)
|
if (offscreen_box->child2)
|
||||||
gtk_widget_set_parent_window (offscreen_box->child2, offscreen_box->offscreen_window2);
|
gtk_widget_set_parent_window (offscreen_box->child2, offscreen_box->offscreen_window2);
|
||||||
g_signal_connect (offscreen_box->offscreen_window2, "get-offscreen-parent",
|
gdk_offscreen_window_set_embedder (offscreen_box->offscreen_window2,
|
||||||
G_CALLBACK (get_offscreen_parent), offscreen_box);
|
widget->window);
|
||||||
g_signal_connect (offscreen_box->offscreen_window2, "to_parent",
|
g_signal_connect (offscreen_box->offscreen_window2, "to-embedder",
|
||||||
G_CALLBACK (offscreen_window_to_parent2), offscreen_box);
|
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);
|
G_CALLBACK (offscreen_window_from_parent2), offscreen_box);
|
||||||
|
|
||||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||||
@ -590,7 +583,7 @@ gtk_offscreen_box_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
if (offscreen_box->child1 && GTK_WIDGET_VISIBLE (offscreen_box->child1))
|
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;
|
child_area = offscreen_box->child1->allocation;
|
||||||
|
|
||||||
cr = gdk_cairo_create (widget->window);
|
cr = gdk_cairo_create (widget->window);
|
||||||
@ -607,7 +600,7 @@ gtk_offscreen_box_expose (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
gint w, h;
|
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;
|
child_area = offscreen_box->child2->allocation;
|
||||||
|
|
||||||
cr = gdk_cairo_create (widget->window);
|
cr = gdk_cairo_create (widget->window);
|
||||||
|
Loading…
Reference in New Issue
Block a user