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

Submitted by Dima Ryazanov on Dec. 5, 2016, 3:36 a.m.

Details

Message ID 20161205033635.20086-7-dima@gmail.com
State New
Headers show
Series "Implement xdg-shell's show_window_menu API" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Dima Ryazanov Dec. 5, 2016, 3:36 a.m.
We lose the "Fullscreen" menu item, but oh well.

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

Patch hide | download patch | download mbox

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