@@ -1275,6 +1275,13 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
1275
1275
if (floating ) {
1276
1276
width = window -> floating .w ;
1277
1277
height = window -> floating .h ;
1278
+
1279
+ // Clamp the window to the toplevel bounds, if any are set.
1280
+ if (wind -> shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE &&
1281
+ wind -> toplevel_bounds .width && wind -> toplevel_bounds .height ) {
1282
+ width = SDL_min (wind -> toplevel_bounds .width , width );
1283
+ height = SDL_min (wind -> toplevel_bounds .height , height );
1284
+ }
1278
1285
} else {
1279
1286
width = window -> windowed .w ;
1280
1287
height = window -> windowed .h ;
@@ -1440,11 +1447,23 @@ static void decoration_dismiss_popup(struct libdecor_frame *frame, const char *s
1440
1447
// NOP
1441
1448
}
1442
1449
1450
+ #if SDL_LIBDECOR_CHECK_VERSION (0 , 3 , 0 )
1451
+ static void decoration_frame_toplevel_bounds (struct libdecor_frame * frame , int width , int height , void * user_data )
1452
+ {
1453
+ SDL_WindowData * wind = (SDL_WindowData * )user_data ;
1454
+ wind -> toplevel_bounds .width = width ;
1455
+ wind -> toplevel_bounds .height = height ;
1456
+ }
1457
+ #endif
1458
+
1443
1459
static struct libdecor_frame_interface libdecor_frame_interface = {
1444
1460
decoration_frame_configure ,
1445
1461
decoration_frame_close ,
1446
1462
decoration_frame_commit ,
1447
1463
decoration_dismiss_popup
1464
+ #if SDL_LIBDECOR_CHECK_VERSION (0 , 3 , 0 )
1465
+ decoration_frame_toplevel_bounds
1466
+ #endif
1448
1467
};
1449
1468
#endif
1450
1469
0 commit comments