[PATCH 8/8] xdg-shell: Add key bindings for setting maximized and fullscreen.
Rafael Antognolli
rafael.antognolli at intel.com
Tue Dec 3 09:35:48 PST 2013
---
src/shell.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/src/shell.c b/src/shell.c
index 5c0660e..c873c5a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3971,6 +3971,54 @@ move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *dat
}
static void
+maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
+{
+ struct weston_surface *focus = seat->pointer->focus->surface;
+ struct weston_surface *surface;
+ struct shell_surface *shsurf;
+
+ surface = weston_surface_get_main_surface(focus);
+ if (surface == NULL)
+ return;
+
+ shsurf = get_shell_surface(surface);
+ if (shsurf == NULL)
+ return;
+
+ if (!shell_surface_is_xdg_surface(shsurf))
+ return;
+
+ if (shsurf->state.maximized)
+ xdg_surface_send_request_unset_maximized(shsurf->resource);
+ else
+ xdg_surface_send_request_set_maximized(shsurf->resource);
+}
+
+static void
+fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
+{
+ struct weston_surface *focus = seat->pointer->focus->surface;
+ struct weston_surface *surface;
+ struct shell_surface *shsurf;
+
+ surface = weston_surface_get_main_surface(focus);
+ if (surface == NULL)
+ return;
+
+ shsurf = get_shell_surface(surface);
+ if (shsurf == NULL)
+ return;
+
+ if (!shell_surface_is_xdg_surface(shsurf))
+ return;
+
+ if (shsurf->state.fullscreen)
+ xdg_surface_send_request_unset_fullscreen(shsurf->resource);
+ else
+ xdg_surface_send_request_set_fullscreen(shsurf->resource);
+}
+
+static void
touch_move_binding(struct weston_seat *seat, uint32_t time, void *data)
{
struct weston_surface *focus = seat->touch->focus->surface;
@@ -6697,6 +6745,10 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
zoom_key_binding, NULL);
weston_compositor_add_key_binding(ec, KEY_PAGEDOWN, mod,
zoom_key_binding, NULL);
+ weston_compositor_add_key_binding(ec, KEY_M, mod, maximize_binding,
+ NULL);
+ weston_compositor_add_key_binding(ec, KEY_F, mod, fullscreen_binding,
+ NULL);
weston_compositor_add_button_binding(ec, BTN_LEFT, mod, move_binding,
shell);
weston_compositor_add_touch_binding(ec, mod, touch_move_binding, shell);
--
1.8.3.1
More information about the wayland-devel
mailing list