aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/wl_shell.c31
-rw-r--r--sway/desktop/xdg_shell_v6.c4
2 files changed, 34 insertions, 1 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) {
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 731862a9..6c0556b2 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -229,7 +229,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
wl_container_of(listener, xdg_shell_v6_view, request_fullscreen);
struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data;
- if (xdg_shell_v6_view->view.wlr_xdg_surface_v6->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
+ if (!sway_assert(xdg_shell_v6_view->view.wlr_xdg_surface_v6->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL,
+ "xdg_shell_v6 requested fullscreen of surface with role %i",
+ xdg_shell_v6_view->view.wlr_xdg_surface_v6->role)) {
return;
}