xwm: support maximizing xwayland windows
This patch adds the maximize button to the window frame for the windows which set the MWM_DECOR_MAXIMIZE hint, and it wires it with the shell via a new method in weston_shell_interface. Additionally, it also listens for the wm hints coming from the client, but it doesn't support maximizing a window only vertically or horizontally. The window will be maximized only when both directions are maximized. Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
committed by
Bryce Harrington
parent
8aeeac827f
commit
6b4b24155f
+46
-26
@@ -3000,6 +3000,51 @@ shell_interface_set_fullscreen(struct shell_surface *shsurf,
|
||||
set_fullscreen(shsurf, method, framerate, output);
|
||||
}
|
||||
|
||||
static struct weston_output *
|
||||
get_focused_output(struct weston_compositor *compositor)
|
||||
{
|
||||
struct weston_seat *seat;
|
||||
struct weston_output *output = NULL;
|
||||
|
||||
wl_list_for_each(seat, &compositor->seat_list, link) {
|
||||
/* Priority has touch focus, then pointer and
|
||||
* then keyboard focus. We should probably have
|
||||
* three for loops and check frist for touch,
|
||||
* then for pointer, etc. but unless somebody has some
|
||||
* objections, I think this is sufficient. */
|
||||
if (seat->touch && seat->touch->focus)
|
||||
output = seat->touch->focus->output;
|
||||
else if (seat->pointer && seat->pointer->focus)
|
||||
output = seat->pointer->focus->output;
|
||||
else if (seat->keyboard && seat->keyboard->focus)
|
||||
output = seat->keyboard->focus->output;
|
||||
|
||||
if (output)
|
||||
break;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static void
|
||||
shell_interface_set_maximized(struct shell_surface *shsurf)
|
||||
{
|
||||
struct weston_output *output;
|
||||
|
||||
surface_clear_next_states(shsurf);
|
||||
shsurf->next_state.maximized = true;
|
||||
shsurf->state_changed = true;
|
||||
shsurf->type = SHELL_SURFACE_TOPLEVEL;
|
||||
|
||||
if (!weston_surface_is_mapped(shsurf->surface))
|
||||
output = get_focused_output(shsurf->surface->compositor);
|
||||
else
|
||||
output = shsurf->surface->output;
|
||||
|
||||
shell_surface_set_output(shsurf, output);
|
||||
send_configure_for_surface(shsurf);
|
||||
}
|
||||
|
||||
static int
|
||||
shell_interface_move(struct shell_surface *shsurf, struct weston_seat *ws)
|
||||
{
|
||||
@@ -3605,32 +3650,6 @@ get_primary_view(void *shell, struct shell_surface *shsurf)
|
||||
return shsurf->view;
|
||||
}
|
||||
|
||||
static struct weston_output *
|
||||
get_focused_output(struct weston_compositor *compositor)
|
||||
{
|
||||
struct weston_seat *seat;
|
||||
struct weston_output *output = NULL;
|
||||
|
||||
wl_list_for_each(seat, &compositor->seat_list, link) {
|
||||
/* Priority has touch focus, then pointer and
|
||||
* then keyboard focus. We should probably have
|
||||
* three for loops and check frist for touch,
|
||||
* then for pointer, etc. but unless somebody has some
|
||||
* objections, I think this is sufficient. */
|
||||
if (seat->touch && seat->touch->focus)
|
||||
output = seat->touch->focus->output;
|
||||
else if (seat->pointer && seat->pointer->focus)
|
||||
output = seat->pointer->focus->output;
|
||||
else if (seat->keyboard && seat->keyboard->focus)
|
||||
output = seat->keyboard->focus->output;
|
||||
|
||||
if (output)
|
||||
break;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static void
|
||||
shell_get_shell_surface(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
@@ -6633,6 +6652,7 @@ module_init(struct weston_compositor *ec,
|
||||
ec->shell_interface.resize = surface_resize;
|
||||
ec->shell_interface.set_title = set_title;
|
||||
ec->shell_interface.set_window_geometry = set_window_geometry;
|
||||
ec->shell_interface.set_maximized = shell_interface_set_maximized;
|
||||
|
||||
weston_layer_init(&shell->fullscreen_layer, &ec->cursor_layer.link);
|
||||
weston_layer_init(&shell->panel_layer, &shell->fullscreen_layer.link);
|
||||
|
||||
Reference in New Issue
Block a user