mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	menu: slightly slide menus opened with atCursor="no"
This is reland of2ade6a1ewhich was reverted with21bd5b00, but this prevents the x-position of the menu from being negative and slides menus opened with Alt-Space too.
This commit is contained in:
		
							parent
							
								
									2446c46069
								
							
						
					
					
						commit
						ac7c94db12
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -670,14 +670,17 @@ show_menu(struct server *server, struct view *view, struct cursor_context *ctx,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	/* Place menu in the view corner if desired (and menu is not root-menu) */
 | 
						/* Place menu in the view corner if desired (and menu is not root-menu) */
 | 
				
			||||||
	if (!at_cursor && view) {
 | 
						if (!at_cursor && view) {
 | 
				
			||||||
		x = view->current.x;
 | 
							struct wlr_box extent = ssd_max_extents(view);
 | 
				
			||||||
 | 
							x = extent.x;
 | 
				
			||||||
		y = view->current.y;
 | 
							y = view->current.y;
 | 
				
			||||||
		/* Push the client menu underneath the button */
 | 
							/* Push the client menu underneath the button */
 | 
				
			||||||
		if (is_client_menu && ssd_part_contains(
 | 
							if (is_client_menu && ssd_part_contains(
 | 
				
			||||||
				LAB_SSD_BUTTON, ctx->type)) {
 | 
									LAB_SSD_BUTTON, ctx->type)) {
 | 
				
			||||||
			assert(ctx->node);
 | 
								assert(ctx->node);
 | 
				
			||||||
			int ly;
 | 
								int lx, ly;
 | 
				
			||||||
			wlr_scene_node_coords(ctx->node, &x, &ly);
 | 
								wlr_scene_node_coords(ctx->node, &lx, &ly);
 | 
				
			||||||
 | 
								/* MAX() prevents negative x when the window is maximized */
 | 
				
			||||||
 | 
								x = MAX(x, lx - server->theme->menu_border_width);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue