mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	view: move (z-order) ancestors with modal dialogs
...so that other window cannot be positioned between modal dialogs and their parent windows. This is consistent with Gtk3 and Qt5 applications on mutter and openbox.
This commit is contained in:
		
							parent
							
								
									e1743e1de2
								
							
						
					
					
						commit
						1212f34825
					
				
					 2 changed files with 34 additions and 10 deletions
				
			
		
							
								
								
									
										27
									
								
								src/xdg.c
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								src/xdg.c
									
										
									
									
									
								
							| 
						 | 
					@ -369,20 +369,35 @@ move_sub_views(struct view *parent, enum z_direction z_direction)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Return the most senior parent (=root) view */
 | 
				
			||||||
 | 
					static struct view *
 | 
				
			||||||
 | 
					root_view_of_view(struct view *view)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct wlr_xdg_toplevel *root = top_parent_of(view);
 | 
				
			||||||
 | 
						struct wlr_xdg_surface *surface = (struct wlr_xdg_surface *)root->base;
 | 
				
			||||||
 | 
						return (struct view *)surface->data;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * In the view_move_to_{front,back} functions, a modal dialog is always shown
 | 
				
			||||||
 | 
					 * above its parent window, and the two always move together, so other window
 | 
				
			||||||
 | 
					 * cannot come between them.
 | 
				
			||||||
 | 
					 * This is consistent with GTK3/Qt5 applications on mutter and openbox.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
xdg_toplevel_view_move_to_front(struct view *view)
 | 
					xdg_toplevel_view_move_to_front(struct view *view)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	view_impl_move_to_front(view);
 | 
						struct view *root = root_view_of_view(view);
 | 
				
			||||||
 | 
						view_impl_move_to_front(root);
 | 
				
			||||||
	/* Show modal dialog above parent window */
 | 
						move_sub_views(root, LAB_TO_FRONT);
 | 
				
			||||||
	move_sub_views(view, LAB_TO_FRONT);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
xdg_toplevel_view_move_to_back(struct view *view)
 | 
					xdg_toplevel_view_move_to_back(struct view *view)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	view_impl_move_to_back(view);
 | 
						struct view *root = root_view_of_view(view);
 | 
				
			||||||
	move_sub_views(view, LAB_TO_BACK);
 | 
						view_impl_move_to_back(root);
 | 
				
			||||||
 | 
						move_sub_views(root, LAB_TO_BACK);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -552,18 +552,27 @@ move_sub_views(struct view *parent, enum z_direction z_direction)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct view *
 | 
				
			||||||
 | 
					root_view_of_view(struct view *view)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct wlr_xwayland_surface *root = top_parent_of(view);
 | 
				
			||||||
 | 
						return (struct view *)root->data;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
xwayland_view_move_to_front(struct view *view)
 | 
					xwayland_view_move_to_front(struct view *view)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	view_impl_move_to_front(view);
 | 
						struct view *root = root_view_of_view(view);
 | 
				
			||||||
	move_sub_views(view, LAB_TO_FRONT);
 | 
						view_impl_move_to_front(root);
 | 
				
			||||||
 | 
						move_sub_views(root, LAB_TO_FRONT);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
xwayland_view_move_to_back(struct view *view)
 | 
					xwayland_view_move_to_back(struct view *view)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	view_impl_move_to_back(view);
 | 
						struct view *root = root_view_of_view(view);
 | 
				
			||||||
	move_sub_views(view, LAB_TO_BACK);
 | 
						view_impl_move_to_back(root);
 | 
				
			||||||
 | 
						move_sub_views(root, LAB_TO_BACK);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue