[PATCH weston 6/6] window: Start using xdg-shell's show_window_menu API

Dima Ryazanov dima at gmail.com
Mon Dec 5 03:36:35 UTC 2016


We lose the "Fullscreen" menu item, but oh well.

Signed-off-by: Dima Ryazanov <dima at gmail.com>
---
 clients/window.c | 40 +++++++---------------------------------
 1 file changed, 7 insertions(+), 33 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index d4eeca6..4c494b5 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2324,45 +2324,19 @@ frame_get_pointer_image_for_location(struct window_frame *frame,
 	}
 }
 
-static void
-frame_menu_func(void *data, struct input *input, int index)
-{
-	struct window *window = data;
-
-	switch (index) {
-	case 0: /* close */
-		window_close(window);
-		break;
-	case 1: /* fullscreen */
-		/* we don't have a way to get out of fullscreen for now */
-		if (window->fullscreen_handler)
-			window->fullscreen_handler(window, window->user_data);
-		break;
-	}
-}
-
 void
 window_show_frame_menu(struct window *window,
-		       struct input *input, uint32_t time)
+		       struct input *input,
+		       uint32_t time)
 {
 	int32_t x, y;
-	int count;
-
-	static const char *entries[] = {
-		"Close",
-		"Fullscreen"
-	};
-
-	if (window->fullscreen_handler)
-		count = ARRAY_LENGTH(entries);
-	else
-		count = ARRAY_LENGTH(entries) - 1;
 
 	input_get_position(input, &x, &y);
-	window_show_menu(window->display, input,
-			 display_get_serial(window->display),
-			 time, window,
-			 x - 10, y - 10, frame_menu_func, entries, count);
+
+	zxdg_toplevel_v6_show_window_menu(window->xdg_toplevel,
+					  input_get_seat(input),
+					  window->display->serial,
+					  x, y);
 }
 
 static int
-- 
2.9.3



More information about the wayland-devel mailing list