[PATCH 8/9] shell: Always go to original mode when focused window not fullscreen
alexl at redhat.com
alexl at redhat.com
Tue May 28 07:23:39 PDT 2013
From: Alexander Larsson <alexl at redhat.com>
Right now we only switch mode on activating a fullscreened window.
This has several problems:
* Once you're in fullscreen its hard to switch to a non-fullscreened
window with alt-tab as you stay in the small resolution.
* If you switch from a fullscreened window to a non-fullscreened
window and the fullscreened window is destroyed we will not
restore the original mode (since the window is not
shell_surface_is_top_fullscreen()
* Its hard to reach a different output on the right with the mouse
when the mode is smaller that the original, as there is a "gap"
between the two outputs. So, if you alt-tab to another window
you can not always reach it.
This is somewhat of a sledge hammer, as it means you can't e.g.
focus a non-fullscreen on one output and have a window fullscreened
on another output. However, trying to restore only the outputs
the new window is on is problematic:
* It may later change output
* We want to see all windows anyway during alt-tab
* Can't reach the other windows with the mouse anyway
So, this seems like an ok solution.
---
src/shell.c | 38 +++++++++++++++++++++++++++++---------
1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/src/shell.c b/src/shell.c
index 1f2ad60..eac8471 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1496,15 +1496,32 @@ get_default_output(struct weston_compositor *compositor)
}
static void
+restore_output_mode(struct weston_output *output)
+{
+ if (output->current != output->origin ||
+ (int32_t)output->scale != output->origin_scale)
+ weston_output_switch_mode(output,
+ output->origin,
+ output->origin_scale);
+}
+
+static void
+restore_all_output_modes(struct weston_compositor *compositor)
+{
+ struct weston_output *output;
+
+ wl_list_for_each(output, &compositor->output_list, link)
+ restore_output_mode(output);
+}
+
+static void
shell_unset_fullscreen(struct shell_surface *shsurf)
{
struct workspace *ws;
/* undo all fullscreen things here */
if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER &&
shell_surface_is_top_fullscreen(shsurf)) {
- weston_output_switch_mode(shsurf->fullscreen_output,
- shsurf->fullscreen_output->origin,
- shsurf->fullscreen_output->origin_scale);
+ restore_output_mode(shsurf->fullscreen_output);
}
shsurf->fullscreen.type = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
shsurf->fullscreen.framerate = 0;
@@ -1742,6 +1759,9 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
float scale, output_aspect, surface_aspect, x, y;
int32_t surf_x, surf_y, surf_width, surf_height;
+ if (shsurf->fullscreen.type != WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER)
+ restore_output_mode(output);
+
if (!shsurf->fullscreen.black_surface)
shsurf->fullscreen.black_surface =
create_black_surface(surface->compositor,
@@ -1812,7 +1832,8 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
output->width,
output->height);
break;
- }
+ } else
+ restore_output_mode(output);
}
break;
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL:
@@ -2150,11 +2171,8 @@ destroy_shell_surface(struct shell_surface *shsurf)
}
if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER &&
- shell_surface_is_top_fullscreen(shsurf)) {
- weston_output_switch_mode(shsurf->fullscreen_output,
- shsurf->fullscreen_output->origin,
- shsurf->fullscreen_output->origin_scale);
- }
+ shell_surface_is_top_fullscreen(shsurf))
+ restore_output_mode (shsurf->fullscreen_output);
if (shsurf->fullscreen.black_surface)
weston_surface_destroy(shsurf->fullscreen.black_surface);
@@ -2924,6 +2942,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
shell_configure_fullscreen(get_shell_surface(main_surface));
break;
default:
+ restore_all_output_modes(shell->compositor);
ws = get_current_workspace(shell);
weston_surface_restack(main_surface, &ws->layer.surface_list);
break;
@@ -4014,6 +4033,7 @@ switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
switcher->listener.notify = switcher_handle_surface_destroy;
wl_list_init(&switcher->listener.link);
+ restore_all_output_modes(shell->compositor);
lower_fullscreen_layer(switcher->shell);
switcher->grab.interface = &switcher_grab;
weston_keyboard_start_grab(seat->keyboard, &switcher->grab);
--
1.8.1.4
More information about the wayland-devel
mailing list