@@ -1046,13 +1046,13 @@ wayland_display_setup ( GMainLoop *main_loop, NkBindings *bindings )
1046
1046
1047
1047
wayland -> wlr_surface = zwlr_layer_shell_v1_get_layer_surface ( wayland -> layer_shell , wayland -> surface , NULL , ZWLR_LAYER_SHELL_V1_LAYER_TOP , "rofi" );
1048
1048
1049
- // ANCHOR_LEFT is needed to get the full screen width
1050
- zwlr_layer_surface_v1_set_anchor ( wayland -> wlr_surface , ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT );
1049
+ // Set size zero and anchor on all corners to get the usable screen size
1050
+ // see https://github.com/swaywm/wlroots/pull/2422
1051
+ zwlr_layer_surface_v1_set_anchor ( wayland -> wlr_surface , ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT );
1052
+ zwlr_layer_surface_v1_set_size ( wayland -> wlr_surface , 0 , 0 );
1051
1053
zwlr_layer_surface_v1_set_keyboard_interactivity ( wayland -> wlr_surface , 1 );
1052
1054
zwlr_layer_surface_v1_add_listener ( wayland -> wlr_surface , & wayland_layer_shell_surface_listener , NULL );
1053
1055
1054
- // By setting 0 here, we'll get some useful sizes in the configure event
1055
- zwlr_layer_surface_v1_set_size ( wayland -> wlr_surface , 0 , 0 );
1056
1056
wl_surface_add_listener ( wayland -> surface , & wayland_surface_interface , wayland );
1057
1057
wl_surface_commit ( wayland -> surface );
1058
1058
wl_display_roundtrip ( wayland -> display );
@@ -1120,6 +1120,14 @@ display_set_surface_dimensions ( int width, int height, int loc )
1120
1120
default :
1121
1121
break ;
1122
1122
}
1123
+
1124
+ if ( height == 0 ) {
1125
+ wlr_anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP ;
1126
+ }
1127
+ if ( width == 0 ) {
1128
+ wlr_anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT ;
1129
+ }
1130
+
1123
1131
zwlr_layer_surface_v1_set_anchor ( wayland -> wlr_surface , wlr_anchor );
1124
1132
}
1125
1133
0 commit comments