wayland: support showing bemenu on all monitors

This commit is contained in:
Jari Vetoniemi 2020-03-25 16:11:15 +09:00 committed by Jari Vetoniemi
parent cd53b7bb55
commit 6343a658bb
4 changed files with 11 additions and 8 deletions

View File

@ -309,7 +309,7 @@ do_getopt(struct client *client, int *argc, char **argv[])
client->grab = true;
break;
case 'm':
client->monitor = strtol(optarg, NULL, 10);
client->monitor = (!strcmp(optarg, "all") ? -1 : strtol(optarg, NULL, 10));
break;
case 'n':
client->no_overlap = true;

View File

@ -241,17 +241,19 @@ recreate_windows(const struct bm_menu *menu, struct wayland *wayland)
{
destroy_windows(wayland);
size_t monitors = 0;
uint32_t monitors = 0;
struct output *output;
wl_list_for_each(output, &wayland->outputs, link)
monitors++;
size_t monitor = 0;
uint32_t monitor = 0;
wl_list_for_each(output, &wayland->outputs, link) {
if (menu->monitor != (uint32_t)-1) {
if (menu->monitor < monitors && monitor != menu->monitor) {
++monitor;
continue;
}
}
struct wl_surface *surface;
if (!(surface = wl_compositor_create_surface(wayland->compositor)))
@ -270,7 +272,7 @@ recreate_windows(const struct bm_menu *menu, struct wayland *wayland)
window->max_height = output->height;
window->render_pending = true;
wl_list_insert(&wayland->windows, &window->link);
break;
if (menu->monitor != (uint32_t)-1) break;
}
set_overlap(menu, menu->overlap);

View File

@ -177,7 +177,7 @@ set_monitor(const struct bm_menu *menu, uint32_t monitor)
{
struct x11 *x11 = menu->renderer->internal;
assert(x11);
bm_x11_window_set_monitor(&x11->window, monitor);
bm_x11_window_set_monitor(&x11->window, (monitor != (uint32_t)-1 ? monitor : 0));
}
static void

View File

@ -121,6 +121,7 @@ These options are only available on backends specified in the parentheses
.TP
.BI \-m " INDEX" ", \-\-monitor=" INDEX
(Wayland, X11) Specify \fIINDEX\fR of the monitor where the menu should appear.
(Wayland) If index is \fI-1\fR or \fIall\fR then the menu will appear on all monitors.
.TP
.BI \-H " HEIGHT" ", \-\-line\-height=" HEIGHT