mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	xdg-popup: use configure fields
This commit is contained in:
		
							parent
							
								
									8d2fa15e9d
								
							
						
					
					
						commit
						5c4384a133
					
				
					 2 changed files with 14 additions and 6 deletions
				
			
		| 
						 | 
					@ -83,11 +83,14 @@ struct wlr_xdg_popup_state {
 | 
				
			||||||
	bool reactive;
 | 
						bool reactive;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum wlr_xdg_popup_configure_field {
 | 
				
			||||||
 | 
						WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN = 1 << 0,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_xdg_popup_configure {
 | 
					struct wlr_xdg_popup_configure {
 | 
				
			||||||
 | 
						uint32_t fields; // enum wlr_xdg_popup_configure_field
 | 
				
			||||||
	struct wlr_box geometry;
 | 
						struct wlr_box geometry;
 | 
				
			||||||
	struct wlr_xdg_positioner_rules rules;
 | 
						struct wlr_xdg_positioner_rules rules;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	bool has_reposition_token;
 | 
					 | 
				
			||||||
	uint32_t reposition_token;
 | 
						uint32_t reposition_token;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,10 +21,12 @@ struct wlr_xdg_popup_configure *send_xdg_popup_configure(
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	*configure = popup->scheduled;
 | 
						*configure = popup->scheduled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (popup->scheduled.has_reposition_token) {
 | 
						uint32_t version = wl_resource_get_version(popup->resource);
 | 
				
			||||||
		popup->scheduled.has_reposition_token = false;
 | 
					
 | 
				
			||||||
 | 
						if ((configure->fields & WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN) &&
 | 
				
			||||||
 | 
								version >= XDG_POPUP_REPOSITIONED_SINCE_VERSION) {
 | 
				
			||||||
		xdg_popup_send_repositioned(popup->resource,
 | 
							xdg_popup_send_repositioned(popup->resource,
 | 
				
			||||||
			popup->scheduled.reposition_token);
 | 
								configure->reposition_token);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_box *geometry = &configure->geometry;
 | 
						struct wlr_box *geometry = &configure->geometry;
 | 
				
			||||||
| 
						 | 
					@ -32,6 +34,8 @@ struct wlr_xdg_popup_configure *send_xdg_popup_configure(
 | 
				
			||||||
		geometry->x, geometry->y,
 | 
							geometry->x, geometry->y,
 | 
				
			||||||
		geometry->width, geometry->height);
 | 
							geometry->width, geometry->height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						popup->scheduled.fields = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return configure;
 | 
						return configure;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -315,7 +319,8 @@ static void xdg_popup_handle_reposition(
 | 
				
			||||||
	wlr_xdg_positioner_rules_get_geometry(
 | 
						wlr_xdg_positioner_rules_get_geometry(
 | 
				
			||||||
		&positioner->rules, &popup->scheduled.geometry);
 | 
							&positioner->rules, &popup->scheduled.geometry);
 | 
				
			||||||
	popup->scheduled.rules = positioner->rules;
 | 
						popup->scheduled.rules = positioner->rules;
 | 
				
			||||||
	popup->scheduled.has_reposition_token = true;
 | 
					
 | 
				
			||||||
 | 
						popup->scheduled.fields |= WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN;
 | 
				
			||||||
	popup->scheduled.reposition_token = token;
 | 
						popup->scheduled.reposition_token = token;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_surface_schedule_configure(popup->base);
 | 
						wlr_xdg_surface_schedule_configure(popup->base);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue