[gtk+/client-side-windows: 96/284] Fix various problem with temporarily unsetting background
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 96/284] Fix various problem with temporarily unsetting background
- Date: Thu, 2 Apr 2009 14:07:48 -0400 (EDT)
commit ed9cd90b729011bad6e38842fb2f827e017bb1f8
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jan 20 21:59:04 2009 +0100
Fix various problem with temporarily unsetting background
All the calls that unset private->parent failed if that was
not a native window (impl), instead we need to find the impl window
for the parent. Add some helper functions for this and use them.
For move/resize of child windows, we really need to recursively unset
on the parent, because moving the window could expose other native
children of the parent.
In do_shape_combine_region, only unset background if we're changing
the bounding shape (i.e. not the input shape)
---
gdk/x11/gdkgeometry-x11.c | 6 ++----
gdk/x11/gdkwindow-x11.c | 43 ++++++++++++++++++++++++++++++++-----------
gdk/x11/gdkwindow-x11.h | 21 ++++++++++++---------
3 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index b1fbe1c..f8289bd 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -212,14 +212,12 @@ _gdk_window_move_resize_child (GdkWindow *window,
new_info.width = obj->width;
new_info.height = obj->height;
- _gdk_x11_window_tmp_unset_bg (window, TRUE);
- _gdk_x11_window_tmp_unset_bg (obj->parent, FALSE);
+ _gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
if (is_resize)
move_resize (window, &new_info);
else
move (window, &new_info);
- _gdk_x11_window_tmp_reset_bg (obj->parent, FALSE);
- _gdk_x11_window_tmp_reset_bg (window, TRUE);
+ _gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
}
static Bool
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index e8be420..be7947d 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -293,7 +293,6 @@ _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
!GDK_WINDOW_IS_MAPPED (window)))
return;
-
if (_gdk_window_has_impl (window) &&
GDK_WINDOW_IS_X11 (window) &&
private->window_type != GDK_WINDOW_ROOT &&
@@ -310,6 +309,16 @@ _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
}
void
+_gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window,
+ gboolean recurse)
+{
+ GdkWindowObject *private;
+ private = (GdkWindowObject*) window;
+ _gdk_x11_window_tmp_unset_bg (_gdk_window_get_impl_window ((GdkWindow *)private->parent),
+ recurse);
+}
+
+void
_gdk_x11_window_tmp_reset_bg (GdkWindow *window,
gboolean recurse)
{
@@ -340,6 +349,16 @@ _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
}
}
+void
+_gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window,
+ gboolean recurse)
+{
+ GdkWindowObject *private;
+ private = (GdkWindowObject*) window;
+ _gdk_x11_window_tmp_reset_bg (_gdk_window_get_impl_window ((GdkWindow *)private->parent),
+ recurse);
+}
+
static GdkColormap*
gdk_window_impl_x11_get_colormap (GdkDrawable *drawable)
{
@@ -1317,7 +1336,7 @@ pre_unmap (GdkWindow *window)
return;
if (private->window_type == GDK_WINDOW_CHILD)
- start_window = (GdkWindow *)private->parent;
+ start_window = _gdk_window_get_impl_window ((GdkWindow *)private->parent);
else if (private->window_type == GDK_WINDOW_TEMP)
start_window = get_root (window);
@@ -1335,7 +1354,7 @@ post_unmap (GdkWindow *window)
return;
if (private->window_type == GDK_WINDOW_CHILD)
- start_window = (GdkWindow *)private->parent;
+ start_window = _gdk_window_get_impl_window ((GdkWindow *)private->parent);
else if (private->window_type == GDK_WINDOW_TEMP)
start_window = get_root (window);
@@ -1570,12 +1589,12 @@ gdk_window_x11_reparent (GdkWindow *window,
impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
_gdk_x11_window_tmp_unset_bg (window, TRUE);
- _gdk_x11_window_tmp_unset_bg ((GdkWindow *)old_parent_private, FALSE);
+ _gdk_x11_window_tmp_unset_parent_bg (window, FALSE);
XReparentWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XID (new_parent),
parent_private->abs_x + x, parent_private->abs_y + y);
- _gdk_x11_window_tmp_reset_bg ((GdkWindow *)old_parent_private, FALSE);
+ _gdk_x11_window_tmp_reset_parent_bg (window, FALSE);
_gdk_x11_window_tmp_reset_bg (window, TRUE);
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
@@ -3370,14 +3389,16 @@ do_shape_combine_region (GdkWindow *window,
: gdk_display_supports_input_shapes (GDK_WINDOW_DISPLAY (window)))
{
private->shaped = FALSE;
- _gdk_x11_window_tmp_unset_bg ((GdkWindow *)private->parent, TRUE);
+ if (shape == ShapeBounding)
+ _gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
XShapeCombineMask (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
shape,
0, 0,
None,
ShapeSet);
- _gdk_x11_window_tmp_reset_bg ((GdkWindow *)private->parent, TRUE);
+ if (shape == ShapeBounding)
+ _gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
}
return;
}
@@ -3395,9 +3416,8 @@ do_shape_combine_region (GdkWindow *window,
0, 0,
&xrects, &n_rects);
-
- _gdk_x11_window_tmp_unset_bg ((GdkWindow *)private->parent, TRUE);
-
+ if (shape == ShapeBounding)
+ _gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
XShapeCombineRectangles (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
shape,
@@ -3406,7 +3426,8 @@ do_shape_combine_region (GdkWindow *window,
ShapeSet,
YXBanded);
- _gdk_x11_window_tmp_reset_bg ((GdkWindow *)private->parent, TRUE);
+ if (shape == ShapeBounding)
+ _gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
g_free (xrects);
}
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index 78c22aa..744ff2c 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -140,15 +140,18 @@ struct _GdkToplevelX11
GType gdk_window_impl_x11_get_type (void);
-void gdk_x11_window_set_user_time (GdkWindow *window,
- guint32 timestamp);
-
-GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window);
-void _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
- gboolean recurse);
-void _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
- gboolean recurse);
-
+void gdk_x11_window_set_user_time (GdkWindow *window,
+ guint32 timestamp);
+
+GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window);
+void _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
+ gboolean recurse);
+void _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
+ gboolean recurse);
+void _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window,
+ gboolean recurse);
+void _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window,
+ gboolean recurse);
GdkCursor *_gdk_x11_window_get_cursor (GdkWindow *window);
void _gdk_x11_window_get_offsets (GdkWindow *window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]