|
|
@ -785,23 +785,23 @@ static void xdg_toplevel_handle_set_max_size(struct wl_client *client,
|
|
|
|
struct wl_resource *resource, int32_t width, int32_t height) {
|
|
|
|
struct wl_resource *resource, int32_t width, int32_t height) {
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
surface->toplevel->next.max_width = width;
|
|
|
|
surface->toplevel->client_pending.max_width = width;
|
|
|
|
surface->toplevel->next.max_height = height;
|
|
|
|
surface->toplevel->client_pending.max_height = height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void xdg_toplevel_handle_set_min_size(struct wl_client *client,
|
|
|
|
static void xdg_toplevel_handle_set_min_size(struct wl_client *client,
|
|
|
|
struct wl_resource *resource, int32_t width, int32_t height) {
|
|
|
|
struct wl_resource *resource, int32_t width, int32_t height) {
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
surface->toplevel->next.min_width = width;
|
|
|
|
surface->toplevel->client_pending.min_width = width;
|
|
|
|
surface->toplevel->next.min_height = height;
|
|
|
|
surface->toplevel->client_pending.min_height = height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void xdg_toplevel_handle_set_maximized(struct wl_client *client,
|
|
|
|
static void xdg_toplevel_handle_set_maximized(struct wl_client *client,
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
surface->toplevel->next.maximized = true;
|
|
|
|
surface->toplevel->client_pending.maximized = true;
|
|
|
|
wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface);
|
|
|
|
wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -809,7 +809,7 @@ static void xdg_toplevel_handle_unset_maximized(struct wl_client *client,
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
struct wl_resource *resource) {
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
surface->toplevel->next.maximized = false;
|
|
|
|
surface->toplevel->client_pending.maximized = false;
|
|
|
|
wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface);
|
|
|
|
wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -823,7 +823,7 @@ static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client,
|
|
|
|
output = wlr_output_from_resource(output_resource);
|
|
|
|
output = wlr_output_from_resource(output_resource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
surface->toplevel->next.fullscreen = true;
|
|
|
|
surface->toplevel->client_pending.fullscreen = true;
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_toplevel_v6_set_fullscreen_event event = {
|
|
|
|
struct wlr_xdg_toplevel_v6_set_fullscreen_event event = {
|
|
|
|
.surface = surface,
|
|
|
|
.surface = surface,
|
|
|
@ -839,7 +839,7 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client,
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
struct wlr_xdg_surface_v6 *surface =
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
xdg_surface_from_xdg_toplevel_resource(resource);
|
|
|
|
|
|
|
|
|
|
|
|
surface->toplevel->next.fullscreen = false;
|
|
|
|
surface->toplevel->client_pending.fullscreen = false;
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_toplevel_v6_set_fullscreen_event event = {
|
|
|
|
struct wlr_xdg_toplevel_v6_set_fullscreen_event event = {
|
|
|
|
.surface = surface,
|
|
|
|
.surface = surface,
|
|
|
@ -1057,25 +1057,25 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare(
|
|
|
|
configured.height = configure->toplevel_state->height;
|
|
|
|
configured.height = configure->toplevel_state->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (state->pending.activated != configured.state.activated) {
|
|
|
|
if (state->server_pending.activated != configured.state.activated) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (state->pending.fullscreen != configured.state.fullscreen) {
|
|
|
|
if (state->server_pending.fullscreen != configured.state.fullscreen) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (state->pending.maximized != configured.state.maximized) {
|
|
|
|
if (state->server_pending.maximized != configured.state.maximized) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (state->pending.resizing != configured.state.resizing) {
|
|
|
|
if (state->server_pending.resizing != configured.state.resizing) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (state->pending.width == configured.width &&
|
|
|
|
if (state->server_pending.width == configured.width &&
|
|
|
|
state->pending.height == configured.height) {
|
|
|
|
state->server_pending.height == configured.height) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (state->pending.width == 0 && state->pending.height == 0) {
|
|
|
|
if (state->server_pending.width == 0 && state->server_pending.height == 0) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1093,12 +1093,12 @@ static void wlr_xdg_toplevel_v6_send_configure(
|
|
|
|
wl_resource_post_no_memory(surface->toplevel->resource);
|
|
|
|
wl_resource_post_no_memory(surface->toplevel->resource);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*configure->toplevel_state = surface->toplevel->pending;
|
|
|
|
*configure->toplevel_state = surface->toplevel->server_pending;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t *s;
|
|
|
|
uint32_t *s;
|
|
|
|
struct wl_array states;
|
|
|
|
struct wl_array states;
|
|
|
|
wl_array_init(&states);
|
|
|
|
wl_array_init(&states);
|
|
|
|
if (surface->toplevel->pending.maximized) {
|
|
|
|
if (surface->toplevel->server_pending.maximized) {
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
if (!s) {
|
|
|
|
if (!s) {
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel");
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel");
|
|
|
@ -1106,7 +1106,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (surface->toplevel->pending.fullscreen) {
|
|
|
|
if (surface->toplevel->server_pending.fullscreen) {
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
if (!s) {
|
|
|
|
if (!s) {
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel");
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel");
|
|
|
@ -1114,7 +1114,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (surface->toplevel->pending.resizing) {
|
|
|
|
if (surface->toplevel->server_pending.resizing) {
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
if (!s) {
|
|
|
|
if (!s) {
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel");
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel");
|
|
|
@ -1122,7 +1122,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (surface->toplevel->pending.activated) {
|
|
|
|
if (surface->toplevel->server_pending.activated) {
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
s = wl_array_add(&states, sizeof(uint32_t));
|
|
|
|
if (!s) {
|
|
|
|
if (!s) {
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel");
|
|
|
|
wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel");
|
|
|
@ -1131,8 +1131,8 @@ static void wlr_xdg_toplevel_v6_send_configure(
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
|
|
|
|
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t width = surface->toplevel->pending.width;
|
|
|
|
uint32_t width = surface->toplevel->server_pending.width;
|
|
|
|
uint32_t height = surface->toplevel->pending.height;
|
|
|
|
uint32_t height = surface->toplevel->server_pending.height;
|
|
|
|
zxdg_toplevel_v6_send_configure(surface->toplevel->resource, width,
|
|
|
|
zxdg_toplevel_v6_send_configure(surface->toplevel->resource, width,
|
|
|
|
height, &states);
|
|
|
|
height, &states);
|
|
|
|
|
|
|
|
|
|
|
@ -1240,13 +1240,13 @@ static void wlr_xdg_surface_v6_toplevel_committed(
|
|
|
|
|
|
|
|
|
|
|
|
// update state that doesn't need compositor approval
|
|
|
|
// update state that doesn't need compositor approval
|
|
|
|
surface->toplevel->current.max_width =
|
|
|
|
surface->toplevel->current.max_width =
|
|
|
|
surface->toplevel->next.max_width;
|
|
|
|
surface->toplevel->client_pending.max_width;
|
|
|
|
surface->toplevel->current.min_width =
|
|
|
|
surface->toplevel->current.min_width =
|
|
|
|
surface->toplevel->next.min_width;
|
|
|
|
surface->toplevel->client_pending.min_width;
|
|
|
|
surface->toplevel->current.max_height =
|
|
|
|
surface->toplevel->current.max_height =
|
|
|
|
surface->toplevel->next.max_height;
|
|
|
|
surface->toplevel->client_pending.max_height;
|
|
|
|
surface->toplevel->current.min_height =
|
|
|
|
surface->toplevel->current.min_height =
|
|
|
|
surface->toplevel->next.min_height;
|
|
|
|
surface->toplevel->client_pending.min_height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wlr_xdg_surface_v6_popup_committed(
|
|
|
|
static void wlr_xdg_surface_v6_popup_committed(
|
|
|
@ -1531,8 +1531,8 @@ void wlr_xdg_surface_v6_ping(struct wlr_xdg_surface_v6 *surface) {
|
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t 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);
|
|
|
|
surface->toplevel->pending.width = width;
|
|
|
|
surface->toplevel->server_pending.width = width;
|
|
|
|
surface->toplevel->pending.height = height;
|
|
|
|
surface->toplevel->server_pending.height = height;
|
|
|
|
|
|
|
|
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1540,7 +1540,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t 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);
|
|
|
|
surface->toplevel->pending.activated = activated;
|
|
|
|
surface->toplevel->server_pending.activated = activated;
|
|
|
|
|
|
|
|
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1548,7 +1548,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t 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);
|
|
|
|
surface->toplevel->pending.maximized = maximized;
|
|
|
|
surface->toplevel->server_pending.maximized = maximized;
|
|
|
|
|
|
|
|
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1556,7 +1556,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t 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);
|
|
|
|
surface->toplevel->pending.fullscreen = fullscreen;
|
|
|
|
surface->toplevel->server_pending.fullscreen = fullscreen;
|
|
|
|
|
|
|
|
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1564,7 +1564,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
uint32_t 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);
|
|
|
|
surface->toplevel->pending.resizing = resizing;
|
|
|
|
surface->toplevel->server_pending.resizing = resizing;
|
|
|
|
|
|
|
|
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
return wlr_xdg_surface_v6_schedule_configure(surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|