window: Only advertise fullscreen menu item if client supports it
If the client doesn't set a fullscreen handler, we can't go fullscreen and shouldn't advertise that in the window menu. The menu implementation is a little simplistic, so we just move the "Fullscreen" entry to the end of the list and don't count it if we don't want it in the menu. https://bugs.freedesktop.org/show_bug.cgi?id=47751 https://bugs.freedesktop.org/show_bug.cgi?id=48106
This commit is contained in:
+17
-11
@@ -1766,24 +1766,24 @@ frame_menu_func(struct window *window, int index, void *data)
|
|||||||
else
|
else
|
||||||
display_exit(window->display);
|
display_exit(window->display);
|
||||||
break;
|
break;
|
||||||
case 1: /* fullscreen */
|
case 1: /* move to workspace above */
|
||||||
/* 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;
|
|
||||||
case 2: /* move to workspace above */
|
|
||||||
display = window->display;
|
display = window->display;
|
||||||
if (display->workspace > 0)
|
if (display->workspace > 0)
|
||||||
workspace_manager_move_surface(display->workspace_manager,
|
workspace_manager_move_surface(display->workspace_manager,
|
||||||
window->surface,
|
window->surface,
|
||||||
display->workspace - 1);
|
display->workspace - 1);
|
||||||
break;
|
break;
|
||||||
case 3: /* move to workspace below */
|
case 2: /* move to workspace below */
|
||||||
display = window->display;
|
display = window->display;
|
||||||
if (display->workspace < display->workspace_count - 1)
|
if (display->workspace < display->workspace_count - 1)
|
||||||
workspace_manager_move_surface(display->workspace_manager,
|
workspace_manager_move_surface(display->workspace_manager,
|
||||||
window->surface,
|
window->surface,
|
||||||
display->workspace + 1);
|
display->workspace + 1);
|
||||||
|
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;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1793,16 +1793,22 @@ 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;
|
||||||
|
|
||||||
static const char *entries[] = {
|
static const char *entries[] = {
|
||||||
"Close", "Fullscreen",
|
"Close",
|
||||||
"Move to workspace above", "Move to workspace below"
|
"Move to workspace above", "Move to workspace below",
|
||||||
|
"Fullscreen"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (window->fullscreen_handler)
|
||||||
|
count = ARRAY_LENGTH(entries);
|
||||||
|
else
|
||||||
|
count = ARRAY_LENGTH(entries) - 1;
|
||||||
|
|
||||||
input_get_position(input, &x, &y);
|
input_get_position(input, &x, &y);
|
||||||
window_show_menu(window->display, input, time, window,
|
window_show_menu(window->display, input, time, window,
|
||||||
x - 10, y - 10, frame_menu_func, entries,
|
x - 10, y - 10, frame_menu_func, entries, count);
|
||||||
ARRAY_LENGTH(entries));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user