@@ -149,7 +149,7 @@ static void SetMinMaxDimensions(SDL_Window *window)
149
149
SDL_WindowData * wind = window -> internal ;
150
150
int min_width , min_height , max_width , max_height ;
151
151
152
- if (( window -> flags & SDL_WINDOW_FULLSCREEN ) || wind -> fullscreen_deadline_count ) {
152
+ if (window -> flags & SDL_WINDOW_FULLSCREEN ) {
153
153
min_width = 0 ;
154
154
min_height = 0 ;
155
155
max_width = 0 ;
@@ -486,38 +486,21 @@ static void CommitLibdecorFrame(SDL_Window *window)
486
486
#endif
487
487
}
488
488
489
- static void fullscreen_deadline_handler (void * data , struct wl_callback * callback , uint32_t callback_data )
489
+ static void window_state_deadline_handler (void * data , struct wl_callback * callback , uint32_t callback_data )
490
490
{
491
491
// Get the window from the ID as it may have been destroyed
492
492
SDL_WindowID windowID = (SDL_WindowID )((uintptr_t )data );
493
493
SDL_Window * window = SDL_GetWindowFromID (windowID );
494
494
495
495
if (window && window -> internal ) {
496
- window -> internal -> fullscreen_deadline_count -- ;
496
+ window -> internal -> window_state_deadline_count -- ;
497
497
}
498
498
499
499
wl_callback_destroy (callback );
500
500
}
501
501
502
- static struct wl_callback_listener fullscreen_deadline_listener = {
503
- fullscreen_deadline_handler
504
- };
505
-
506
- static void maximized_restored_deadline_handler (void * data , struct wl_callback * callback , uint32_t callback_data )
507
- {
508
- // Get the window from the ID as it may have been destroyed
509
- SDL_WindowID windowID = (SDL_WindowID )((uintptr_t )data );
510
- SDL_Window * window = SDL_GetWindowFromID (windowID );
511
-
512
- if (window && window -> internal ) {
513
- window -> internal -> maximized_restored_deadline_count -- ;
514
- }
515
-
516
- wl_callback_destroy (callback );
517
- }
518
-
519
- static struct wl_callback_listener maximized_restored_deadline_listener = {
520
- maximized_restored_deadline_handler
502
+ static struct wl_callback_listener window_state_deadline_listener = {
503
+ window_state_deadline_handler
521
504
};
522
505
523
506
static void FlushPendingEvents (SDL_Window * window )
@@ -526,7 +509,7 @@ static void FlushPendingEvents(SDL_Window *window)
526
509
const bool last_position_pending = window -> last_position_pending ;
527
510
const bool last_size_pending = window -> last_size_pending ;
528
511
529
- while (window -> internal -> fullscreen_deadline_count || window -> internal -> maximized_restored_deadline_count ) {
512
+ while (window -> internal -> window_state_deadline_count ) {
530
513
WAYLAND_wl_display_roundtrip (window -> internal -> waylandData -> display );
531
514
}
532
515
@@ -601,11 +584,7 @@ static void SetFullscreen(SDL_Window *window, struct wl_output *output, bool ful
601
584
}
602
585
603
586
wind -> fullscreen_exclusive = output ? window -> fullscreen_exclusive : false;
604
- ++ wind -> fullscreen_deadline_count ;
605
587
if (fullscreen ) {
606
- Wayland_SetWindowResizable (SDL_GetVideoDevice (), window , true);
607
- wl_surface_commit (wind -> surface );
608
-
609
588
libdecor_frame_set_fullscreen (wind -> shell_surface .libdecor .frame , output );
610
589
} else {
611
590
libdecor_frame_unset_fullscreen (wind -> shell_surface .libdecor .frame );
@@ -618,20 +597,17 @@ static void SetFullscreen(SDL_Window *window, struct wl_output *output, bool ful
618
597
}
619
598
620
599
wind -> fullscreen_exclusive = output ? window -> fullscreen_exclusive : false;
621
- ++ wind -> fullscreen_deadline_count ;
622
600
if (fullscreen ) {
623
- Wayland_SetWindowResizable (SDL_GetVideoDevice (), window , true);
624
- wl_surface_commit (wind -> surface );
625
-
626
601
xdg_toplevel_set_fullscreen (wind -> shell_surface .xdg .toplevel .xdg_toplevel , output );
627
602
} else {
628
603
xdg_toplevel_unset_fullscreen (wind -> shell_surface .xdg .toplevel .xdg_toplevel );
629
604
}
630
605
}
631
606
632
607
// Queue a deadline event
608
+ ++ wind -> window_state_deadline_count ;
633
609
struct wl_callback * cb = wl_display_sync (viddata -> display );
634
- wl_callback_add_listener (cb , & fullscreen_deadline_listener , (void * )((uintptr_t )window -> id ));
610
+ wl_callback_add_listener (cb , & window_state_deadline_listener , (void * )((uintptr_t )window -> id ));
635
611
}
636
612
637
613
static void UpdateWindowFullscreen (SDL_Window * window , bool fullscreen )
@@ -2391,8 +2367,7 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
2391
2367
}
2392
2368
2393
2369
// Not currently fullscreen or maximized, and no state pending; nothing to do.
2394
- if (!(window -> flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED )) &&
2395
- !wind -> fullscreen_deadline_count && !wind -> maximized_restored_deadline_count ) {
2370
+ if (!(window -> flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED )) && !wind -> window_state_deadline_count ) {
2396
2371
return ;
2397
2372
}
2398
2373
@@ -2403,9 +2378,9 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
2403
2378
}
2404
2379
libdecor_frame_unset_maximized (wind -> shell_surface .libdecor .frame );
2405
2380
2406
- ++ wind -> maximized_restored_deadline_count ;
2381
+ ++ wind -> window_state_deadline_count ;
2407
2382
struct wl_callback * cb = wl_display_sync (_this -> internal -> display );
2408
- wl_callback_add_listener (cb , & maximized_restored_deadline_listener , (void * )((uintptr_t )window -> id ));
2383
+ wl_callback_add_listener (cb , & window_state_deadline_listener , (void * )((uintptr_t )window -> id ));
2409
2384
} else
2410
2385
#endif
2411
2386
// Note that xdg-shell does NOT provide a way to unset minimize!
@@ -2415,9 +2390,9 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
2415
2390
}
2416
2391
xdg_toplevel_unset_maximized (wind -> shell_surface .xdg .toplevel .xdg_toplevel );
2417
2392
2418
- ++ wind -> maximized_restored_deadline_count ;
2393
+ ++ wind -> window_state_deadline_count ;
2419
2394
struct wl_callback * cb = wl_display_sync (_this -> internal -> display );
2420
- wl_callback_add_listener (cb , & maximized_restored_deadline_listener , (void * )((uintptr_t )window -> id ));
2395
+ wl_callback_add_listener (cb , & window_state_deadline_listener , (void * )((uintptr_t )window -> id ));
2421
2396
}
2422
2397
}
2423
2398
@@ -2477,8 +2452,7 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
2477
2452
}
2478
2453
2479
2454
// Not fullscreen, already maximized, and no state pending; nothing to do.
2480
- if (!(window -> flags & SDL_WINDOW_FULLSCREEN ) && (window -> flags & SDL_WINDOW_MAXIMIZED ) &&
2481
- !wind -> fullscreen_deadline_count && !wind -> maximized_restored_deadline_count ) {
2455
+ if (!(window -> flags & SDL_WINDOW_FULLSCREEN ) && (window -> flags & SDL_WINDOW_MAXIMIZED ) && !wind -> window_state_deadline_count ) {
2482
2456
return ;
2483
2457
}
2484
2458
@@ -2492,9 +2466,9 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
2492
2466
wl_surface_commit (wind -> surface );
2493
2467
libdecor_frame_set_maximized (wind -> shell_surface .libdecor .frame );
2494
2468
2495
- ++ wind -> maximized_restored_deadline_count ;
2469
+ ++ wind -> window_state_deadline_count ;
2496
2470
struct wl_callback * cb = wl_display_sync (viddata -> display );
2497
- wl_callback_add_listener (cb , & maximized_restored_deadline_listener , (void * )((uintptr_t )window -> id ));
2471
+ wl_callback_add_listener (cb , & window_state_deadline_listener , (void * )((uintptr_t )window -> id ));
2498
2472
} else
2499
2473
#endif
2500
2474
if (wind -> shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL ) {
@@ -2506,9 +2480,9 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
2506
2480
wl_surface_commit (wind -> surface );
2507
2481
xdg_toplevel_set_maximized (wind -> shell_surface .xdg .toplevel .xdg_toplevel );
2508
2482
2509
- ++ wind -> maximized_restored_deadline_count ;
2483
+ ++ wind -> window_state_deadline_count ;
2510
2484
struct wl_callback * cb = wl_display_sync (viddata -> display );
2511
- wl_callback_add_listener (cb , & maximized_restored_deadline_listener , (void * )((uintptr_t )window -> id ));
2485
+ wl_callback_add_listener (cb , & window_state_deadline_listener , (void * )((uintptr_t )window -> id ));
2512
2486
}
2513
2487
}
2514
2488
@@ -3066,7 +3040,7 @@ bool Wayland_SyncWindow(SDL_VideoDevice *_this, SDL_Window *window)
3066
3040
3067
3041
do {
3068
3042
WAYLAND_wl_display_roundtrip (_this -> internal -> display );
3069
- } while (wind -> fullscreen_deadline_count || wind -> maximized_restored_deadline_count );
3043
+ } while (wind -> window_state_deadline_count );
3070
3044
3071
3045
return true;
3072
3046
}
0 commit comments