|
|
|
@ -9,6 +9,7 @@
|
|
|
|
|
#include <wlr/types/wlr_surface.h>
|
|
|
|
|
#include <wlr/types/wlr_seat.h>
|
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
|
#include <wlr/render/interface.h>
|
|
|
|
|
#include "xdg-shell-unstable-v6-protocol.h"
|
|
|
|
|
|
|
|
|
|
static const char *wlr_desktop_xdg_toplevel_role = "xdg_toplevel";
|
|
|
|
@ -802,10 +803,7 @@ static void xdg_surface_ack_configure(struct wl_client *client,
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!surface->configured) {
|
|
|
|
|
surface->configured = true;
|
|
|
|
|
wl_signal_emit(&surface->client->shell->events.new_surface, surface);
|
|
|
|
|
}
|
|
|
|
|
surface->configured = true;
|
|
|
|
|
|
|
|
|
|
wl_signal_emit(&surface->events.ack_configure, surface);
|
|
|
|
|
|
|
|
|
@ -843,6 +841,10 @@ static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = {
|
|
|
|
|
static bool wlr_xdg_surface_v6_toplevel_state_compare(
|
|
|
|
|
struct wlr_xdg_toplevel_v6 *state) {
|
|
|
|
|
// is pending state different from current state?
|
|
|
|
|
if (!state->base->configured) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state->pending.activated != state->current.activated) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -996,7 +998,7 @@ static void wlr_xdg_surface_v6_toplevel_committed(
|
|
|
|
|
struct wlr_xdg_surface_v6 *surface) {
|
|
|
|
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
|
|
|
|
|
|
|
|
|
if (!surface->surface->current->buffer && !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
|
|
|
|
|
// is added
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, true);
|
|
|
|
@ -1004,7 +1006,7 @@ static void wlr_xdg_surface_v6_toplevel_committed(
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!surface->surface->current->buffer) {
|
|
|
|
|
if (!surface->surface->texture->valid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1026,7 +1028,7 @@ static void handle_wlr_surface_committed(struct wl_listener *listener,
|
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
|
wl_container_of(listener, surface, surface_commit_listener);
|
|
|
|
|
|
|
|
|
|
if (surface->surface->current->buffer && !surface->configured) {
|
|
|
|
|
if (surface->surface->texture->valid && !surface->configured) {
|
|
|
|
|
wl_resource_post_error(surface->resource,
|
|
|
|
|
ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER,
|
|
|
|
|
"xdg_surface has never been configured");
|
|
|
|
@ -1055,6 +1057,11 @@ static void handle_wlr_surface_committed(struct wl_listener *listener,
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (surface->configured && !surface->added) {
|
|
|
|
|
surface->added = true;
|
|
|
|
|
wl_signal_emit(&surface->client->shell->events.new_surface, surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl_signal_emit(&surface->events.commit, surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1090,7 +1097,7 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client,
|
|
|
|
|
&zxdg_surface_v6_interface, wl_resource_get_version(client_resource),
|
|
|
|
|
id);
|
|
|
|
|
|
|
|
|
|
if (surface->surface->current->buffer != NULL) {
|
|
|
|
|
if (surface->surface->texture->valid) {
|
|
|
|
|
wl_resource_post_error(surface->resource,
|
|
|
|
|
ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER,
|
|
|
|
|
"xdg_surface must not have a buffer at creation");
|
|
|
|
@ -1258,42 +1265,49 @@ 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,
|
|
|
|
|
uint32_t width, uint32_t height) {
|
|
|
|
|
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.height = height;
|
|
|
|
|
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, false);
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
|
bool activated) {
|
|
|
|
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
|
|
|
|
bool force = surface->toplevel_state->pending.activated != activated;
|
|
|
|
|
surface->toplevel_state->pending.activated = activated;
|
|
|
|
|
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, false);
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
|
bool maximized) {
|
|
|
|
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
|
|
|
|
bool force = surface->toplevel_state->pending.maximized != maximized;
|
|
|
|
|
surface->toplevel_state->pending.maximized = maximized;
|
|
|
|
|
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, false);
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
|
bool fullscreen) {
|
|
|
|
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
|
|
|
|
bool force = surface->toplevel_state->pending.fullscreen != fullscreen;
|
|
|
|
|
surface->toplevel_state->pending.fullscreen = fullscreen;
|
|
|
|
|
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, false);
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
|
bool resizing) {
|
|
|
|
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
|
|
|
|
surface->toplevel_state->pending.fullscreen = resizing;
|
|
|
|
|
bool force = surface->toplevel_state->pending.resizing != resizing;
|
|
|
|
|
surface->toplevel_state->pending.resizing = resizing;
|
|
|
|
|
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, false);
|
|
|
|
|
wlr_xdg_surface_v6_schedule_configure(surface, force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
|
|
|
|
|