Skip to content

Commit d3eb9c3

Browse files
committed
wayland: fix --no-overlap meaning and behavior
As I understand "no overlap", it means "do not overlap". This correspond to this call from the Wayland backend: zwlr_layer_surface_v1_set_exclusive_zone(..., overlap ? -1 : 0); The spec says: > If set to zero, the surface indicates that it would like to be moved > to avoid occluding surfaces with a positive exclusive zone. If set to > -1, the surface indicates that it would not like to be moved to > accommodate for other surfaces, and the compositor should extend it > all the way to the edges it is anchored to. So "0" is "do not overlap", and "-1" is "overlap", okay. The problem is that the overlap boolean comes from !client->no_overlap. Meaning that -n => true => !true => false so -n gives 0 "do not overlap" I think the code is correct, but the description of the argument is miss-leading. Also, we initiate the menu->overlap sooner, because the renderer need this to gather the maximum available geometry correctly. I'm not sure if this the best way to to so.
1 parent c03ea2b commit d3eb9c3

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

client/common/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ struct bm_menu*
561561
menu_with_options(struct client *client)
562562
{
563563
struct bm_menu *menu;
564-
if (!(menu = bm_menu_new(NULL)))
564+
if (!(menu = bm_menu_new(NULL, !client->no_overlap)))
565565
return NULL;
566566

567567
if (client->vim_init_mode_normal) {

lib/bemenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ enum bm_key_binding {
401401
* @param renderer Name of renderer to be used for this instance, pass **NULL** for auto-detection.
402402
* @return bm_menu for new menu instance, **NULL** if creation failed.
403403
*/
404-
BM_PUBLIC struct bm_menu* bm_menu_new(const char *renderer);
404+
BM_PUBLIC struct bm_menu* bm_menu_new(const char *renderer, bool overlap);
405405

406406
/**
407407
* Release bm_menu instance.

lib/menu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static struct bm_item** (*filter_func[BM_FILTER_MODE_LAST])(struct bm_menu *menu
4747
};
4848

4949
struct bm_menu*
50-
bm_menu_new(const char *renderer)
50+
bm_menu_new(const char *renderer, bool overlap)
5151
{
5252
struct bm_menu *menu;
5353
if (!(menu = calloc(1, sizeof(struct bm_menu))))
@@ -58,6 +58,7 @@ bm_menu_new(const char *renderer)
5858
menu->key_binding = BM_KEY_BINDING_DEFAULT;
5959
menu->vim_mode = 'i';
6060
menu->vim_last_key = 0;
61+
menu->overlap = overlap;
6162

6263
uint32_t count;
6364
const struct bm_renderer **renderers = bm_get_renderers(&count);

man/bemenu.1.scd.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ These options are only available on backends specified in the parentheses:
168168
should appear on all monitors.
169169

170170
*-n, --no-overlap* (Wayland)
171-
Set the *bemenu* window to be on top of any other panels.
171+
Make the *bemenu* window to not overlap any other panels.
172172

173173
*-M, --margin* <_margin_> (Wayland, X11)
174174
Specify the _margin_ (empty space) in pixels to leave between menu and

0 commit comments

Comments
 (0)