@@ -87,12 +87,13 @@ 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 -> pending .configure_serial = configure -> serial ;
91
+ surface -> pending .actual_width = configure -> width ;
92
+ surface -> pending .actual_height = configure -> height ;
93
+
94
+ surface -> configured = true;
95
+
96
+ layer_surface_configure_destroy (configure );
96
97
}
97
98
98
99
static void layer_surface_handle_set_size (struct wl_client * client ,
@@ -102,8 +103,8 @@ static void layer_surface_handle_set_size(struct wl_client *client,
102
103
if (!surface ) {
103
104
return ;
104
105
}
105
- surface -> client_pending .desired_width = width ;
106
- surface -> client_pending .desired_height = height ;
106
+ surface -> pending .desired_width = width ;
107
+ surface -> pending .desired_height = height ;
107
108
}
108
109
109
110
static void layer_surface_handle_set_anchor (struct wl_client * client ,
@@ -123,7 +124,7 @@ static void layer_surface_handle_set_anchor(struct wl_client *client,
123
124
if (!surface ) {
124
125
return ;
125
126
}
126
- surface -> client_pending .anchor = anchor ;
127
+ surface -> pending .anchor = anchor ;
127
128
}
128
129
129
130
static void layer_surface_handle_set_exclusive_zone (struct wl_client * client ,
@@ -133,7 +134,7 @@ static void layer_surface_handle_set_exclusive_zone(struct wl_client *client,
133
134
if (!surface ) {
134
135
return ;
135
136
}
136
- surface -> client_pending .exclusive_zone = zone ;
137
+ surface -> pending .exclusive_zone = zone ;
137
138
}
138
139
139
140
static void layer_surface_handle_set_margin (
@@ -144,10 +145,10 @@ static void layer_surface_handle_set_margin(
144
145
if (!surface ) {
145
146
return ;
146
147
}
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 ;
148
+ surface -> pending .margin .top = top ;
149
+ surface -> pending .margin .right = right ;
150
+ surface -> pending .margin .bottom = bottom ;
151
+ surface -> pending .margin .left = left ;
151
152
}
152
153
153
154
static void layer_surface_handle_set_keyboard_interactivity (
@@ -160,14 +161,14 @@ static void layer_surface_handle_set_keyboard_interactivity(
160
161
}
161
162
162
163
if (wl_resource_get_version (resource ) < ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION ) {
163
- surface -> client_pending .keyboard_interactive = !!interactive ;
164
+ surface -> pending .keyboard_interactive = !!interactive ;
164
165
} else {
165
166
if (interactive > ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND ) {
166
167
wl_resource_post_error (resource ,
167
168
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY ,
168
169
"wrong keyboard interactivity value: %" PRIu32 , interactive );
169
170
} else {
170
- surface -> client_pending .keyboard_interactive = interactive ;
171
+ surface -> pending .keyboard_interactive = interactive ;
171
172
}
172
173
}
173
174
}
@@ -203,7 +204,7 @@ static void layer_surface_set_layer(struct wl_client *client,
203
204
"Invalid layer %" PRIu32 , layer );
204
205
return ;
205
206
}
206
- surface -> client_pending .layer = layer ;
207
+ surface -> pending .layer = layer ;
207
208
}
208
209
209
210
static const struct zwlr_layer_surface_v1_interface layer_surface_implementation = {
@@ -233,8 +234,6 @@ static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
233
234
}
234
235
235
236
surface -> configured = surface -> mapped = false;
236
- surface -> configure_serial = 0 ;
237
- surface -> configure_next_serial = 0 ;
238
237
}
239
238
240
239
static void layer_surface_destroy (struct wlr_layer_surface_v1 * surface ) {
@@ -257,49 +256,24 @@ static void layer_surface_resource_destroy(struct wl_resource *resource) {
257
256
}
258
257
}
259
258
260
- static bool layer_surface_state_changed (struct wlr_layer_surface_v1 * surface ) {
261
- struct wlr_layer_surface_v1_state * state ;
262
- 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
- }
270
- } else {
271
- struct wlr_layer_surface_v1_configure * configure =
272
- wl_container_of (surface -> configure_list .prev , configure , link );
273
- state = & configure -> state ;
274
- }
275
-
276
- bool changed = state -> actual_width != surface -> server_pending .actual_width
277
- || state -> actual_height != surface -> server_pending .actual_height ;
278
- return changed ;
279
- }
280
-
281
- void wlr_layer_surface_v1_configure (struct wlr_layer_surface_v1 * surface ,
259
+ uint32_t wlr_layer_surface_v1_configure (struct wlr_layer_surface_v1 * surface ,
282
260
uint32_t width , uint32_t height ) {
283
- surface -> server_pending .actual_width = width ;
284
- surface -> server_pending .actual_height = height ;
285
- if (layer_surface_state_changed (surface )) {
286
- struct wl_display * display =
287
- wl_client_get_display (wl_resource_get_client (surface -> resource ));
288
- struct wlr_layer_surface_v1_configure * configure =
289
- calloc (1 , sizeof (struct wlr_layer_surface_v1_configure ));
290
- if (configure == NULL ) {
291
- wl_client_post_no_memory (wl_resource_get_client (surface -> resource ));
292
- return ;
293
- }
294
- surface -> configure_next_serial = wl_display_next_serial (display );
295
- 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 ;
299
- zwlr_layer_surface_v1_send_configure (surface -> resource ,
300
- configure -> serial , configure -> state .actual_width ,
301
- configure -> state .actual_height );
302
- }
261
+ struct wl_display * display =
262
+ wl_client_get_display (wl_resource_get_client (surface -> resource ));
263
+ struct wlr_layer_surface_v1_configure * configure =
264
+ calloc (1 , sizeof (struct wlr_layer_surface_v1_configure ));
265
+ if (configure == NULL ) {
266
+ wl_client_post_no_memory (wl_resource_get_client (surface -> resource ));
267
+ return surface -> pending .configure_serial ;
268
+ }
269
+ wl_list_insert (surface -> configure_list .prev , & configure -> link );
270
+ configure -> width = width ;
271
+ configure -> height = height ;
272
+ configure -> serial = wl_display_next_serial (display );
273
+ zwlr_layer_surface_v1_send_configure (surface -> resource ,
274
+ configure -> serial , configure -> width ,
275
+ configure -> height );
276
+ return configure -> serial ;
303
277
}
304
278
305
279
void wlr_layer_surface_v1_destroy (struct wlr_layer_surface_v1 * surface ) {
@@ -316,8 +290,8 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
316
290
317
291
const uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
318
292
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT ;
319
- if (surface -> client_pending .desired_width == 0 &&
320
- (surface -> client_pending .anchor & horiz ) != horiz ) {
293
+ if (surface -> pending .desired_width == 0 &&
294
+ (surface -> pending .anchor & horiz ) != horiz ) {
321
295
wl_resource_post_error (surface -> resource ,
322
296
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE ,
323
297
"width 0 requested without setting left and right anchors" );
@@ -326,24 +300,15 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
326
300
327
301
const uint32_t vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
328
302
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM ;
329
- if (surface -> client_pending .desired_height == 0 &&
330
- (surface -> client_pending .anchor & vert ) != vert ) {
303
+ if (surface -> pending .desired_height == 0 &&
304
+ (surface -> pending .anchor & vert ) != vert ) {
331
305
wl_resource_post_error (surface -> resource ,
332
306
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE ,
333
307
"height 0 requested without setting top and bottom anchors" );
334
308
return ;
335
309
}
336
310
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
- }
311
+ surface -> current = surface -> pending ;
347
312
348
313
if (wlr_surface_has_buffer (surface -> surface ) && !surface -> configured ) {
349
314
wl_resource_post_error (surface -> resource ,
@@ -352,15 +317,6 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
352
317
return ;
353
318
}
354
319
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 ;
358
- 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 ;
363
-
364
320
if (!surface -> added ) {
365
321
surface -> added = true;
366
322
assert (!surface -> configured );
@@ -422,7 +378,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
422
378
if (output_resource ) {
423
379
surface -> output = wlr_output_from_resource (output_resource );
424
380
}
425
- surface -> current .layer = surface -> client_pending .layer = layer ;
381
+ surface -> current .layer = surface -> pending .layer = layer ;
426
382
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY ) {
427
383
free (surface );
428
384
wl_resource_post_error (client_resource ,
0 commit comments