Skip to content

Commit

Permalink
wl: Only use xdg-decoration if it's supported by the compositor
Browse files Browse the repository at this point in the history
  • Loading branch information
mnme authored and TingPing committed Jun 14, 2024
1 parent b40c212 commit 42b00d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions platform/wayland/cog-viewport-wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,13 @@ cog_wl_viewport_create_window(CogWlViewport *viewport, GError **error)
* because knowing the compositor's preference is pointless because
* there is no support for painting client-side decorations.
*/
viewport->window.xdg_decoration =
zxdg_decoration_manager_v1_get_toplevel_decoration(display->xdg_decoration, viewport->window.xdg_toplevel);
zxdg_toplevel_decoration_v1_set_mode(viewport->window.xdg_decoration,
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
if (display->xdg_decoration != NULL) {
viewport->window.xdg_decoration =
zxdg_decoration_manager_v1_get_toplevel_decoration(display->xdg_decoration,
viewport->window.xdg_toplevel);
zxdg_toplevel_decoration_v1_set_mode(viewport->window.xdg_decoration,
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
#endif /* COG_HAVE_XDG_DECORATION_UNSTABLE_V1 */

xdg_toplevel_add_listener(viewport->window.xdg_toplevel, &xdg_toplevel_listener, viewport);
Expand Down

0 comments on commit 42b00d7

Please sign in to comment.