clients: Remove the window / user parameters from the menu function
We want the ability to create a detached menu.
diff --git a/clients/window.c b/clients/window.c
index 7b77f93..7cb4b27 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -363,8 +363,8 @@
};
struct menu {
+ void *user_data;
struct window *window;
- struct window *parent;
struct widget *widget;
struct input *input;
struct frame *frame;
@@ -2229,9 +2229,9 @@
}
static void
-frame_menu_func(struct window *window,
- struct input *input, int index, void *data)
+frame_menu_func(void *data, struct input *input, int index)
{
+ struct window *window = data;
struct display *display;
switch (index) {
@@ -4507,8 +4507,7 @@
(menu->release_count > 0 || time - menu->time > 500)) {
/* Either relase after press-drag-release or
* click-motion-click. */
- menu->func(menu->parent, input,
- menu->current, menu->parent->user_data);
+ menu->func(menu->user_data, input, menu->current);
input_ungrab(input);
menu_destroy(menu);
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
@@ -4605,7 +4604,7 @@
}
menu->window = window;
- menu->parent = parent;
+ menu->user_data = parent;
menu->widget = window_add_widget(menu->window, menu);
window_set_buffer_scale (menu->window, window_get_buffer_scale (parent));
window_set_buffer_transform (menu->window, window_get_buffer_transform (parent));