aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/wl_shell.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-04-18 00:10:32 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-04-18 00:10:32 +1000
commit72beae209b03815e39d0aaa11348fa17c8a7bca9 (patch)
treefefa256f93c8fa7a3e80f9fb54accd0e6108e77a /sway/desktop/wl_shell.c
parentcc4da245a8e4a746ebd379ca8dd6cc3b33ded8e4 (diff)
Fullscreen fixes.
Diffstat (limited to 'sway/desktop/wl_shell.c')
-rw-r--r--sway/desktop/wl_shell.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c
index 96332e5c..2d666d95 100644
--- a/sway/desktop/wl_shell.c
+++ b/sway/desktop/wl_shell.c
@@ -61,14 +61,21 @@ static void destroy(struct sway_view *view) {
}
wl_list_remove(&wl_shell_view->commit.link);
wl_list_remove(&wl_shell_view->destroy.link);
+ wl_list_remove(&wl_shell_view->request_fullscreen.link);
+ wl_list_remove(&wl_shell_view->set_state.link);
free(wl_shell_view);
}
+static void set_fullscreen(struct sway_view *view, bool fullscreen) {
+ // TODO
+}
+
static const struct sway_view_impl view_impl = {
.get_prop = get_prop,
.configure = configure,
.close = _close,
.destroy = destroy,
+ .set_fullscreen = set_fullscreen,
};
static void handle_commit(struct wl_listener *listener, void *data) {
@@ -88,6 +95,23 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
view_destroy(&wl_shell_view->view);
}
+static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
+ struct sway_wl_shell_view *wl_shell_view =
+ wl_container_of(listener, wl_shell_view, request_fullscreen);
+ view_set_fullscreen(&wl_shell_view->view, true);
+}
+
+static void handle_set_state(struct wl_listener *listener, void *data) {
+ struct sway_wl_shell_view *wl_shell_view =
+ wl_container_of(listener, wl_shell_view, set_state);
+ struct sway_view *view = &wl_shell_view->view;
+ struct wlr_wl_shell_surface *surface = view->wlr_wl_shell_surface;
+ if (view->is_fullscreen &&
+ surface->state != WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) {
+ view_set_fullscreen(view, false);
+ }
+}
+
void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server,
wl_shell_surface);
@@ -127,6 +151,13 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
wl_shell_view->destroy.notify = handle_destroy;
wl_signal_add(&shell_surface->events.destroy, &wl_shell_view->destroy);
+ wl_shell_view->request_fullscreen.notify = handle_request_fullscreen;
+ wl_signal_add(&shell_surface->events.request_fullscreen,
+ &wl_shell_view->request_fullscreen);
+
+ wl_shell_view->set_state.notify = handle_set_state;
+ wl_signal_add(&shell_surface->events.set_state, &wl_shell_view->set_state);
+
view_map(&wl_shell_view->view, shell_surface->surface);
if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) {