@@ -738,6 +738,70 @@ static bool createXdgSurface(_GLFWwindow* window)
738738 return true;
739739}
740740
741+ static void layerSurfaceHandleConfigure (void * data ,
742+ struct zwlr_layer_surface_v1 * surface ,
743+ uint32_t serial ,
744+ uint32_t width ,
745+ uint32_t height ) {
746+ _GLFWwindow * window = data ;
747+ window -> wl .fullscreened = true;
748+ dispatchChangesAfterConfigure (window , width , height );
749+ zwlr_layer_surface_v1_ack_configure (surface , serial );
750+ }
751+
752+
753+ static void layerSurfaceHandleClosed (void * data ,
754+ struct zwlr_layer_surface_v1 * surface UNUSED ) {
755+ _GLFWwindow * window = data ;
756+ _glfwInputWindowCloseRequest (window );
757+ }
758+
759+ static const struct zwlr_layer_surface_v1_listener layerSurfaceListener = {
760+ layerSurfaceHandleConfigure ,
761+ layerSurfaceHandleClosed ,
762+ };
763+
764+ static bool createLayerSurface (_GLFWwindow * window )
765+ {
766+ if (!_glfw .wl .layer_shell )
767+ {
768+ _glfwInputError (GLFW_PLATFORM_ERROR ,
769+ "Wayland: layer-shell protocol unsupported" );
770+ return false;
771+ }
772+
773+ window -> wl .layer .surface =
774+ zwlr_layer_shell_v1_get_layer_surface (_glfw .wl .layer_shell ,
775+ window -> wl .surface , NULL , ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM ,
776+ "kitty" );
777+
778+ if (!window -> wl .layer .surface )
779+ {
780+ _glfwInputError (GLFW_PLATFORM_ERROR ,
781+ "Wayland: layer-surface creation failed" );
782+ return false;
783+ }
784+
785+ zwlr_layer_surface_v1_set_size (window -> wl .layer .surface , 0 , 0 );
786+ zwlr_layer_surface_v1_set_anchor (window -> wl .layer .surface ,
787+ ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
788+ ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |
789+ ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
790+ ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT );
791+ zwlr_layer_surface_v1_set_exclusive_zone (window -> wl .layer .surface , -1 );
792+ zwlr_layer_surface_v1_set_margin (window -> wl .layer .surface , 0 , 0 , 0 , 0 );
793+ zwlr_layer_surface_v1_set_keyboard_interactivity (window -> wl .layer .surface , 0 );
794+
795+ zwlr_layer_surface_v1_add_listener (window -> wl .layer .surface ,
796+ & layerSurfaceListener ,
797+ window );
798+
799+ wl_surface_commit (window -> wl .surface );
800+ wl_display_roundtrip (_glfw .wl .display );
801+
802+ return true;
803+ }
804+
741805static void incrementCursorImage (_GLFWwindow * window )
742806{
743807 if (window && window -> wl .decorations .focus == mainWindow && window -> cursorMode != GLFW_CURSOR_HIDDEN ) {
@@ -913,8 +977,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
913977
914978 if (wndconfig -> visible )
915979 {
916- if (!createXdgSurface (window ))
917- return false;
980+ if (wndconfig -> wl .background )
981+ {
982+ if (!createLayerSurface (window ))
983+ return false;
984+ }
985+ else
986+ {
987+ if (!createXdgSurface (window ))
988+ return false;
989+ }
918990
919991 window -> wl .visible = true;
920992 }
0 commit comments