diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-04-18 00:10:32 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-04-18 00:10:32 +1000 |
commit | 72beae209b03815e39d0aaa11348fa17c8a7bca9 (patch) | |
tree | fefa256f93c8fa7a3e80f9fb54accd0e6108e77a /sway/desktop | |
parent | Fix views unmapping their own fullscreen windows. (diff) | |
download | sway-72beae209b03815e39d0aaa11348fa17c8a7bca9.tar.gz sway-72beae209b03815e39d0aaa11348fa17c8a7bca9.tar.zst sway-72beae209b03815e39d0aaa11348fa17c8a7bca9.zip |
Fullscreen fixes.
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/wl_shell.c | 31 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 4 |
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) { | |||
61 | } | 61 | } |
62 | wl_list_remove(&wl_shell_view->commit.link); | 62 | wl_list_remove(&wl_shell_view->commit.link); |
63 | wl_list_remove(&wl_shell_view->destroy.link); | 63 | wl_list_remove(&wl_shell_view->destroy.link); |
64 | wl_list_remove(&wl_shell_view->request_fullscreen.link); | ||
65 | wl_list_remove(&wl_shell_view->set_state.link); | ||
64 | free(wl_shell_view); | 66 | free(wl_shell_view); |
65 | } | 67 | } |
66 | 68 | ||
69 | static void set_fullscreen(struct sway_view *view, bool fullscreen) { | ||
70 | // TODO | ||
71 | } | ||
72 | |||
67 | static const struct sway_view_impl view_impl = { | 73 | static const struct sway_view_impl view_impl = { |
68 | .get_prop = get_prop, | 74 | .get_prop = get_prop, |
69 | .configure = configure, | 75 | .configure = configure, |
70 | .close = _close, | 76 | .close = _close, |
71 | .destroy = destroy, | 77 | .destroy = destroy, |
78 | .set_fullscreen = set_fullscreen, | ||
72 | }; | 79 | }; |
73 | 80 | ||
74 | static void handle_commit(struct wl_listener *listener, void *data) { | 81 | static void handle_commit(struct wl_listener *listener, void *data) { |
@@ -88,6 +95,23 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
88 | view_destroy(&wl_shell_view->view); | 95 | view_destroy(&wl_shell_view->view); |
89 | } | 96 | } |
90 | 97 | ||
98 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | ||
99 | struct sway_wl_shell_view *wl_shell_view = | ||
100 | wl_container_of(listener, wl_shell_view, request_fullscreen); | ||
101 | view_set_fullscreen(&wl_shell_view->view, true); | ||
102 | } | ||
103 | |||
104 | static void handle_set_state(struct wl_listener *listener, void *data) { | ||
105 | struct sway_wl_shell_view *wl_shell_view = | ||
106 | wl_container_of(listener, wl_shell_view, set_state); | ||
107 | struct sway_view *view = &wl_shell_view->view; | ||
108 | struct wlr_wl_shell_surface *surface = view->wlr_wl_shell_surface; | ||
109 | if (view->is_fullscreen && | ||
110 | surface->state != WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) { | ||
111 | view_set_fullscreen(view, false); | ||
112 | } | ||
113 | } | ||
114 | |||
91 | void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | 115 | void handle_wl_shell_surface(struct wl_listener *listener, void *data) { |
92 | struct sway_server *server = wl_container_of(listener, server, | 116 | struct sway_server *server = wl_container_of(listener, server, |
93 | wl_shell_surface); | 117 | wl_shell_surface); |
@@ -127,6 +151,13 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
127 | wl_shell_view->destroy.notify = handle_destroy; | 151 | wl_shell_view->destroy.notify = handle_destroy; |
128 | wl_signal_add(&shell_surface->events.destroy, &wl_shell_view->destroy); | 152 | wl_signal_add(&shell_surface->events.destroy, &wl_shell_view->destroy); |
129 | 153 | ||
154 | wl_shell_view->request_fullscreen.notify = handle_request_fullscreen; | ||
155 | wl_signal_add(&shell_surface->events.request_fullscreen, | ||
156 | &wl_shell_view->request_fullscreen); | ||
157 | |||
158 | wl_shell_view->set_state.notify = handle_set_state; | ||
159 | wl_signal_add(&shell_surface->events.set_state, &wl_shell_view->set_state); | ||
160 | |||
130 | view_map(&wl_shell_view->view, shell_surface->surface); | 161 | view_map(&wl_shell_view->view, shell_surface->surface); |
131 | 162 | ||
132 | if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) { | 163 | 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) | |||
229 | wl_container_of(listener, xdg_shell_v6_view, request_fullscreen); | 229 | wl_container_of(listener, xdg_shell_v6_view, request_fullscreen); |
230 | struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; | 230 | struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; |
231 | 231 | ||
232 | if (xdg_shell_v6_view->view.wlr_xdg_surface_v6->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { | 232 | if (!sway_assert(xdg_shell_v6_view->view.wlr_xdg_surface_v6->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, |
233 | "xdg_shell_v6 requested fullscreen of surface with role %i", | ||
234 | xdg_shell_v6_view->view.wlr_xdg_surface_v6->role)) { | ||
233 | return; | 235 | return; |
234 | } | 236 | } |
235 | 237 | ||