Address feedback

This commit is contained in:
Drew DeVault 2018-03-18 13:58:01 -04:00
parent 1628730b09
commit 88eec637a4
9 changed files with 131 additions and 162 deletions

View file

@ -48,6 +48,7 @@ struct wlr_layer_surface_state {
struct { struct {
uint32_t top, right, bottom, left; uint32_t top, right, bottom, left;
} margin; } margin;
bool keyboard_interactive;
// Server // Server
uint32_t width, height; uint32_t width, height;
}; };
@ -73,8 +74,8 @@ struct wlr_layer_surface {
uint32_t configure_next_serial; uint32_t configure_next_serial;
struct wl_list configure_list; struct wl_list configure_list;
struct wlr_layer_surface_state next; // client protocol requests struct wlr_layer_surface_state client_pending;
struct wlr_layer_surface_state pending; // our configure requests struct wlr_layer_surface_state server_pending;
struct wlr_layer_surface_state current; struct wlr_layer_surface_state current;
struct wl_listener surface_destroy_listener; struct wl_listener surface_destroy_listener;

View file

@ -78,8 +78,8 @@ struct wlr_xdg_toplevel {
struct wlr_xdg_surface *parent; struct wlr_xdg_surface *parent;
bool added; bool added;
struct wlr_xdg_toplevel_state next; // client protocol requests struct wlr_xdg_toplevel_state client_pending;
struct wlr_xdg_toplevel_state pending; // our configure requests struct wlr_xdg_toplevel_state server_pending;
struct wlr_xdg_toplevel_state current; struct wlr_xdg_toplevel_state current;
char *title; char *title;

View file

@ -78,8 +78,8 @@ struct wlr_xdg_toplevel_v6 {
struct wlr_xdg_surface_v6 *parent; struct wlr_xdg_surface_v6 *parent;
bool added; bool added;
struct wlr_xdg_toplevel_v6_state next; // client protocol requests struct wlr_xdg_toplevel_v6_state client_pending;
struct wlr_xdg_toplevel_v6_state pending; // user configure requests struct wlr_xdg_toplevel_v6_state server_pending;
struct wlr_xdg_toplevel_v6_state current; struct wlr_xdg_toplevel_v6_state current;
char *title; char *title;

View file

@ -61,7 +61,6 @@
<entry name="role" value="0" summary="wl_surface has another role"/> <entry name="role" value="0" summary="wl_surface has another role"/>
<entry name="invalid_layer" value="1" summary="layer value is invalid"/> <entry name="invalid_layer" value="1" summary="layer value is invalid"/>
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/> <entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
<entry name="request_denied" value="4" summary="the compositor has denied your request to use this layer"/>
</enum> </enum>
<enum name="layer"> <enum name="layer">
@ -87,11 +86,9 @@
are designed to be rendered as a layer of a stacked desktop-like are designed to be rendered as a layer of a stacked desktop-like
environment. environment.
Layer surface state (anchor, exclusive zone, margin) is double-buffered. Layer surface state (anchor, exclusive zone, margin, interactivity) is
Protocol requests modify the pending state, as opposed to the current double-buffered, and will be applied at the time wl_surface.commit of the
state in use by the compositor. The wl_surface.commit request atomically corresponding wl_surface is called.
applies all pending state, replacing the current state. After commit, the
new pending state is as documented for each related request.
</description> </description>
<request name="set_anchor"> <request name="set_anchor">
@ -129,12 +126,31 @@
point on the output, in pixels. Setting this value for edges you are point on the output, in pixels. Setting this value for edges you are
not anchored to has no effect. not anchored to has no effect.
The exclusive zone includes the margin.
Margin is double-buffered, see wl_surface.commit. Margin is double-buffered, see wl_surface.commit.
</description> </description>
<arg name="top" type="uint"/> <arg name="top" type="int"/>
<arg name="right" type="uint"/> <arg name="right" type="int"/>
<arg name="bottom" type="uint"/> <arg name="bottom" type="int"/>
<arg name="left" type="uint"/> <arg name="left" type="int"/>
</request>
<request name="set_keyboard_interactivity">
<description summary="requests keyboard events">
Set to 1 to request that the seat send keyboard events to this layer
surface. For layers below the shell surface layer, the seat will use
normal focus semantics. For layers above the shell surface layers, the
seat will always give exclusive keyboard focus to the top-most layer
which has keyboard interactivity set to true.
Layer surfaces receive pointer, touch, and tablet events normally. If
you do not want to receive them, set the input region on your surface
to an empty region.
Events is double-buffered, see wl_surface.commit.
</description>
<arg name="keyboard_interactivity" type="uint"/>
</request> </request>
<request name="get_popup"> <request name="get_popup">
@ -150,15 +166,6 @@
<arg name="popup" type="object" interface="xdg_popup"/> <arg name="popup" type="object" interface="xdg_popup"/>
</request> </request>
<request name="get_input">
<description summary="obtain a layer input for this layer surface">
This creates a layer input for this layer surface. This can be used to
control input semantics for the layer surface on the specified wl_seat.
</description>
<arg name="id" type="new_id" interface="zwlr_layer_input_v1"/>
<arg name="seat" type="object" interface="wl_seat"/>
</request>
<request name="ack_configure"> <request name="ack_configure">
<description summary="ack a configure event"> <description summary="ack a configure event">
When a configure event is received, if a client commits the When a configure event is received, if a client commits the
@ -228,52 +235,4 @@
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/> <entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
</enum> </enum>
</interface> </interface>
<interface name="zwlr_layer_input_v1" version="1">
<description summary="layer surface input configuration object">
Clients can use this interface to specify input semantics for a layer
surface on a given seat. By default, layer surfaces are considered
non-interactive by seats, and will not participate in their focus
semantics or receive input events for them.
Input state is double-buffered. Protocol requests modify the pending
state, as opposed to the current state in use by the compositor. The
wl_surface.commit request for the associated layer surface atomically
applies all pending state, replacing the current state. After commit, the
new pending state is as documented for each related request.
</description>
<request name="set_events">
<description summary="set input events to receive">
Requests that the seat send input events for the specified input devices
to this layer surface.
Positional events (pointer and touch) will only be sent if the layer
surface is the top-most interactive surface, and only when the position
of these events are relative to the surface. Enter and leave events will
be signalled normally in these cases.
Keyboard events will treat the layer surface as the only focused surface
on the seat. Upon requesting keyboard events, the layer surface will
receive a keyboard enter event. A leave event is signalled when it
invokes set_events again without keyboard events specified.
Events is double-buffered, see wl_surface.commit.
</description>
<arg name="events" type="uint" enum="input_device"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the layer_input">
This request destroys the layer input.
</description>
</request>
<enum name="input_device" bitfield="true">
<entry name="pointer" value="1" summary="wl_pointer devices"/>
<entry name="keyboard" value="2" summary="wl_keyboard devices"/>
<entry name="touch" value="4" summary="wl_touch devices"/>
<entry name="tablet" value="8" summary="zwp_tablet and zwp_tablet_tool devices"/>
</enum>
</interface>
</protocol> </protocol>

View file

@ -252,7 +252,7 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
return; return;
} }
view_maximize(view, surface->toplevel->next.maximized); view_maximize(view, surface->toplevel->client_pending.maximized);
} }
static void handle_request_fullscreen(struct wl_listener *listener, static void handle_request_fullscreen(struct wl_listener *listener,
@ -403,10 +403,10 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
view->destroy = destroy; view->destroy = destroy;
roots_surface->view = view; roots_surface->view = view;
if (surface->toplevel->next.maximized) { if (surface->toplevel->client_pending.maximized) {
view_maximize(view, true); view_maximize(view, true);
} }
if (surface->toplevel->next.fullscreen) { if (surface->toplevel->client_pending.fullscreen) {
view_set_fullscreen(view, true, NULL); view_set_fullscreen(view, true, NULL);
} }
} }

View file

@ -254,7 +254,7 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
return; return;
} }
view_maximize(view, surface->toplevel->next.maximized); view_maximize(view, surface->toplevel->client_pending.maximized);
} }
static void handle_request_fullscreen(struct wl_listener *listener, static void handle_request_fullscreen(struct wl_listener *listener,
@ -405,10 +405,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
view->destroy = destroy; view->destroy = destroy;
roots_surface->view = view; roots_surface->view = view;
if (surface->toplevel->next.maximized) { if (surface->toplevel->client_pending.maximized) {
view_maximize(view, true); view_maximize(view, true);
} }
if (surface->toplevel->next.fullscreen) { if (surface->toplevel->client_pending.fullscreen) {
view_set_fullscreen(view, true, NULL); view_set_fullscreen(view, true, NULL);
} }
} }

View file

@ -76,23 +76,30 @@ static void layer_surface_handle_ack_configure(struct wl_client *client,
static void layer_surface_handle_set_anchor(struct wl_client *client, static void layer_surface_handle_set_anchor(struct wl_client *client,
struct wl_resource *resource, uint32_t anchor) { struct wl_resource *resource, uint32_t anchor) {
struct wlr_layer_surface *surface = layer_surface_from_resource(resource); struct wlr_layer_surface *surface = layer_surface_from_resource(resource);
surface->next.anchor = anchor; surface->client_pending.anchor = anchor;
} }
static void layer_surface_handle_set_exclusive_zone(struct wl_client *client, static void layer_surface_handle_set_exclusive_zone(struct wl_client *client,
struct wl_resource *resource, uint32_t zone) { struct wl_resource *resource, uint32_t zone) {
struct wlr_layer_surface *surface = layer_surface_from_resource(resource); struct wlr_layer_surface *surface = layer_surface_from_resource(resource);
surface->next.exclusive_zone = zone; surface->client_pending.exclusive_zone = zone;
} }
static void layer_surface_handle_set_margin(struct wl_client *client, static void layer_surface_handle_set_margin(
struct wl_resource *resource, uint32_t top, struct wl_client *client, struct wl_resource *resource,
uint32_t right, uint32_t bottom, uint32_t left) { int32_t top, int32_t right, int32_t bottom, int32_t left) {
struct wlr_layer_surface *surface = layer_surface_from_resource(resource); struct wlr_layer_surface *surface = layer_surface_from_resource(resource);
surface->next.margin.top = top; surface->client_pending.margin.top = top;
surface->next.margin.right = right; surface->client_pending.margin.right = right;
surface->next.margin.bottom = bottom; surface->client_pending.margin.bottom = bottom;
surface->next.margin.left = left; surface->client_pending.margin.left = left;
}
static void layer_surface_handle_set_keyboard_interactivity(
struct wl_client *client, struct wl_resource *resource,
uint32_t interactive) {
struct wlr_layer_surface *surface = layer_surface_from_resource(resource);
surface->client_pending.keyboard_interactive = interactive == 1;
} }
static void layer_surface_handle_get_popup(struct wl_client *client, static void layer_surface_handle_get_popup(struct wl_client *client,
@ -100,19 +107,14 @@ static void layer_surface_handle_get_popup(struct wl_client *client,
// TODO // TODO
} }
static void layer_surface_handle_get_input(struct wl_client *client,
struct wl_resource *resource, uint32_t id, struct wl_resource *seat) {
// TODO
}
static const struct zwlr_layer_surface_v1_interface layer_surface_implementation = { static const struct zwlr_layer_surface_v1_interface layer_surface_implementation = {
.destroy = resource_handle_destroy, .destroy = resource_handle_destroy,
.ack_configure = layer_surface_handle_ack_configure, .ack_configure = layer_surface_handle_ack_configure,
.set_anchor = layer_surface_handle_set_anchor, .set_anchor = layer_surface_handle_set_anchor,
.set_exclusive_zone = layer_surface_handle_set_exclusive_zone, .set_exclusive_zone = layer_surface_handle_set_exclusive_zone,
.set_margin = layer_surface_handle_set_margin, .set_margin = layer_surface_handle_set_margin,
.set_keyboard_interactivity = layer_surface_handle_set_keyboard_interactivity,
.get_popup = layer_surface_handle_get_popup, .get_popup = layer_surface_handle_get_popup,
.get_input = layer_surface_handle_get_input,
}; };
static void layer_surface_unmap(struct wlr_layer_surface *surface) { static void layer_surface_unmap(struct wlr_layer_surface *surface) {
@ -165,7 +167,7 @@ static bool wlr_layer_surface_state_changed(struct wlr_layer_surface *surface) {
state = &configure->state; state = &configure->state;
} }
return !memcmp(state, &surface->pending, return !memcmp(state, &surface->server_pending,
sizeof(struct wlr_layer_surface_state)); sizeof(struct wlr_layer_surface_state));
} }
@ -181,7 +183,7 @@ static void wlr_layer_surface_send_configure(void *user_data) {
wl_list_insert(surface->configure_list.prev, &configure->link); wl_list_insert(surface->configure_list.prev, &configure->link);
configure->serial = surface->configure_next_serial; configure->serial = surface->configure_next_serial;
configure->state = surface->pending; configure->state = surface->server_pending;
zwlr_layer_surface_v1_send_configure(surface->resource, zwlr_layer_surface_v1_send_configure(surface->resource,
configure->serial, configure->state.width, configure->state.height); configure->serial, configure->state.width, configure->state.height);
@ -216,8 +218,8 @@ static uint32_t wlr_layer_surface_schedule_configure(
void wlr_layer_surface_configure(struct wlr_layer_surface *surface, void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
uint32_t width, uint32_t height) { uint32_t width, uint32_t height) {
surface->pending.width = width; surface->server_pending.width = width;
surface->pending.height = height; surface->server_pending.height = height;
wlr_layer_surface_schedule_configure(surface); wlr_layer_surface_schedule_configure(surface);
} }
@ -231,6 +233,13 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
"layer_surface has never been configured"); "layer_surface has never been configured");
return; return;
} }
surface->current.anchor = surface->client_pending.anchor;
surface->current.exclusive_zone = surface->client_pending.exclusive_zone;
surface->current.margin = surface->client_pending.margin;
surface->current.keyboard_interactive =
surface->client_pending.keyboard_interactive;
if (!surface->added) { if (!surface->added) {
surface->added = true; surface->added = true;
wlr_signal_emit_safe(&surface->client->shell->events.new_surface, wlr_signal_emit_safe(&surface->client->shell->events.new_surface,

View file

@ -815,23 +815,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 *surface = struct wlr_xdg_surface *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 *surface = struct wlr_xdg_surface *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 *surface = struct wlr_xdg_surface *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);
} }
@ -839,7 +839,7 @@ static void xdg_toplevel_handle_unset_maximized(struct wl_client *client,
struct wl_resource *resource) { struct wl_resource *resource) {
struct wlr_xdg_surface *surface = struct wlr_xdg_surface *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);
} }
@ -853,7 +853,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_set_fullscreen_event event = { struct wlr_xdg_toplevel_set_fullscreen_event event = {
.surface = surface, .surface = surface,
@ -869,7 +869,7 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client,
struct wlr_xdg_surface *surface = struct wlr_xdg_surface *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_set_fullscreen_event event = { struct wlr_xdg_toplevel_set_fullscreen_event event = {
.surface = surface, .surface = surface,
@ -1087,25 +1087,25 @@ static bool wlr_xdg_surface_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;
} }
@ -1123,12 +1123,12 @@ static void wlr_xdg_toplevel_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");
@ -1136,7 +1136,7 @@ static void wlr_xdg_toplevel_send_configure(
} }
*s = XDG_TOPLEVEL_STATE_MAXIMIZED; *s = XDG_TOPLEVEL_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");
@ -1144,7 +1144,7 @@ static void wlr_xdg_toplevel_send_configure(
} }
*s = XDG_TOPLEVEL_STATE_FULLSCREEN; *s = XDG_TOPLEVEL_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");
@ -1152,7 +1152,7 @@ static void wlr_xdg_toplevel_send_configure(
} }
*s = XDG_TOPLEVEL_STATE_RESIZING; *s = XDG_TOPLEVEL_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");
@ -1161,8 +1161,8 @@ static void wlr_xdg_toplevel_send_configure(
*s = XDG_TOPLEVEL_STATE_ACTIVATED; *s = XDG_TOPLEVEL_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;
xdg_toplevel_send_configure(surface->toplevel->resource, width, height, xdg_toplevel_send_configure(surface->toplevel->resource, width, height,
&states); &states);
@ -1270,13 +1270,13 @@ static void wlr_xdg_surface_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_popup_committed( static void wlr_xdg_surface_popup_committed(
@ -1561,8 +1561,8 @@ void wlr_xdg_surface_ping(struct wlr_xdg_surface *surface) {
uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
uint32_t width, uint32_t height) { uint32_t width, uint32_t height) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_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_schedule_configure(surface); return wlr_xdg_surface_schedule_configure(surface);
} }
@ -1570,7 +1570,7 @@ uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
bool activated) { bool activated) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->pending.activated = activated; surface->toplevel->server_pending.activated = activated;
return wlr_xdg_surface_schedule_configure(surface); return wlr_xdg_surface_schedule_configure(surface);
} }
@ -1578,7 +1578,7 @@ uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
bool maximized) { bool maximized) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->pending.maximized = maximized; surface->toplevel->server_pending.maximized = maximized;
return wlr_xdg_surface_schedule_configure(surface); return wlr_xdg_surface_schedule_configure(surface);
} }
@ -1586,7 +1586,7 @@ uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
bool fullscreen) { bool fullscreen) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->pending.fullscreen = fullscreen; surface->toplevel->server_pending.fullscreen = fullscreen;
return wlr_xdg_surface_schedule_configure(surface); return wlr_xdg_surface_schedule_configure(surface);
} }
@ -1594,7 +1594,7 @@ uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
bool resizing) { bool resizing) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->pending.resizing = resizing; surface->toplevel->server_pending.resizing = resizing;
return wlr_xdg_surface_schedule_configure(surface); return wlr_xdg_surface_schedule_configure(surface);
} }

View file

@ -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);
} }