@@ -87,12 +87,17 @@ static void layer_surface_handle_ack_configure(struct wl_client *client,
87
87
layer_surface_configure_destroy (configure );
88
88
}
89
89
90
- if (surface -> acked_configure ) {
91
- layer_surface_configure_destroy (surface -> acked_configure );
92
- }
93
- surface -> acked_configure = configure ;
94
- wl_list_remove (& configure -> link );
95
- wl_list_init (& configure -> link );
90
+ surface -> last_acked .serial = configure -> serial ;
91
+ surface -> last_acked .width = configure -> width ;
92
+ surface -> last_acked .height = configure -> height ;
93
+
94
+ surface -> pending .configure_serial = configure -> serial ;
95
+ surface -> pending .actual_width = configure -> width ;
96
+ surface -> pending .actual_height = configure -> height ;
97
+
98
+ surface -> configured = true;
99
+
100
+ layer_surface_configure_destroy (configure );
96
101
}
97
102
98
103
static void layer_surface_handle_set_size (struct wl_client * client ,
@@ -102,8 +107,8 @@ static void layer_surface_handle_set_size(struct wl_client *client,
102
107
if (!surface ) {
103
108
return ;
104
109
}
105
- surface -> client_pending .desired_width = width ;
106
- surface -> client_pending .desired_height = height ;
110
+ surface -> pending .desired_width = width ;
111
+ surface -> pending .desired_height = height ;
107
112
}
108
113
109
114
static void layer_surface_handle_set_anchor (struct wl_client * client ,
@@ -123,7 +128,7 @@ static void layer_surface_handle_set_anchor(struct wl_client *client,
123
128
if (!surface ) {
124
129
return ;
125
130
}
126
- surface -> client_pending .anchor = anchor ;
131
+ surface -> pending .anchor = anchor ;
127
132
}
128
133
129
134
static void layer_surface_handle_set_exclusive_zone (struct wl_client * client ,
@@ -133,7 +138,7 @@ static void layer_surface_handle_set_exclusive_zone(struct wl_client *client,
133
138
if (!surface ) {
134
139
return ;
135
140
}
136
- surface -> client_pending .exclusive_zone = zone ;
141
+ surface -> pending .exclusive_zone = zone ;
137
142
}
138
143
139
144
static void layer_surface_handle_set_margin (
@@ -144,10 +149,10 @@ static void layer_surface_handle_set_margin(
144
149
if (!surface ) {
145
150
return ;
146
151
}
147
- surface -> client_pending .margin .top = top ;
148
- surface -> client_pending .margin .right = right ;
149
- surface -> client_pending .margin .bottom = bottom ;
150
- surface -> client_pending .margin .left = left ;
152
+ surface -> pending .margin .top = top ;
153
+ surface -> pending .margin .right = right ;
154
+ surface -> pending .margin .bottom = bottom ;
155
+ surface -> pending .margin .left = left ;
151
156
}
152
157
153
158
static void layer_surface_handle_set_keyboard_interactivity (
@@ -160,14 +165,14 @@ static void layer_surface_handle_set_keyboard_interactivity(
160
165
}
161
166
162
167
if (wl_resource_get_version (resource ) < ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION ) {
163
- surface -> client_pending .keyboard_interactive = !!interactive ;
168
+ surface -> pending .keyboard_interactive = !!interactive ;
164
169
} else {
165
170
if (interactive > ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND ) {
166
171
wl_resource_post_error (resource ,
167
172
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY ,
168
173
"wrong keyboard interactivity value: %" PRIu32 , interactive );
169
174
} else {
170
- surface -> client_pending .keyboard_interactive = interactive ;
175
+ surface -> pending .keyboard_interactive = interactive ;
171
176
}
172
177
}
173
178
}
@@ -203,7 +208,7 @@ static void layer_surface_set_layer(struct wl_client *client,
203
208
"Invalid layer %" PRIu32 , layer );
204
209
return ;
205
210
}
206
- surface -> client_pending .layer = layer ;
211
+ surface -> pending .layer = layer ;
207
212
}
208
213
209
214
static const struct zwlr_layer_surface_v1_interface layer_surface_implementation = {
@@ -233,8 +238,6 @@ static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
233
238
}
234
239
235
240
surface -> configured = surface -> mapped = false;
236
- surface -> configure_serial = 0 ;
237
- surface -> configure_next_serial = 0 ;
238
241
}
239
242
240
243
static void layer_surface_destroy (struct wlr_layer_surface_v1 * surface ) {
@@ -258,30 +261,23 @@ static void layer_surface_resource_destroy(struct wl_resource *resource) {
258
261
}
259
262
260
263
static bool layer_surface_state_changed (struct wlr_layer_surface_v1 * surface ) {
261
- struct wlr_layer_surface_v1_state * state ;
264
+ struct wlr_layer_surface_v1_configure * configure ;
262
265
if (wl_list_empty (& surface -> configure_list )) {
263
- if (surface -> acked_configure ) {
264
- state = & surface -> acked_configure -> state ;
265
- } else if (!surface -> configured ) {
266
- return true;
267
- } else {
268
- state = & surface -> current ;
269
- }
266
+ configure = & surface -> last_acked ;
270
267
} else {
271
- struct wlr_layer_surface_v1_configure * configure =
272
- wl_container_of (surface -> configure_list .prev , configure , link );
273
- state = & configure -> state ;
268
+ configure = wl_container_of (surface -> configure_list .prev ,
269
+ configure , link );
274
270
}
275
271
276
- bool changed = state -> actual_width != surface -> server_pending . actual_width
277
- || state -> actual_height != surface -> server_pending . actual_height ;
272
+ bool changed = configure -> width != surface -> scheduled . width
273
+ || configure -> height != surface -> scheduled . height ;
278
274
return changed ;
279
275
}
280
276
281
277
void wlr_layer_surface_v1_configure (struct wlr_layer_surface_v1 * surface ,
282
278
uint32_t width , uint32_t height ) {
283
- surface -> server_pending . actual_width = width ;
284
- surface -> server_pending . actual_height = height ;
279
+ surface -> scheduled . width = width ;
280
+ surface -> scheduled . height = height ;
285
281
if (layer_surface_state_changed (surface )) {
286
282
struct wl_display * display =
287
283
wl_client_get_display (wl_resource_get_client (surface -> resource ));
@@ -291,14 +287,14 @@ void wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
291
287
wl_client_post_no_memory (wl_resource_get_client (surface -> resource ));
292
288
return ;
293
289
}
294
- surface -> configure_next_serial = wl_display_next_serial (display );
290
+ surface -> scheduled . serial = wl_display_next_serial (display );
295
291
wl_list_insert (surface -> configure_list .prev , & configure -> link );
296
- configure -> state . actual_width = width ;
297
- configure -> state . actual_height = height ;
298
- configure -> serial = surface -> configure_next_serial ;
292
+ configure -> width = width ;
293
+ configure -> height = height ;
294
+ configure -> serial = surface -> scheduled . serial ;
299
295
zwlr_layer_surface_v1_send_configure (surface -> resource ,
300
- configure -> serial , configure -> state . actual_width ,
301
- configure -> state . actual_height );
296
+ configure -> serial , configure -> width ,
297
+ configure -> height );
302
298
}
303
299
}
304
300
@@ -316,8 +312,8 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
316
312
317
313
const uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
318
314
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT ;
319
- if (surface -> client_pending .desired_width == 0 &&
320
- (surface -> client_pending .anchor & horiz ) != horiz ) {
315
+ if (surface -> pending .desired_width == 0 &&
316
+ (surface -> pending .anchor & horiz ) != horiz ) {
321
317
wl_resource_post_error (surface -> resource ,
322
318
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE ,
323
319
"width 0 requested without setting left and right anchors" );
@@ -326,24 +322,15 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
326
322
327
323
const uint32_t vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
328
324
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM ;
329
- if (surface -> client_pending .desired_height == 0 &&
330
- (surface -> client_pending .anchor & vert ) != vert ) {
325
+ if (surface -> pending .desired_height == 0 &&
326
+ (surface -> pending .anchor & vert ) != vert ) {
331
327
wl_resource_post_error (surface -> resource ,
332
328
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE ,
333
329
"height 0 requested without setting top and bottom anchors" );
334
330
return ;
335
331
}
336
332
337
- if (surface -> acked_configure ) {
338
- struct wlr_layer_surface_v1_configure * configure =
339
- surface -> acked_configure ;
340
- surface -> configured = true;
341
- surface -> configure_serial = configure -> serial ;
342
- surface -> current .actual_width = configure -> state .actual_width ;
343
- surface -> current .actual_height = configure -> state .actual_height ;
344
- layer_surface_configure_destroy (configure );
345
- surface -> acked_configure = NULL ;
346
- }
333
+ surface -> current = surface -> pending ;
347
334
348
335
if (wlr_surface_has_buffer (surface -> surface ) && !surface -> configured ) {
349
336
wl_resource_post_error (surface -> resource ,
@@ -352,14 +339,14 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
352
339
return ;
353
340
}
354
341
355
- surface -> current .anchor = surface -> client_pending .anchor ;
356
- surface -> current .exclusive_zone = surface -> client_pending .exclusive_zone ;
357
- surface -> current .margin = surface -> client_pending .margin ;
342
+ surface -> current .anchor = surface -> pending .anchor ;
343
+ surface -> current .exclusive_zone = surface -> pending .exclusive_zone ;
344
+ surface -> current .margin = surface -> pending .margin ;
358
345
surface -> current .keyboard_interactive =
359
- surface -> client_pending .keyboard_interactive ;
360
- surface -> current .desired_width = surface -> client_pending .desired_width ;
361
- surface -> current .desired_height = surface -> client_pending .desired_height ;
362
- surface -> current .layer = surface -> client_pending .layer ;
346
+ surface -> pending .keyboard_interactive ;
347
+ surface -> current .desired_width = surface -> pending .desired_width ;
348
+ surface -> current .desired_height = surface -> pending .desired_height ;
349
+ surface -> current .layer = surface -> pending .layer ;
363
350
364
351
if (!surface -> added ) {
365
352
surface -> added = true;
@@ -422,7 +409,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
422
409
if (output_resource ) {
423
410
surface -> output = wlr_output_from_resource (output_resource );
424
411
}
425
- surface -> current .layer = surface -> client_pending .layer = layer ;
412
+ surface -> current .layer = surface -> pending .layer = layer ;
426
413
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY ) {
427
414
free (surface );
428
415
wl_resource_post_error (client_resource ,
0 commit comments