The serial that triggered the menu may not always be the latest serial - as will be the case for the desktop-shell. Let's just require clients to pass it explicitly. They already do it when starting a grab, moving a window, etc.
Signed-off-by: Dima Ryazanov <d...@gmail.com> --- clients/editor.c | 4 +++- clients/resizor.c | 4 +++- clients/stacking.c | 4 +++- clients/terminal.c | 4 +++- clients/window.c | 12 ++++++------ clients/window.h | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/clients/editor.c b/clients/editor.c index 42c7f52..a201eff 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -683,7 +683,9 @@ show_menu(struct editor *editor, struct input *input, uint32_t time) }; input_get_position(input, &x, &y); - window_show_menu(editor->display, input, time, editor->window, + window_show_menu(editor->display, input, + display_get_serial(editor->display), + time, editor->window, x + 10, y + 20, menu_func, entries, ARRAY_LENGTH(entries)); } diff --git a/clients/resizor.c b/clients/resizor.c index 5d342e1..481b9f0 100644 --- a/clients/resizor.c +++ b/clients/resizor.c @@ -221,7 +221,9 @@ show_menu(struct resizor *resizor, struct input *input, uint32_t time) }; input_get_position(input, &x, &y); - window_show_menu(resizor->display, input, time, resizor->window, + window_show_menu(resizor->display, input, + display_get_serial(resizor->display), + time, resizor->window, x - 10, y - 10, menu_func, entries, 4); } diff --git a/clients/stacking.c b/clients/stacking.c index 0682e60..246ef59 100644 --- a/clients/stacking.c +++ b/clients/stacking.c @@ -102,7 +102,9 @@ show_popup(struct stacking *stacking, struct input *input, uint32_t time, }; input_get_position(input, &x, &y); - window_show_menu(stacking->display, input, time, window, x, y, + window_show_menu(stacking->display, input, + display_get_serial(stacking->display), + time, window, x, y, show_popup_cb, entries, ARRAY_LENGTH(entries)); } diff --git a/clients/terminal.c b/clients/terminal.c index 5c25fa8..b12d334 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -2725,7 +2725,9 @@ show_menu(struct terminal *terminal, struct input *input, uint32_t time) }; input_get_position(input, &x, &y); - window_show_menu(terminal->display, input, time, terminal->window, + window_show_menu(terminal->display, input, + display_get_serial(terminal->display), + time, terminal->window, x - 10, y - 10, menu_func, entries, ARRAY_LENGTH(entries)); } diff --git a/clients/window.c b/clients/window.c index afc7cab..f49ce72 100644 --- a/clients/window.c +++ b/clients/window.c @@ -2358,7 +2358,9 @@ window_show_frame_menu(struct window *window, count = ARRAY_LENGTH(entries) - 1; input_get_position(input, &x, &y); - window_show_menu(window->display, input, time, window, + window_show_menu(window->display, input, + display_get_serial(window->display), + time, window, x - 10, y - 10, frame_menu_func, entries, count); } @@ -5499,8 +5501,8 @@ create_simple_positioner(struct display *display, void window_show_menu(struct display *display, - struct input *input, uint32_t time, struct window *parent, - int32_t x, int32_t y, + struct input *input, uint32_t serial, uint32_t time, + struct window *parent, int32_t x, int32_t y, menu_func_t func, const char **entries, int count) { struct menu *menu; @@ -5547,9 +5549,7 @@ window_show_menu(struct display *display, positioner); fail_on_null(window->xdg_popup, 0, __FILE__, __LINE__); zxdg_positioner_v6_destroy(positioner); - zxdg_popup_v6_grab(window->xdg_popup, - input->seat, - display_get_serial(window->display)); + zxdg_popup_v6_grab(window->xdg_popup, input->seat, serial); zxdg_popup_v6_add_listener(window->xdg_popup, &xdg_popup_listener, window); diff --git a/clients/window.h b/clients/window.h index 1ec9eac..1cb3d27 100644 --- a/clients/window.h +++ b/clients/window.h @@ -324,8 +324,8 @@ typedef void (*menu_func_t)(void *data, struct input *input, int index); void window_show_menu(struct display *display, - struct input *input, uint32_t time, struct window *parent, - int32_t x, int32_t y, + struct input *input, uint32_t serial, uint32_t time, + struct window *parent, int32_t x, int32_t y, menu_func_t func, const char **entries, int count); void -- 2.9.3 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel