xdg-shell: send same-as-current configure if needed

master
Tony Crisci 7 years ago committed by Heghedus Razvan
parent 169bc216ed
commit a5659b65c7

@ -845,6 +845,10 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare(
return false; return false;
} }
if (!wl_list_empty(&state->base->configure_list)) {
return false;
}
if (state->pending.activated != state->current.activated) { if (state->pending.activated != state->current.activated) {
return false; return false;
} }
@ -947,7 +951,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
} }
static void wlr_xdg_surface_v6_schedule_configure( static void wlr_xdg_surface_v6_schedule_configure(
struct wlr_xdg_surface_v6 *surface, bool force) { struct wlr_xdg_surface_v6 *surface) {
struct wl_display *display = wl_client_get_display(surface->client->client); struct wl_display *display = wl_client_get_display(surface->client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display); struct wl_event_loop *loop = wl_display_get_event_loop(display);
bool pending_same = false; bool pending_same = false;
@ -957,7 +961,7 @@ static void wlr_xdg_surface_v6_schedule_configure(
assert(0 && "not reached"); assert(0 && "not reached");
break; break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
pending_same = !force && pending_same =
wlr_xdg_surface_v6_toplevel_state_compare(surface->toplevel_state); wlr_xdg_surface_v6_toplevel_state_compare(surface->toplevel_state);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
@ -1001,7 +1005,7 @@ static void wlr_xdg_surface_v6_toplevel_committed(
if (!surface->surface->texture->valid && !surface->toplevel_state->added) { if (!surface->surface->texture->valid && !surface->toplevel_state->added) {
// on the first commit, send a configure request to tell the client it // on the first commit, send a configure request to tell the client it
// is added // is added
wlr_xdg_surface_v6_schedule_configure(surface, true); wlr_xdg_surface_v6_schedule_configure(surface);
surface->toplevel_state->added = true; surface->toplevel_state->added = true;
return; return;
} }
@ -1018,7 +1022,7 @@ static void wlr_xdg_surface_v6_popup_committed(
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
if (!surface->popup_state->committed) { if (!surface->popup_state->committed) {
wlr_xdg_surface_v6_schedule_configure(surface, true); wlr_xdg_surface_v6_schedule_configure(surface);
surface->popup_state->committed = true; surface->popup_state->committed = true;
} }
} }
@ -1265,49 +1269,42 @@ void wlr_xdg_surface_v6_ping(struct wlr_xdg_surface_v6 *surface) {
void wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
uint32_t width, uint32_t height) { uint32_t width, uint32_t height) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
bool force =
(surface->toplevel_state->pending.width != width ||
surface->toplevel_state->pending.height != height);
surface->toplevel_state->pending.width = width; surface->toplevel_state->pending.width = width;
surface->toplevel_state->pending.height = height; surface->toplevel_state->pending.height = height;
wlr_xdg_surface_v6_schedule_configure(surface, force); wlr_xdg_surface_v6_schedule_configure(surface);
} }
void wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
bool activated) { bool activated) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
bool force = surface->toplevel_state->pending.activated != activated;
surface->toplevel_state->pending.activated = activated; surface->toplevel_state->pending.activated = activated;
wlr_xdg_surface_v6_schedule_configure(surface, force); wlr_xdg_surface_v6_schedule_configure(surface);
} }
void wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
bool maximized) { bool maximized) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
bool force = surface->toplevel_state->pending.maximized != maximized;
surface->toplevel_state->pending.maximized = maximized; surface->toplevel_state->pending.maximized = maximized;
wlr_xdg_surface_v6_schedule_configure(surface, force); wlr_xdg_surface_v6_schedule_configure(surface);
} }
void wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
bool fullscreen) { bool fullscreen) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
bool force = surface->toplevel_state->pending.fullscreen != fullscreen;
surface->toplevel_state->pending.fullscreen = fullscreen; surface->toplevel_state->pending.fullscreen = fullscreen;
wlr_xdg_surface_v6_schedule_configure(surface, force); wlr_xdg_surface_v6_schedule_configure(surface);
} }
void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
bool resizing) { bool resizing) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
bool force = surface->toplevel_state->pending.resizing != resizing;
surface->toplevel_state->pending.resizing = resizing; surface->toplevel_state->pending.resizing = resizing;
wlr_xdg_surface_v6_schedule_configure(surface, force); wlr_xdg_surface_v6_schedule_configure(surface);
} }
void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface) { void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface) {

Loading…
Cancel
Save