@@ -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,20 @@ static void decoration_dismiss_popup(struct libdecor_frame *frame, const char *s
1440
1447
// NOP
1441
1448
}
1442
1449
1450
+ static void decoration_frame_toplevel_bounds (struct libdecor_frame * frame , int width , int height , void * user_data )
1451
+ {
1452
+ SDL_WindowData * wind = (SDL_WindowData * )user_data ;
1453
+ wind -> toplevel_bounds .width = width ;
1454
+ wind -> toplevel_bounds .height = height ;
1455
+ }
1456
+
1457
+ // Note: Functions pointers after dismiss_popup are cast to avoid compiler warnings if building against an older version.
1443
1458
static struct libdecor_frame_interface libdecor_frame_interface = {
1444
1459
decoration_frame_configure ,
1445
1460
decoration_frame_close ,
1446
1461
decoration_frame_commit ,
1447
- decoration_dismiss_popup
1462
+ decoration_dismiss_popup ,
1463
+ (void (* )(void ))decoration_frame_toplevel_bounds
1448
1464
};
1449
1465
#endif
1450
1466
0 commit comments