@@ -297,16 +297,7 @@ static void create_surface(struct swaylock_surface *surface) {
297297 state -> ext_session_lock_v1 , surface -> surface , surface -> output );
298298 ext_session_lock_surface_v1_add_listener (surface -> ext_session_lock_surface_v1 ,
299299 & ext_session_lock_surface_v1_listener , surface );
300- surface -> events_pending += 1 ;
301300
302-
303- if (!state -> ext_session_lock_v1 ) {
304- wl_surface_commit (surface -> surface );
305- }
306- }
307-
308- static void initially_render_surface (struct swaylock_surface * surface ) {
309- swaylock_log (LOG_DEBUG , "Surface for output %s ready" , surface -> output_name );
310301 if (surface_is_opaque (surface ) &&
311302 surface -> state -> args .mode != BACKGROUND_MODE_CENTER &&
312303 surface -> state -> args .mode != BACKGROUND_MODE_FIT ) {
@@ -317,24 +308,20 @@ static void initially_render_surface(struct swaylock_surface *surface) {
317308 wl_region_destroy (region );
318309 }
319310
320- surface -> created = true;
321- if (!surface -> state -> ext_session_lock_v1 ) {
322- render_frame_background (surface , true);
323- render_frame (surface );
311+ surface -> created = true;
312+ if (!state -> ext_session_lock_v1 ) {
313+ wl_surface_commit (surface -> surface );
324314 }
325315}
316+
317+
326318static void ext_session_lock_surface_v1_handle_configure (void * data ,
327319 struct ext_session_lock_surface_v1 * lock_surface , uint32_t serial ,
328320 uint32_t width , uint32_t height ) {
329321 struct swaylock_surface * surface = data ;
330322 surface -> width = width ;
331323 surface -> height = height ;
332- // Render before we send the ACK event, so that we minimize flickering
333- // This means we cannot commit immediately after rendering -- we will have
334- // to send the ACK first and then commit.
335- render_frame_background (surface , false);
336324 ext_session_lock_surface_v1_ack_configure (lock_surface , serial );
337- wl_surface_commit (surface -> surface );
338325 surface -> dirty = true;
339326 render (surface );
340327}
@@ -370,6 +357,8 @@ static void handle_wl_output_mode(void *data, struct wl_output *output,
370357 // Who cares
371358}
372359
360+ static const struct zwlr_screencopy_frame_v1_listener screencopy_frame_listener ;
361+
373362static void handle_wl_output_done (void * data , struct wl_output * output ) {
374363 swaylock_trace ();
375364 struct swaylock_surface * surface = data ;
@@ -1878,12 +1867,6 @@ int main(int argc, char **argv) {
18781867 surface -> events_pending += 1 ;
18791868 };
18801869
1881- wl_list_for_each (surface , & state .surfaces , link ) {
1882- while (surface -> events_pending > 0 ) {
1883- wl_display_roundtrip (state .display );
1884- }
1885- }
1886-
18871870 // Must daemonize before we run any effects, since effects use openmp
18881871 int daemonfd ;
18891872 if (state .args .daemonize ) {
@@ -1899,20 +1882,6 @@ int main(int argc, char **argv) {
18991882 iter_image -> cairo_surface , & state , 1 );
19001883 }
19011884
1902- if (state .ext_session_lock_manager_v1 ) {
1903- swaylock_log (LOG_DEBUG , "Using ext-session-lock-v1" );
1904- state .ext_session_lock_v1 = ext_session_lock_manager_v1_lock (state .ext_session_lock_manager_v1 );
1905- ext_session_lock_v1_add_listener (state .ext_session_lock_v1 ,
1906- & ext_session_lock_v1_listener , & state );
1907- } else if (state .layer_shell && state .input_inhibit_manager ) {
1908- swaylock_log (LOG_DEBUG , "Using wlr-layer-shell + wlr-input-inhibitor" );
1909- zwlr_input_inhibit_manager_v1_get_inhibitor (state .input_inhibit_manager );
1910- } else {
1911- swaylock_log (LOG_ERROR , "Missing ext-session-lock-v1, wlr-layer-shell "
1912- "and wlr-input-inhibitor" );
1913- return 1 ;
1914- }
1915-
19161885 state .ext_session_lock_v1 = ext_session_lock_manager_v1_lock (state .ext_session_lock_manager_v1 );
19171886 ext_session_lock_v1_add_listener (state .ext_session_lock_v1 ,
19181887 & ext_session_lock_v1_listener , & state );
@@ -1928,6 +1897,13 @@ int main(int argc, char **argv) {
19281897 wl_list_for_each (surface , & state .surfaces , link ) {
19291898 create_surface (surface );
19301899 }
1900+
1901+ wl_list_for_each (surface , & state .surfaces , link ) {
1902+ while (surface -> events_pending > 0 ) {
1903+ wl_display_roundtrip (state .display );
1904+ }
1905+ }
1906+ swaylock_log (LOG_DEBUG , "create_surface pw check request" );
19311907
19321908 while (!state .locked ) {
19331909 if (wl_display_dispatch (state .display ) < 0 ) {
@@ -1944,16 +1920,7 @@ int main(int argc, char **argv) {
19441920 close (state .args .ready_fd );
19451921 state .args .ready_fd = -1 ;
19461922 }
1947- if (state .args .daemonize ) {
1948- daemonize ();
1949- }
19501923
1951- wl_list_for_each (surface , & state .surfaces , link ) {
1952- while (surface -> events_pending > 0 ) {
1953- wl_display_roundtrip (state .display );
1954- }
1955- }
1956-
19571924 loop_add_fd (state .eventloop , wl_display_get_fd (state .display ), POLLIN ,
19581925 display_in , NULL );
19591926
0 commit comments