From 52420cc24d61db8d22cf0d391f1f84b37bf087d5 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 16 Apr 2018 20:36:40 +1000 Subject: Implement fullscreen. --- sway/desktop/output.c | 24 ++++++++++++++++-------- sway/desktop/xdg_shell_v6.c | 26 ++++++++++++++++++++++++++ sway/desktop/xwayland.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 8 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 1b3143d0..b86f20e8 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -273,17 +273,25 @@ static void render_output(struct sway_output *output, struct timespec *when, float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; wlr_renderer_clear(renderer, clear_color); - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); - struct sway_container *workspace = output_get_active_workspace(output); - render_container(output, workspace); - render_unmanaged(output, &root_container.sway_root->xwayland_unmanaged); + if (workspace->fullscreen) { + wlr_output_set_fullscreen_surface(wlr_output, + workspace->fullscreen->surface); + } else { + wlr_output_set_fullscreen_surface(wlr_output, NULL); + render_layer(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); + render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); + + render_container(output, workspace); - // TODO: consider revising this when fullscreen windows are supported - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); + render_unmanaged(output, &root_container.sway_root->xwayland_unmanaged); + + render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); + render_layer(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); + } renderer_end: if (root_container.sway_root->debug_tree) { diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index e4703040..133b60c3 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -118,6 +118,14 @@ static void set_activated(struct sway_view *view, bool activated) { } } +static void set_fullscreen(struct sway_view *view, bool fullscreen) { + if (xdg_shell_v6_view_from_view(view) == NULL) { + return; + } + struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; + wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen); +} + static void for_each_surface(struct sway_view *view, wlr_surface_iterator_func_t iterator, void *user_data) { if (xdg_shell_v6_view_from_view(view) == NULL) { @@ -146,6 +154,7 @@ static void destroy(struct sway_view *view) { wl_list_remove(&xdg_shell_v6_view->destroy.link); wl_list_remove(&xdg_shell_v6_view->map.link); wl_list_remove(&xdg_shell_v6_view->unmap.link); + wl_list_remove(&xdg_shell_v6_view->request_fullscreen.link); free(xdg_shell_v6_view); } @@ -153,6 +162,7 @@ static const struct sway_view_impl view_impl = { .get_prop = get_prop, .configure = configure, .set_activated = set_activated, + .set_fullscreen = set_fullscreen, .for_each_surface = for_each_surface, .close = _close, .destroy = destroy, @@ -210,6 +220,18 @@ static void handle_destroy(struct wl_listener *listener, void *data) { view_destroy(&xdg_shell_v6_view->view); } +static void handle_request_fullscreen(struct wl_listener *listener, void *data) { + struct sway_xdg_shell_v6_view *xdg_shell_v6_view = + 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) { + return; + } + + view_set_fullscreen(&xdg_shell_v6_view->view, e->fullscreen); +} + void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { struct sway_server *server = wl_container_of(listener, server, xdg_shell_v6_surface); @@ -246,4 +268,8 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { xdg_shell_v6_view->destroy.notify = handle_destroy; wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_v6_view->destroy); + + xdg_shell_v6_view->request_fullscreen.notify = handle_request_fullscreen; + wl_signal_add(&xdg_surface->toplevel->events.request_fullscreen, + &xdg_shell_v6_view->request_fullscreen); } diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 69166af0..716d8882 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -25,6 +25,15 @@ static void unmanaged_handle_request_configure(struct wl_listener *listener, ev->width, ev->height); } +static void unmanaged_handle_request_fullscreen(struct wl_listener *listener, + void *data) { + struct sway_xwayland_view *xwayland_view = + wl_container_of(listener, xwayland_view, request_fullscreen); + struct sway_view *view = &xwayland_view->view; + struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; + view_set_fullscreen(view, xsurface->fullscreen); +} + static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { struct sway_xwayland_unmanaged *surface = wl_container_of(listener, surface, commit); @@ -106,6 +115,9 @@ static struct sway_xwayland_unmanaged *create_unmanaged( wl_signal_add(&xsurface->events.request_configure, &surface->request_configure); surface->request_configure.notify = unmanaged_handle_request_configure; + wl_signal_add(&xsurface->events.request_fullscreen, + &surface->request_fullscreen); + surface->request_fullscreen.notify = unmanaged_handle_request_fullscreen; wl_signal_add(&xsurface->events.map, &surface->map); surface->map.notify = unmanaged_handle_map; wl_signal_add(&xsurface->events.unmap, &surface->unmap); @@ -179,6 +191,14 @@ static void set_activated(struct sway_view *view, bool activated) { wlr_xwayland_surface_activate(surface, activated); } +static void set_fullscreen(struct sway_view *view, bool fullscreen) { + if (xwayland_view_from_view(view) == NULL) { + return; + } + struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; + wlr_xwayland_surface_set_fullscreen(surface, fullscreen); +} + static void _close(struct sway_view *view) { if (xwayland_view_from_view(view) == NULL) { return; @@ -193,6 +213,7 @@ static void destroy(struct sway_view *view) { } wl_list_remove(&xwayland_view->destroy.link); wl_list_remove(&xwayland_view->request_configure.link); + wl_list_remove(&xwayland_view->request_fullscreen.link); wl_list_remove(&xwayland_view->map.link); wl_list_remove(&xwayland_view->unmap.link); free(xwayland_view); @@ -202,6 +223,7 @@ static const struct sway_view_impl view_impl = { .get_prop = get_prop, .configure = configure, .set_activated = set_activated, + .set_fullscreen = set_fullscreen, .close = _close, .destroy = destroy, }; @@ -263,6 +285,14 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { ev->width, ev->height); } +static void handle_request_fullscreen(struct wl_listener *listener, void *data) { + struct sway_xwayland_view *xwayland_view = + wl_container_of(listener, xwayland_view, request_fullscreen); + struct sway_view *view = &xwayland_view->view; + struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; + view_set_fullscreen(view, xsurface->fullscreen); +} + void handle_xwayland_surface(struct wl_listener *listener, void *data) { struct sway_server *server = wl_container_of(listener, server, xwayland_surface); @@ -298,6 +328,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { &xwayland_view->request_configure); xwayland_view->request_configure.notify = handle_request_configure; + wl_signal_add(&xsurface->events.request_fullscreen, + &xwayland_view->request_fullscreen); + xwayland_view->request_fullscreen.notify = handle_request_fullscreen; + wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); xwayland_view->unmap.notify = handle_unmap; -- cgit v1.2.3 From bfd5834f4c1046c234ceaae212e65e045cd51460 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 17 Apr 2018 08:11:50 +1000 Subject: Feedback for fullscreen. --- sway/desktop/output.c | 6 ++---- sway/desktop/xwayland.c | 12 ------------ 2 files changed, 2 insertions(+), 16 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index b86f20e8..dc2f6380 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -287,11 +287,9 @@ static void render_output(struct sway_output *output, struct timespec *when, render_container(output, workspace); render_unmanaged(output, &root_container.sway_root->xwayland_unmanaged); - - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); - render_layer(output, - &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); } + render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); + render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); renderer_end: if (root_container.sway_root->debug_tree) { diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 716d8882..963c5a0e 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -25,15 +25,6 @@ static void unmanaged_handle_request_configure(struct wl_listener *listener, ev->width, ev->height); } -static void unmanaged_handle_request_fullscreen(struct wl_listener *listener, - void *data) { - struct sway_xwayland_view *xwayland_view = - wl_container_of(listener, xwayland_view, request_fullscreen); - struct sway_view *view = &xwayland_view->view; - struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; - view_set_fullscreen(view, xsurface->fullscreen); -} - static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { struct sway_xwayland_unmanaged *surface = wl_container_of(listener, surface, commit); @@ -115,9 +106,6 @@ static struct sway_xwayland_unmanaged *create_unmanaged( wl_signal_add(&xsurface->events.request_configure, &surface->request_configure); surface->request_configure.notify = unmanaged_handle_request_configure; - wl_signal_add(&xsurface->events.request_fullscreen, - &surface->request_fullscreen); - surface->request_fullscreen.notify = unmanaged_handle_request_fullscreen; wl_signal_add(&xsurface->events.map, &surface->map); surface->map.notify = unmanaged_handle_map; wl_signal_add(&xsurface->events.unmap, &surface->unmap); -- cgit v1.2.3 From c685ef081f090d1e15428f55426e02f2274312d0 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 17 Apr 2018 09:31:34 +1000 Subject: Create sway_workspace struct. --- sway/desktop/output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index dc2f6380..74919ccd 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -22,6 +22,7 @@ #include "sway/tree/container.h" #include "sway/tree/layout.h" #include "sway/tree/view.h" +#include "sway/tree/workspace.h" struct sway_container *output_by_name(const char *name) { for (int i = 0; i < root_container.children->length; ++i) { @@ -275,9 +276,9 @@ static void render_output(struct sway_output *output, struct timespec *when, struct sway_container *workspace = output_get_active_workspace(output); - if (workspace->fullscreen) { + if (workspace->sway_workspace->fullscreen) { wlr_output_set_fullscreen_surface(wlr_output, - workspace->fullscreen->surface); + workspace->sway_workspace->fullscreen->surface); } else { wlr_output_set_fullscreen_surface(wlr_output, NULL); render_layer(output, -- cgit v1.2.3 From a44d016e2b24a3454551c27f9252b4c419968760 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 17 Apr 2018 10:58:42 +1000 Subject: Don't damage views if they're hidden by a fullscreen view. --- sway/desktop/output.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 74919ccd..361a92d0 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -469,6 +469,12 @@ void output_damage_view(struct sway_output *output, struct sway_view *view, return; } + struct sway_container *workspace = container_parent(view->swayc, + C_WORKSPACE); + if (workspace->sway_workspace->fullscreen && !view->is_fullscreen) { + return; + } + struct damage_data data = { .output = output, .whole = whole, -- cgit v1.2.3 From 143b528f71ea71393368815eecebf900ff45cf9d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 17 Apr 2018 11:04:57 +1000 Subject: Handle fullscreen flag when mapping a surface. --- sway/desktop/wl_shell.c | 4 ++++ sway/desktop/xdg_shell_v6.c | 4 ++++ sway/desktop/xwayland.c | 4 ++++ 3 files changed, 12 insertions(+) (limited to 'sway/desktop') diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index b63c220c..96332e5c 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c @@ -128,4 +128,8 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { wl_signal_add(&shell_surface->events.destroy, &wl_shell_view->destroy); view_map(&wl_shell_view->view, shell_surface->surface); + + if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) { + view_set_fullscreen(&wl_shell_view->view, true); + } } diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 133b60c3..731862a9 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -212,6 +212,10 @@ static void handle_map(struct wl_listener *listener, void *data) { xdg_shell_v6_view->new_popup.notify = handle_new_popup; wl_signal_add(&xdg_surface->events.new_popup, &xdg_shell_v6_view->new_popup); + + if (xdg_surface->toplevel->current.fullscreen) { + view_set_fullscreen(view, true); + } } static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 963c5a0e..46eaa84c 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -248,6 +248,10 @@ static void handle_map(struct wl_listener *listener, void *data) { // Put it back into the tree wlr_xwayland_surface_set_maximized(xsurface, true); view_map(view, xsurface->surface); + + if (xsurface->fullscreen) { + view_set_fullscreen(view, true); + } } static void handle_destroy(struct wl_listener *listener, void *data) { -- cgit v1.2.3 From 72beae209b03815e39d0aaa11348fa17c8a7bca9 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 18 Apr 2018 00:10:32 +1000 Subject: Fullscreen fixes. --- sway/desktop/wl_shell.c | 31 +++++++++++++++++++++++++++++++ sway/desktop/xdg_shell_v6.c | 4 +++- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'sway/desktop') 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; } -- cgit v1.2.3 From 35ccdd67a89280c1d906ed914d67918cfb382e1f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 18 Apr 2018 08:35:28 +1000 Subject: More fullscreen fixes. * Render fullscreen views without wlr function, which makes popups and lockscreen work. * Don't allow input events to surfaces behind fullscreen views. * Use correct output dimensions (for rotated outputs). --- sway/desktop/output.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 361a92d0..a5f2f71f 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -229,7 +229,11 @@ static void render_container_iterator(struct sway_container *con, static void render_container(struct sway_output *output, struct sway_container *con) { - container_descendants(con, C_VIEW, render_container_iterator, output); + if (con->type == C_VIEW) { // Happens if a view is fullscreened + render_container_iterator(con, output); + } else { + container_descendants(con, C_VIEW, render_container_iterator, output); + } } static struct sway_container *output_get_active_workspace( @@ -277,10 +281,8 @@ static void render_output(struct sway_output *output, struct timespec *when, struct sway_container *workspace = output_get_active_workspace(output); if (workspace->sway_workspace->fullscreen) { - wlr_output_set_fullscreen_surface(wlr_output, - workspace->sway_workspace->fullscreen->surface); + render_container(output, workspace->sway_workspace->fullscreen->swayc); } else { - wlr_output_set_fullscreen_surface(wlr_output, NULL); render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); -- cgit v1.2.3 From 8d06b222f048e5a27c4c5b0bc46ceaab7639502f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 18 Apr 2018 13:06:10 +1000 Subject: Fullscreen rendering and input fixes. * Render background when using fullscreen, because transparency. * Check that fullscreen surface allows input. * Don't look for surfaces in top layer if there's a fullscreen view. --- sway/desktop/output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index a5f2f71f..299b57f1 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -280,11 +280,11 @@ static void render_output(struct sway_output *output, struct timespec *when, struct sway_container *workspace = output_get_active_workspace(output); + render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); + if (workspace->sway_workspace->fullscreen) { render_container(output, workspace->sway_workspace->fullscreen->swayc); } else { - render_layer(output, - &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); render_container(output, workspace); -- cgit v1.2.3 From 2acfbc519ef7940b620abef0de64ae79d1f50782 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 19 Apr 2018 12:47:34 +1000 Subject: xdg_shell_v6: Use client_pending state instead of current It appears client_pending is the state that should be used here. --- sway/desktop/xdg_shell_v6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sway/desktop') diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 6c0556b2..87e34666 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -213,7 +213,7 @@ static void handle_map(struct wl_listener *listener, void *data) { wl_signal_add(&xdg_surface->events.new_popup, &xdg_shell_v6_view->new_popup); - if (xdg_surface->toplevel->current.fullscreen) { + if (xdg_surface->toplevel->client_pending.fullscreen) { view_set_fullscreen(view, true); } } -- cgit v1.2.3 From 9715e38ca82f891afdb824d02b7f19a2587e24c1 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 19 Apr 2018 13:01:43 +1000 Subject: render_output(): When fullscreen, clear to black and don't render background --- sway/desktop/output.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 299b57f1..1ab9324d 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -275,16 +275,18 @@ static void render_output(struct sway_output *output, struct timespec *when, wlr_output_transformed_resolution(wlr_output, &width, &height); pixman_region32_union_rect(damage, damage, 0, 0, width, height); - float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; - wlr_renderer_clear(renderer, clear_color); - struct sway_container *workspace = output_get_active_workspace(output); - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); - if (workspace->sway_workspace->fullscreen) { + float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; + wlr_renderer_clear(renderer, clear_color); render_container(output, workspace->sway_workspace->fullscreen->swayc); } else { + float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; + wlr_renderer_clear(renderer, clear_color); + + render_layer(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); render_container(output, workspace); -- cgit v1.2.3 From bd67342bdc82d53bbe492e9ac515600d4a649bc9 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 20 Apr 2018 08:08:34 +1000 Subject: Don't render top layer when fullscreen. --- sway/desktop/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 1ab9324d..4a1b0c84 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -292,8 +292,8 @@ static void render_output(struct sway_output *output, struct timespec *when, render_container(output, workspace); render_unmanaged(output, &root_container.sway_root->xwayland_unmanaged); + render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); } - render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); renderer_end: -- cgit v1.2.3 From 76837b91325c4bbb2fd631a30a26f125493ca631 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 20 Apr 2018 08:10:58 +1000 Subject: Ignore xdg_shell_v6 request_fullscreen if not mapped --- sway/desktop/xdg_shell_v6.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sway/desktop') diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 87e34666..fdfb9346 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -234,6 +234,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) xdg_shell_v6_view->view.wlr_xdg_surface_v6->role)) { return; } + if (!xdg_shell_v6_view->view.wlr_xdg_surface_v6->mapped) { + return; + } view_set_fullscreen(&xdg_shell_v6_view->view, e->fullscreen); } -- cgit v1.2.3 From 6afccd07d95582a72e36b49454266ab0cebec7c0 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 20 Apr 2018 08:12:03 +1000 Subject: Add TODO about rendering fullscreen views smaller than the output --- sway/desktop/output.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 4a1b0c84..8d25caae 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -280,6 +280,7 @@ static void render_output(struct sway_output *output, struct timespec *when, if (workspace->sway_workspace->fullscreen) { float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; wlr_renderer_clear(renderer, clear_color); + // TODO: handle views smaller than the output render_container(output, workspace->sway_workspace->fullscreen->swayc); } else { float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; -- cgit v1.2.3