aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradnano <me@adnano.co>2024-03-01 20:54:12 -0500
committeradnano <me@adnano.co>2024-03-01 20:54:12 -0500
commitff4d1f8f8ee392d52b71858fce658f70ee26f434 (patch)
treee7ddcec8844da9ad705164179a925510cd404957
parentbbfbf8f36c1e7dd1912d0646a3ae271a8c69e6b9 (diff)
downloadwmenu-ff4d1f8f8ee392d52b71858fce658f70ee26f434.tar.gz
Fix output selection with -o flag
-rw-r--r--main.c10
-rw-r--r--menu.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/main.c b/main.c
index fb1c3d0..3c26647 100644
--- a/main.c
+++ b/main.c
@@ -27,7 +27,8 @@ static void noop() {
static void surface_enter(void *data, struct wl_surface *surface,
struct wl_output *wl_output) {
struct menu *menu = data;
- menu->output = wl_output_get_user_data(wl_output);
+ struct output *output = wl_output_get_user_data(wl_output);
+ menu->output = output;
}
static const struct wl_surface_listener surface_listener = {
@@ -62,9 +63,10 @@ static void output_scale(void *data, struct wl_output *wl_output, int32_t factor
static void output_name(void *data, struct wl_output *wl_output, const char *name) {
struct output *output = data;
+ output->name = name;
+
struct menu *menu = output->menu;
- char *outname = menu->output_name;
- if (!menu->output && outname && strcmp(outname, name) == 0) {
+ if (menu->output_name && strcmp(menu->output_name, name) == 0) {
menu->output = output;
}
}
@@ -258,7 +260,7 @@ static void create_surface(struct menu *menu) {
struct zwlr_layer_surface_v1 *layer_surface = zwlr_layer_shell_v1_get_layer_surface(
menu->layer_shell,
menu->surface,
- NULL,
+ menu->output ? menu->output->output : NULL,
ZWLR_LAYER_SHELL_V1_LAYER_TOP,
"menu"
);
diff --git a/menu.h b/menu.h
index 334b628..3562fd2 100644
--- a/menu.h
+++ b/menu.h
@@ -27,6 +27,7 @@ struct page {
struct output {
struct menu *menu;
struct wl_output *output;
+ const char *name;
int32_t scale;
};