xdg-popup: use configure fields

Kirill Primak 2 years ago committed by Simon Ser
parent 8d2fa15e9d
commit 5c4384a133

@ -83,11 +83,14 @@ struct wlr_xdg_popup_state {
bool reactive;
};
enum wlr_xdg_popup_configure_field {
WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN = 1 << 0,
};
struct wlr_xdg_popup_configure {
uint32_t fields; // enum wlr_xdg_popup_configure_field
struct wlr_box geometry;
struct wlr_xdg_positioner_rules rules;
bool has_reposition_token;
uint32_t reposition_token;
};

@ -21,10 +21,12 @@ struct wlr_xdg_popup_configure *send_xdg_popup_configure(
}
*configure = popup->scheduled;
if (popup->scheduled.has_reposition_token) {
popup->scheduled.has_reposition_token = false;
uint32_t version = wl_resource_get_version(popup->resource);
if ((configure->fields & WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN) &&
version >= XDG_POPUP_REPOSITIONED_SINCE_VERSION) {
xdg_popup_send_repositioned(popup->resource,
popup->scheduled.reposition_token);
configure->reposition_token);
}
struct wlr_box *geometry = &configure->geometry;
@ -32,6 +34,8 @@ struct wlr_xdg_popup_configure *send_xdg_popup_configure(
geometry->x, geometry->y,
geometry->width, geometry->height);
popup->scheduled.fields = 0;
return configure;
}
@ -315,7 +319,8 @@ static void xdg_popup_handle_reposition(
wlr_xdg_positioner_rules_get_geometry(
&positioner->rules, &popup->scheduled.geometry);
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;
wlr_xdg_surface_schedule_configure(popup->base);

Loading…
Cancel
Save