aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-09 20:06:05 +0100
committeremersion <contact@emersion.fr>2017-11-09 20:06:05 +0100
commit26dadacb7199d28af672cca3f91713e173a41258 (patch)
tree5c4f97e5ee352b50ef85b727358010c09521ae44 /rootston
parent758514fe5d67d226290694208a34f90d1a857d8e (diff)
Add wl_shell support for maximized views
Diffstat (limited to 'rootston')
-rw-r--r--rootston/wl_shell.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index e38eb697..3ac8fe61 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -49,6 +49,26 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
view_begin_resize(input, event->cursor, view, e->edges);
}
+static void handle_request_set_maximized(struct wl_listener *listener,
+ void *data) {
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, request_set_maximized);
+ struct roots_view *view = roots_surface->view;
+ //struct wlr_wl_shell_surface_set_maximized_event *e = data;
+ view_maximize(view, true);
+}
+
+static void handle_set_state(struct wl_listener *listener, void *data) {
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, set_state);
+ struct roots_view *view = roots_surface->view;
+ struct wlr_wl_shell_surface *surface = view->wl_shell_surface;
+ if (view->maximized &&
+ surface->state != WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED) {
+ view_maximize(view, false);
+ }
+}
+
static void handle_surface_commit(struct wl_listener *listener, void *data) {
// TODO do we need to do anything here?
}
@@ -60,6 +80,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&roots_surface->destroy.link);
wl_list_remove(&roots_surface->request_move.link);
wl_list_remove(&roots_surface->request_resize.link);
+ wl_list_remove(&roots_surface->request_set_maximized.link);
+ wl_list_remove(&roots_surface->set_state.link);
+ wl_list_remove(&roots_surface->surface_commit.link);
view_destroy(roots_surface->view);
free(roots_surface);
}
@@ -93,6 +116,11 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->request_resize.notify = handle_request_resize;
wl_signal_add(&surface->events.request_resize,
&roots_surface->request_resize);
+ roots_surface->request_set_maximized.notify = handle_request_set_maximized;
+ wl_signal_add(&surface->events.request_set_maximized,
+ &roots_surface->request_set_maximized);
+ roots_surface->set_state.notify = handle_set_state;
+ wl_signal_add(&surface->events.set_state, &roots_surface->set_state);
roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&surface->surface->events.commit,
&roots_surface->surface_commit);