aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-08 23:03:07 +0100
committeremersion <contact@emersion.fr>2017-11-08 23:03:07 +0100
commit2118c691b13c20d7100abfa02f9e274667501aef (patch)
tree4807e9cbf387c26a520cda4915f0e169d993f6a0
parent4df8be1a8f32ea59f88a179104885c0452a89d6e (diff)
Add maximize support for xwayland in rootston
-rw-r--r--include/rootston/view.h1
-rw-r--r--rootston/xwayland.c31
2 files changed, 26 insertions, 6 deletions
diff --git a/include/rootston/view.h b/include/rootston/view.h
index 67643b94..f6ac0d23 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -36,6 +36,7 @@ struct roots_xwayland_surface {
struct wl_listener request_configure;
struct wl_listener request_move;
struct wl_listener request_resize;
+ struct wl_listener request_maximize;
struct wl_listener map_notify;
struct wl_listener unmap_notify;
};
diff --git a/rootston/xwayland.c b/rootston/xwayland.c
index e3fc1c84..431586ba 100644
--- a/rootston/xwayland.c
+++ b/rootston/xwayland.c
@@ -85,6 +85,13 @@ static void close(struct roots_view *view) {
wlr_xwayland_surface_close(view->desktop->xwayland, view->xwayland_surface);
}
+static void maximize(struct roots_view *view, bool maximized) {
+ assert(view->type == ROOTS_XWAYLAND_VIEW);
+
+ wlr_xwayland_surface_set_maximized(view->desktop->xwayland,
+ view->xwayland_surface, maximized);
+}
+
static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
@@ -161,6 +168,17 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
view_begin_resize(input, cursor, view, e->edges);
}
+static void handle_request_maximize(struct wl_listener *listener, void *data) {
+ struct roots_xwayland_surface *roots_surface =
+ wl_container_of(listener, roots_surface, request_resize);
+ struct roots_view *view = roots_surface->view;
+ struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface;
+
+ bool maximized = xwayland_surface->maximized_vert &&
+ xwayland_surface->maximized_horz;
+ view_maximize(view, maximized);
+}
+
static void handle_map_notify(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, map_notify);
@@ -202,24 +220,24 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
if (roots_surface == NULL) {
return;
}
+
roots_surface->destroy.notify = handle_destroy;
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
-
roots_surface->request_configure.notify = handle_request_configure;
wl_signal_add(&surface->events.request_configure,
&roots_surface->request_configure);
-
roots_surface->map_notify.notify = handle_map_notify;
wl_signal_add(&surface->events.map_notify, &roots_surface->map_notify);
-
roots_surface->unmap_notify.notify = handle_unmap_notify;
wl_signal_add(&surface->events.unmap_notify, &roots_surface->unmap_notify);
-
roots_surface->request_move.notify = handle_request_move;
wl_signal_add(&surface->events.request_move, &roots_surface->request_move);
-
roots_surface->request_resize.notify = handle_request_resize;
- wl_signal_add(&surface->events.request_resize, &roots_surface->request_resize);
+ wl_signal_add(&surface->events.request_resize,
+ &roots_surface->request_resize);
+ roots_surface->request_maximize.notify = handle_request_maximize;
+ wl_signal_add(&surface->events.request_maximize,
+ &roots_surface->request_maximize);
struct roots_view *view = calloc(1, sizeof(struct roots_view));
if (view == NULL) {
@@ -237,6 +255,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->resize = resize;
view->move = move;
view->move_resize = move_resize;
+ view->maximize = maximize;
view->close = close;
roots_surface->view = view;
wlr_list_add(desktop->views, view);