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)
This commit is contained in:
		 Alexander Larsson
					Alexander Larsson
				
			
				
					committed by
					
						 Alexander Larsson
						Alexander Larsson
					
				
			
			
				
	
			
			
			 Alexander Larsson
						Alexander Larsson
					
				
			
						parent
						
							3c5c7f4b4d
						
					
				
				
					commit
					ed9cd90b72
				
			| @ -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 | ||||
|  | ||||
| @ -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 && | ||||
| @ -309,6 +308,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); | ||||
|     } | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user