@@ -279,8 +279,8 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
279279 } else if (strcmp (interface, wl_seat_interface.name ) == 0 ) {
280280 mSeat = (wl_seat*)wl_registry_bind (registry, name, &wl_seat_interface, 1 );
281281 wl_seat_add_listener (mSeat , &seat_listener, &seat_capabilities_c);
282- } else if (strcmp (interface, zxdg_toplevel_decoration_v1_interface .name ) == 0 ) {
283- mDecManager = (zxdg_decoration_manager_v1*)wl_registry_bind (registry, name, &zxdg_toplevel_decoration_v1_interface , 1 );
282+ } else if (strcmp (interface, zxdg_decoration_manager_v1_interface .name ) == 0 ) {
283+ mDecManager = (zxdg_decoration_manager_v1*)wl_registry_bind (registry, name, &zxdg_decoration_manager_v1_interface , 1 );
284284 }
285285 };
286286
@@ -321,7 +321,7 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
321321 if (me->mDisplayRunning ) {
322322 me->ResizeScene (me->mWidthRequested , me->mHeightRequested ); // Swapchain is recreated by the backend, Vulkan WSI commits the new buffer
323323 } else {
324- me->mDisplayWidth = me->mWidthRequested ; // Initial size, used by InitDisplay via getSize()
324+ me->mDisplayWidth = me->mWidthRequested ;
325325 me->mDisplayHeight = me->mHeightRequested ;
326326 }
327327 }
@@ -349,8 +349,11 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
349349
350350 xdg_toplevel_set_title (mXdgToplevel , DISPLAY_WINDOW_NAME );
351351
352- if (mDecManager ) {
353- printf (" Enabling decoration\n " );
352+ if (mDecManager ) { // Must be requested before the first commit. Without the protocol (e.g. GNOME), the window has no decorations
353+ mXdgDecoration = zxdg_decoration_manager_v1_get_toplevel_decoration (mDecManager , mXdgToplevel );
354+ zxdg_toplevel_decoration_v1_set_mode (mXdgDecoration , ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE );
355+ } else if (mDisplay ->GetProcessingSettings ().debugLevel >= 0 ) {
356+ GPUInfo (" Wayland compositor does not support server-side decorations" );
354357 }
355358
356359 wl_surface_commit (mSurface ); // Initial commit without buffer, the compositor answers with the first configure
@@ -406,9 +409,17 @@ int32_t GPUDisplayFrontendWayland::FrontendMain()
406409 wl_keyboard_release (mKeyboard );
407410 mKeyboard = nullptr ;
408411 }
412+ if (mXdgDecoration ) {
413+ zxdg_toplevel_decoration_v1_destroy (mXdgDecoration );
414+ mXdgDecoration = nullptr ;
415+ }
409416 xdg_toplevel_destroy (mXdgToplevel );
410417 xdg_surface_destroy (mXdgSurface );
411418 wl_surface_destroy (mSurface );
419+ if (mDecManager ) {
420+ zxdg_decoration_manager_v1_destroy (mDecManager );
421+ mDecManager = nullptr ;
422+ }
412423 wl_registry_destroy (mRegistry );
413424 wl_display_disconnect (mWayland );
414425
0 commit comments