void destroy_xdg_toplevel_v6(struct ds_xdg_toplevel_v6 *toplevel);
+bool xdg_toplevel_v6_scheduled_state_compare(struct ds_xdg_toplevel_v6 *toplevel);
+
+void xdg_toplevel_v6_handle_ack_configure(struct ds_xdg_toplevel_v6 *toplevel,
+ struct ds_xdg_toplevel_v6_configure *configure);
+
void create_xdg_positioner_v6(struct ds_xdg_client_v6 *client, uint32_t id);
struct ds_xdg_popup_v6 *create_xdg_popup_v6(struct ds_xdg_surface_v6 *surface,
{
struct wl_display *display;
struct wl_event_loop *loop;
+ bool scheduled_same = false;
display = wl_client_get_display(surface->client->wl_client);
loop = wl_display_get_event_loop(display);
- if (!surface->configure_idle) {
+ switch (surface->role) {
+ case DS_XDG_SURFACE_V6_ROLE_TOPLEVEL:
+ scheduled_same =
+ xdg_toplevel_v6_scheduled_state_compare(surface->toplevel);
+ break;
+ case DS_XDG_SURFACE_V6_ROLE_POPUP:
+ break;
+ default:
+ case DS_XDG_SURFACE_V6_ROLE_NONE:
+ DS_ASSERT_NOT_REACHED();
+ break;
+ }
+
+ if (surface->configure_idle != NULL) {
+ if (!scheduled_same)
+ goto end;
+
+ wl_event_source_remove(surface->configure_idle);
+ surface->configure_idle = NULL;
+ }
+ else {
+ if (scheduled_same)
+ goto end;
+
surface->scheduled_serial = wl_display_next_serial(display);
surface->configure_idle = wl_event_loop_add_idle(loop,
surface_send_configure, surface);
wl_client_post_no_memory(surface->client->wl_client);
}
+end:
return surface->scheduled_serial;
}
switch (surface->role) {
case DS_XDG_SURFACE_V6_ROLE_TOPLEVEL:
- // TODO
+ xdg_toplevel_v6_handle_ack_configure(surface->toplevel,
+ configure->toplevel_configure);
break;
case DS_XDG_SURFACE_V6_ROLE_POPUP:
break;
toplevel->sent_initial_configure = false;
}
+void
+xdg_toplevel_v6_handle_ack_configure(struct ds_xdg_toplevel_v6 *toplevel,
+ struct ds_xdg_toplevel_v6_configure *configure)
+{
+ toplevel->pending.maximized = configure->maximized;
+ toplevel->pending.fullscreen = configure->fullscreen;
+ toplevel->pending.resizing = configure->resizing;
+ toplevel->pending.activated = configure->activated;
+ toplevel->pending.width = configure->width;
+ toplevel->pending.height = configure->height;
+}
+
+bool
+xdg_toplevel_v6_scheduled_state_compare(struct ds_xdg_toplevel_v6 *toplevel)
+{
+ struct ds_xdg_surface_v6_configure *configure;
+ struct ds_xdg_toplevel_v6_state configured;
+
+ if (!toplevel->sent_initial_configure)
+ return false;
+
+ if (wl_list_empty(&toplevel->base->configure_list)) {
+ configured = toplevel->current;
+ }
+ else {
+ configure = wl_container_of(toplevel->base->configure_list.prev,
+ configure, link);
+ configured.maximized = configure->toplevel_configure->maximized;
+ configured.fullscreen = configure->toplevel_configure->fullscreen ;
+ configured.resizing = configure->toplevel_configure->resizing ;
+ configured.activated = configure->toplevel_configure->activated ;
+ configured.width = configure->toplevel_configure->width;
+ configured.height = configure->toplevel_configure->height;
+ }
+
+ if (toplevel->scheduled.activated != configured.activated)
+ return false;
+ if (toplevel->scheduled.fullscreen != configured.fullscreen)
+ return false;
+ if (toplevel->scheduled.maximized != configured.maximized)
+ return false;
+ if (toplevel->scheduled.resizing != configured.resizing)
+ return false;
+
+ if (toplevel->scheduled.width == configured.width &&
+ toplevel->scheduled.height == configured.height)
+ return true;
+
+ if (toplevel->scheduled.width == 0 && toplevel->scheduled.height == 0)
+ return true;
+
+ return false;
+}
+
static void
xdg_toplevel_v6_handle_destroy(struct wl_client *client,
struct wl_resource *resource)