libweston-desktop/xdg-shell: Rename requested_ to pending_

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
dev
Quentin Glidic 7 years ago
parent 1170c66305
commit 218126d992
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
  1. 56
      libweston-desktop/xdg-shell-v5.c
  2. 58
      libweston-desktop/xdg-shell-v6.c

@ -47,13 +47,13 @@ struct weston_desktop_xdg_surface {
struct wl_event_source *add_idle; struct wl_event_source *add_idle;
struct wl_event_source *configure_idle; struct wl_event_source *configure_idle;
uint32_t configure_serial; uint32_t configure_serial;
struct weston_size requested_size; struct weston_size pending_size;
struct { struct {
bool maximized; bool maximized;
bool fullscreen; bool fullscreen;
bool resizing; bool resizing;
bool activated; bool activated;
} requested_state, next_state, state; } pending_state, next_state, state;
bool has_next_geometry; bool has_next_geometry;
struct weston_geometry next_geometry; struct weston_geometry next_geometry;
}; };
@ -92,26 +92,26 @@ weston_desktop_xdg_surface_send_configure(void *data)
wl_display_next_serial(weston_desktop_get_display(surface->desktop)); wl_display_next_serial(weston_desktop_get_display(surface->desktop));
wl_array_init(&states); wl_array_init(&states);
if (surface->requested_state.maximized) { if (surface->pending_state.maximized) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = XDG_SURFACE_STATE_MAXIMIZED; *s = XDG_SURFACE_STATE_MAXIMIZED;
} }
if (surface->requested_state.fullscreen) { if (surface->pending_state.fullscreen) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = XDG_SURFACE_STATE_FULLSCREEN; *s = XDG_SURFACE_STATE_FULLSCREEN;
} }
if (surface->requested_state.resizing) { if (surface->pending_state.resizing) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = XDG_SURFACE_STATE_RESIZING; *s = XDG_SURFACE_STATE_RESIZING;
} }
if (surface->requested_state.activated) { if (surface->pending_state.activated) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = XDG_SURFACE_STATE_ACTIVATED; *s = XDG_SURFACE_STATE_ACTIVATED;
} }
xdg_surface_send_configure(surface->resource, xdg_surface_send_configure(surface->resource,
surface->requested_size.width, surface->pending_size.width,
surface->requested_size.height, surface->pending_size.height,
&states, &states,
surface->configure_serial); surface->configure_serial);
@ -124,21 +124,21 @@ weston_desktop_xdg_surface_state_compare(struct weston_desktop_xdg_surface *surf
struct weston_surface *wsurface = struct weston_surface *wsurface =
weston_desktop_surface_get_surface(surface->surface); weston_desktop_surface_get_surface(surface->surface);
if (surface->requested_state.activated != surface->state.activated) if (surface->pending_state.activated != surface->state.activated)
return false; return false;
if (surface->requested_state.fullscreen != surface->state.fullscreen) if (surface->pending_state.fullscreen != surface->state.fullscreen)
return false; return false;
if (surface->requested_state.maximized != surface->state.maximized) if (surface->pending_state.maximized != surface->state.maximized)
return false; return false;
if (surface->requested_state.resizing != surface->state.resizing) if (surface->pending_state.resizing != surface->state.resizing)
return false; return false;
if (wsurface->width == surface->requested_size.width && if (wsurface->width == surface->pending_size.width &&
wsurface->height == surface->requested_size.height) wsurface->height == surface->pending_size.height)
return true; return true;
if (surface->requested_size.width == 0 && if (surface->pending_size.width == 0 &&
surface->requested_size.height == 0) surface->pending_size.height == 0)
return true; return true;
return false; return false;
@ -150,17 +150,17 @@ weston_desktop_xdg_surface_schedule_configure(struct weston_desktop_xdg_surface
{ {
struct wl_display *display = weston_desktop_get_display(surface->desktop); struct wl_display *display = weston_desktop_get_display(surface->desktop);
struct wl_event_loop *loop = wl_display_get_event_loop(display); struct wl_event_loop *loop = wl_display_get_event_loop(display);
bool requested_same = bool pending_same =
!force && weston_desktop_xdg_surface_state_compare(surface); !force && weston_desktop_xdg_surface_state_compare(surface);
if (surface->configure_idle != NULL) { if (surface->configure_idle != NULL) {
if (!requested_same) if (!pending_same)
return; return;
wl_event_source_remove(surface->configure_idle); wl_event_source_remove(surface->configure_idle);
surface->configure_idle = NULL; surface->configure_idle = NULL;
} else { } else {
if (requested_same) if (pending_same)
return; return;
surface->configure_idle = surface->configure_idle =
@ -176,7 +176,7 @@ weston_desktop_xdg_surface_set_maximized(struct weston_desktop_surface *dsurface
{ {
struct weston_desktop_xdg_surface *surface = user_data; struct weston_desktop_xdg_surface *surface = user_data;
surface->requested_state.maximized = maximized; surface->pending_state.maximized = maximized;
weston_desktop_xdg_surface_schedule_configure(surface, false); weston_desktop_xdg_surface_schedule_configure(surface, false);
} }
@ -186,7 +186,7 @@ weston_desktop_xdg_surface_set_fullscreen(struct weston_desktop_surface *dsurfac
{ {
struct weston_desktop_xdg_surface *surface = user_data; struct weston_desktop_xdg_surface *surface = user_data;
surface->requested_state.fullscreen = fullscreen; surface->pending_state.fullscreen = fullscreen;
weston_desktop_xdg_surface_schedule_configure(surface, false); weston_desktop_xdg_surface_schedule_configure(surface, false);
} }
@ -196,7 +196,7 @@ weston_desktop_xdg_surface_set_resizing(struct weston_desktop_surface *dsurface,
{ {
struct weston_desktop_xdg_surface *surface = user_data; struct weston_desktop_xdg_surface *surface = user_data;
surface->requested_state.resizing = resizing; surface->pending_state.resizing = resizing;
weston_desktop_xdg_surface_schedule_configure(surface, false); weston_desktop_xdg_surface_schedule_configure(surface, false);
} }
@ -206,7 +206,7 @@ weston_desktop_xdg_surface_set_activated(struct weston_desktop_surface *dsurface
{ {
struct weston_desktop_xdg_surface *surface = user_data; struct weston_desktop_xdg_surface *surface = user_data;
surface->requested_state.activated = activated; surface->pending_state.activated = activated;
weston_desktop_xdg_surface_schedule_configure(surface, false); weston_desktop_xdg_surface_schedule_configure(surface, false);
} }
@ -217,8 +217,8 @@ weston_desktop_xdg_surface_set_size(struct weston_desktop_surface *dsurface,
{ {
struct weston_desktop_xdg_surface *surface = user_data; struct weston_desktop_xdg_surface *surface = user_data;
surface->requested_size.width = width; surface->pending_size.width = width;
surface->requested_size.height = height; surface->pending_size.height = height;
weston_desktop_xdg_surface_schedule_configure(surface, false); weston_desktop_xdg_surface_schedule_configure(surface, false);
} }
@ -234,8 +234,8 @@ weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface,
bool reconfigure = false; bool reconfigure = false;
if (surface->next_state.maximized || surface->next_state.fullscreen) if (surface->next_state.maximized || surface->next_state.fullscreen)
reconfigure = surface->requested_size.width != wsurface->width || reconfigure = surface->pending_size.width != wsurface->width ||
surface->requested_size.height != wsurface->height; surface->pending_size.height != wsurface->height;
if (reconfigure) { if (reconfigure) {
weston_desktop_xdg_surface_schedule_configure(surface, true); weston_desktop_xdg_surface_schedule_configure(surface, true);
@ -436,7 +436,7 @@ weston_desktop_xdg_surface_protocol_ack_configure(struct wl_client *wl_client,
if (surface->configure_serial != serial) if (surface->configure_serial != serial)
return; return;
surface->next_state = surface->requested_state; surface->next_state = surface->pending_state;
} }
static void static void

@ -82,13 +82,13 @@ struct weston_desktop_xdg_toplevel {
struct wl_resource *resource; struct wl_resource *resource;
bool added; bool added;
struct weston_size requested_size; struct weston_size pending_size;
struct { struct {
bool maximized; bool maximized;
bool fullscreen; bool fullscreen;
bool resizing; bool resizing;
bool activated; bool activated;
} requested_state, next_state, state; } pending_state, next_state, state;
struct weston_size struct weston_size
next_max_size, max_size, next_max_size, max_size,
next_min_size, min_size; next_min_size, min_size;
@ -414,7 +414,7 @@ weston_desktop_xdg_toplevel_protocol_resize(struct wl_client *wl_client,
static void static void
weston_desktop_xdg_toplevel_ack_configure(struct weston_desktop_xdg_toplevel *toplevel) weston_desktop_xdg_toplevel_ack_configure(struct weston_desktop_xdg_toplevel *toplevel)
{ {
toplevel->next_state = toplevel->requested_state; toplevel->next_state = toplevel->pending_state;
} }
static void static void
@ -524,26 +524,26 @@ weston_desktop_xdg_toplevel_send_configure(struct weston_desktop_xdg_toplevel *t
struct wl_array states; struct wl_array states;
wl_array_init(&states); wl_array_init(&states);
if (toplevel->requested_state.maximized) { if (toplevel->pending_state.maximized) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED; *s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
} }
if (toplevel->requested_state.fullscreen) { if (toplevel->pending_state.fullscreen) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN; *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
} }
if (toplevel->requested_state.resizing) { if (toplevel->pending_state.resizing) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING; *s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
} }
if (toplevel->requested_state.activated) { if (toplevel->pending_state.activated) {
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
} }
zxdg_toplevel_v6_send_configure(toplevel->resource, zxdg_toplevel_v6_send_configure(toplevel->resource,
toplevel->requested_size.width, toplevel->pending_size.width,
toplevel->requested_size.height, toplevel->pending_size.height,
&states); &states);
wl_array_release(&states); wl_array_release(&states);
@ -555,7 +555,7 @@ weston_desktop_xdg_toplevel_set_maximized(struct weston_desktop_surface *dsurfac
{ {
struct weston_desktop_xdg_toplevel *toplevel = user_data; struct weston_desktop_xdg_toplevel *toplevel = user_data;
toplevel->requested_state.maximized = maximized; toplevel->pending_state.maximized = maximized;
weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false); weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
} }
@ -565,7 +565,7 @@ weston_desktop_xdg_toplevel_set_fullscreen(struct weston_desktop_surface *dsurfa
{ {
struct weston_desktop_xdg_toplevel *toplevel = user_data; struct weston_desktop_xdg_toplevel *toplevel = user_data;
toplevel->requested_state.fullscreen = fullscreen; toplevel->pending_state.fullscreen = fullscreen;
weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false); weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
} }
@ -575,7 +575,7 @@ weston_desktop_xdg_toplevel_set_resizing(struct weston_desktop_surface *dsurface
{ {
struct weston_desktop_xdg_toplevel *toplevel = user_data; struct weston_desktop_xdg_toplevel *toplevel = user_data;
toplevel->requested_state.resizing = resizing; toplevel->pending_state.resizing = resizing;
weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false); weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
} }
@ -585,7 +585,7 @@ weston_desktop_xdg_toplevel_set_activated(struct weston_desktop_surface *dsurfac
{ {
struct weston_desktop_xdg_toplevel *toplevel = user_data; struct weston_desktop_xdg_toplevel *toplevel = user_data;
toplevel->requested_state.activated = activated; toplevel->pending_state.activated = activated;
weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false); weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
} }
@ -596,8 +596,8 @@ weston_desktop_xdg_toplevel_set_size(struct weston_desktop_surface *dsurface,
{ {
struct weston_desktop_xdg_toplevel *toplevel = user_data; struct weston_desktop_xdg_toplevel *toplevel = user_data;
toplevel->requested_size.width = width; toplevel->pending_size.width = width;
toplevel->requested_size.height = height; toplevel->pending_size.height = height;
weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false); weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
} }
@ -617,8 +617,8 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
return; return;
if ((toplevel->next_state.maximized || toplevel->next_state.fullscreen) && if ((toplevel->next_state.maximized || toplevel->next_state.fullscreen) &&
(toplevel->requested_size.width != wsurface->width || (toplevel->pending_size.width != wsurface->width ||
toplevel->requested_size.height != wsurface->height)) { toplevel->pending_size.height != wsurface->height)) {
struct weston_desktop_client *client = struct weston_desktop_client *client =
weston_desktop_surface_get_client(toplevel->base.desktop_surface); weston_desktop_surface_get_client(toplevel->base.desktop_surface);
struct wl_resource *client_resource = struct wl_resource *client_resource =
@ -860,21 +860,21 @@ weston_desktop_xdg_surface_send_configure(void *user_data)
static bool static bool
weston_desktop_xdg_toplevel_state_compare(struct weston_desktop_xdg_toplevel *toplevel) weston_desktop_xdg_toplevel_state_compare(struct weston_desktop_xdg_toplevel *toplevel)
{ {
if (toplevel->requested_state.activated != toplevel->state.activated) if (toplevel->pending_state.activated != toplevel->state.activated)
return false; return false;
if (toplevel->requested_state.fullscreen != toplevel->state.fullscreen) if (toplevel->pending_state.fullscreen != toplevel->state.fullscreen)
return false; return false;
if (toplevel->requested_state.maximized != toplevel->state.maximized) if (toplevel->pending_state.maximized != toplevel->state.maximized)
return false; return false;
if (toplevel->requested_state.resizing != toplevel->state.resizing) if (toplevel->pending_state.resizing != toplevel->state.resizing)
return false; return false;
if (toplevel->base.surface->width == toplevel->requested_size.width && if (toplevel->base.surface->width == toplevel->pending_size.width &&
toplevel->base.surface->height == toplevel->requested_size.height) toplevel->base.surface->height == toplevel->pending_size.height)
return true; return true;
if (toplevel->requested_size.width == 0 && if (toplevel->pending_size.width == 0 &&
toplevel->requested_size.height == 0) toplevel->pending_size.height == 0)
return true; return true;
return false; return false;
@ -886,14 +886,14 @@ weston_desktop_xdg_surface_schedule_configure(struct weston_desktop_xdg_surface
{ {
struct wl_display *display = weston_desktop_get_display(surface->desktop); struct wl_display *display = weston_desktop_get_display(surface->desktop);
struct wl_event_loop *loop = wl_display_get_event_loop(display); struct wl_event_loop *loop = wl_display_get_event_loop(display);
bool requested_same = !force; bool pending_same = !force;
switch (surface->role) { switch (surface->role) {
case WESTON_DESKTOP_XDG_SURFACE_ROLE_NONE: case WESTON_DESKTOP_XDG_SURFACE_ROLE_NONE:
assert(0 && "not reached"); assert(0 && "not reached");
break; break;
case WESTON_DESKTOP_XDG_SURFACE_ROLE_TOPLEVEL: case WESTON_DESKTOP_XDG_SURFACE_ROLE_TOPLEVEL:
requested_same = requested_same && pending_same = pending_same &&
weston_desktop_xdg_toplevel_state_compare((struct weston_desktop_xdg_toplevel *) surface); weston_desktop_xdg_toplevel_state_compare((struct weston_desktop_xdg_toplevel *) surface);
break; break;
case WESTON_DESKTOP_XDG_SURFACE_ROLE_POPUP: case WESTON_DESKTOP_XDG_SURFACE_ROLE_POPUP:
@ -901,13 +901,13 @@ weston_desktop_xdg_surface_schedule_configure(struct weston_desktop_xdg_surface
} }
if (surface->configure_idle != NULL) { if (surface->configure_idle != NULL) {
if (!requested_same) if (!pending_same)
return; return;
wl_event_source_remove(surface->configure_idle); wl_event_source_remove(surface->configure_idle);
surface->configure_idle = NULL; surface->configure_idle = NULL;
} else { } else {
if (requested_same) if (pending_same)
return; return;
surface->configure_idle = surface->configure_idle =

Loading…
Cancel
Save