diff options
author | adnano <me@adnano.co> | 2024-03-01 20:54:12 -0500 |
---|---|---|
committer | adnano <me@adnano.co> | 2024-03-01 20:54:12 -0500 |
commit | ff4d1f8f8ee392d52b71858fce658f70ee26f434 (patch) | |
tree | e7ddcec8844da9ad705164179a925510cd404957 | |
parent | bbfbf8f36c1e7dd1912d0646a3ae271a8c69e6b9 (diff) | |
download | wmenu-ff4d1f8f8ee392d52b71858fce658f70ee26f434.tar.gz |
Fix output selection with -o flag
-rw-r--r-- | main.c | 10 | ||||
-rw-r--r-- | menu.h | 1 |
2 files changed, 7 insertions, 4 deletions
@@ -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" ); @@ -27,6 +27,7 @@ struct page { struct output { struct menu *menu; struct wl_output *output; + const char *name; int32_t scale; }; |