Partially revert "xdg-shell: Add show_window_menu request"
This reverts the parts of commit 81ff075bf4
that touch window.c.
This brings the toytoolkit window context menus back, until someone
implements the xdg-shell equivalent in the compositor.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82972
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
+49
-7
@@ -2236,19 +2236,61 @@ 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;
|
||||||
|
struct display *display;
|
||||||
|
|
||||||
|
switch (index) {
|
||||||
|
case 0: /* close */
|
||||||
|
window_close(window);
|
||||||
|
break;
|
||||||
|
case 1: /* move to workspace above */
|
||||||
|
display = window->display;
|
||||||
|
if (display->workspace > 0)
|
||||||
|
workspace_manager_move_surface(
|
||||||
|
display->workspace_manager,
|
||||||
|
window->main_surface->surface,
|
||||||
|
display->workspace - 1);
|
||||||
|
break;
|
||||||
|
case 2: /* move to workspace below */
|
||||||
|
display = window->display;
|
||||||
|
if (display->workspace < display->workspace_count - 1)
|
||||||
|
workspace_manager_move_surface(
|
||||||
|
display->workspace_manager,
|
||||||
|
window->main_surface->surface,
|
||||||
|
display->workspace + 1);
|
||||||
|
break;
|
||||||
|
case 3: /* 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
|
void
|
||||||
window_show_frame_menu(struct window *window,
|
window_show_frame_menu(struct window *window,
|
||||||
struct input *input, uint32_t time)
|
struct input *input, uint32_t time)
|
||||||
{
|
{
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
|
int count;
|
||||||
|
|
||||||
if (window->xdg_surface) {
|
static const char *entries[] = {
|
||||||
input_get_position(input, &x, &y);
|
"Close",
|
||||||
xdg_surface_show_window_menu(window->xdg_surface,
|
"Move to workspace above", "Move to workspace below",
|
||||||
input_get_seat(input),
|
"Fullscreen"
|
||||||
window->display->serial,
|
};
|
||||||
x - 10, y - 10);
|
|
||||||
}
|
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, time, window,
|
||||||
|
x - 10, y - 10, frame_menu_func, entries, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user