summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Rostislav Pehlivanov <atomnuker@gmail.com>2018-06-27 17:53:13 +0100
committerLibravatar Rostislav Pehlivanov <atomnuker@gmail.com>2018-06-30 11:10:47 +0100
commite0d0e8f840271ab12533cb16c9a7ccba237adcb3 (patch)
treea81bf679fc25f89cc09516e1920c4496b2e4c2f8
parentMerge pull request #2173 from emersion/fix-floating-no-frame-event (diff)
downloadsway-e0d0e8f840271ab12533cb16c9a7ccba237adcb3.tar.gz
sway-e0d0e8f840271ab12533cb16c9a7ccba237adcb3.tar.zst
sway-e0d0e8f840271ab12533cb16c9a7ccba237adcb3.zip
Revert "Don't unmaximize floating views"
-rw-r--r--include/sway/tree/view.h3
-rw-r--r--sway/desktop/output.c4
-rw-r--r--sway/desktop/xdg_shell.c16
-rw-r--r--sway/desktop/xdg_shell_v6.c10
-rw-r--r--sway/desktop/xwayland.c10
-rw-r--r--sway/tree/container.c3
-rw-r--r--sway/tree/view.c11
7 files changed, 51 insertions, 6 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 3df38e2d..91865232 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -32,6 +32,7 @@ struct sway_view_impl {
32 void (*configure)(struct sway_view *view, double lx, double ly, int width, 32 void (*configure)(struct sway_view *view, double lx, double ly, int width,
33 int height); 33 int height);
34 void (*set_activated)(struct sway_view *view, bool activated); 34 void (*set_activated)(struct sway_view *view, bool activated);
35 void (*set_tiled)(struct sway_view *view, bool tiled);
35 void (*set_fullscreen)(struct sway_view *view, bool fullscreen); 36 void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
36 bool (*wants_floating)(struct sway_view *view); 37 bool (*wants_floating)(struct sway_view *view);
37 void (*for_each_surface)(struct sway_view *view, 38 void (*for_each_surface)(struct sway_view *view,
@@ -223,6 +224,8 @@ void view_autoconfigure(struct sway_view *view);
223 224
224void view_set_activated(struct sway_view *view, bool activated); 225void view_set_activated(struct sway_view *view, bool activated);
225 226
227void view_set_tiled(struct sway_view *view, bool tiled);
228
226void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen); 229void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen);
227 230
228void view_set_fullscreen(struct sway_view *view, bool fullscreen); 231void view_set_fullscreen(struct sway_view *view, bool fullscreen);
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index f0f1603a..e1c44a28 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -645,7 +645,7 @@ static void render_container_simple(struct sway_output *output,
645 if (child->sway_view->border == B_NORMAL) { 645 if (child->sway_view->border == B_NORMAL) {
646 render_titlebar(output, damage, child, child->x, child->y, 646 render_titlebar(output, damage, child, child->x, child->y,
647 child->width, colors, title_texture, marks_texture); 647 child->width, colors, title_texture, marks_texture);
648 } else { 648 } else if (con->sway_view->border != B_NONE) {
649 render_top_border(output, damage, child, colors); 649 render_top_border(output, damage, child, colors);
650 } 650 }
651 render_view(output, damage, child, colors); 651 render_view(output, damage, child, colors);
@@ -815,7 +815,7 @@ static void render_floating_container(struct sway_output *soutput,
815 if (con->sway_view->border == B_NORMAL) { 815 if (con->sway_view->border == B_NORMAL) {
816 render_titlebar(soutput, damage, con, con->x, con->y, con->width, 816 render_titlebar(soutput, damage, con, con->x, con->y, con->width,
817 colors, title_texture, marks_texture); 817 colors, title_texture, marks_texture);
818 } else { 818 } else if (con->sway_view->border != B_NONE) {
819 render_top_border(soutput, damage, con, colors); 819 render_top_border(soutput, damage, con, colors);
820 } 820 }
821 render_view(soutput, damage, con, colors); 821 render_view(soutput, damage, con, colors);
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 8457c06b..6ac0f9c7 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -111,6 +111,19 @@ static void set_activated(struct sway_view *view, bool activated) {
111 } 111 }
112} 112}
113 113
114static void set_tiled(struct sway_view *view, bool tiled) {
115 if (xdg_shell_view_from_view(view) == NULL) {
116 return;
117 }
118 struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
119 enum wlr_edges edges = WLR_EDGE_NONE;
120 if (tiled) {
121 edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP |
122 WLR_EDGE_BOTTOM;
123 }
124 wlr_xdg_toplevel_set_tiled(surface, edges);
125}
126
114static void set_fullscreen(struct sway_view *view, bool fullscreen) { 127static void set_fullscreen(struct sway_view *view, bool fullscreen) {
115 if (xdg_shell_view_from_view(view) == NULL) { 128 if (xdg_shell_view_from_view(view) == NULL) {
116 return; 129 return;
@@ -164,6 +177,7 @@ static const struct sway_view_impl view_impl = {
164 .get_string_prop = get_string_prop, 177 .get_string_prop = get_string_prop,
165 .configure = configure, 178 .configure = configure,
166 .set_activated = set_activated, 179 .set_activated = set_activated,
180 .set_tiled = set_tiled,
167 .set_fullscreen = set_fullscreen, 181 .set_fullscreen = set_fullscreen,
168 .wants_floating = wants_floating, 182 .wants_floating = wants_floating,
169 .for_each_surface = for_each_surface, 183 .for_each_surface = for_each_surface,
@@ -273,8 +287,6 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
273 wlr_log(L_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'", 287 wlr_log(L_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'",
274 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); 288 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
275 wlr_xdg_surface_ping(xdg_surface); 289 wlr_xdg_surface_ping(xdg_surface);
276 wlr_xdg_toplevel_set_tiled(xdg_surface, WLR_EDGE_LEFT | WLR_EDGE_RIGHT |
277 WLR_EDGE_TOP | WLR_EDGE_BOTTOM);
278 290
279 struct sway_xdg_shell_view *xdg_shell_view = 291 struct sway_xdg_shell_view *xdg_shell_view =
280 calloc(1, sizeof(struct sway_xdg_shell_view)); 292 calloc(1, sizeof(struct sway_xdg_shell_view));
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index eb1cef26..a37a4caf 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -110,6 +110,14 @@ static void set_activated(struct sway_view *view, bool activated) {
110 } 110 }
111} 111}
112 112
113static void set_tiled(struct sway_view *view, bool tiled) {
114 if (xdg_shell_v6_view_from_view(view) == NULL) {
115 return;
116 }
117 struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6;
118 wlr_xdg_toplevel_v6_set_maximized(surface, tiled);
119}
120
113static void set_fullscreen(struct sway_view *view, bool fullscreen) { 121static void set_fullscreen(struct sway_view *view, bool fullscreen) {
114 if (xdg_shell_v6_view_from_view(view) == NULL) { 122 if (xdg_shell_v6_view_from_view(view) == NULL) {
115 return; 123 return;
@@ -164,6 +172,7 @@ static const struct sway_view_impl view_impl = {
164 .get_string_prop = get_string_prop, 172 .get_string_prop = get_string_prop,
165 .configure = configure, 173 .configure = configure,
166 .set_activated = set_activated, 174 .set_activated = set_activated,
175 .set_tiled = set_tiled,
167 .set_fullscreen = set_fullscreen, 176 .set_fullscreen = set_fullscreen,
168 .wants_floating = wants_floating, 177 .wants_floating = wants_floating,
169 .for_each_surface = for_each_surface, 178 .for_each_surface = for_each_surface,
@@ -273,7 +282,6 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
273 wlr_log(L_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", 282 wlr_log(L_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'",
274 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); 283 xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
275 wlr_xdg_surface_v6_ping(xdg_surface); 284 wlr_xdg_surface_v6_ping(xdg_surface);
276 wlr_xdg_toplevel_v6_set_maximized(xdg_surface, true);
277 285
278 struct sway_xdg_shell_v6_view *xdg_shell_v6_view = 286 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
279 calloc(1, sizeof(struct sway_xdg_shell_v6_view)); 287 calloc(1, sizeof(struct sway_xdg_shell_v6_view));
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index df5f6698..fcc8164f 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -199,6 +199,14 @@ static void set_activated(struct sway_view *view, bool activated) {
199 wlr_xwayland_surface_activate(surface, activated); 199 wlr_xwayland_surface_activate(surface, activated);
200} 200}
201 201
202static void set_tiled(struct sway_view *view, bool tiled) {
203 if (xwayland_view_from_view(view) == NULL) {
204 return;
205 }
206 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
207 wlr_xwayland_surface_set_maximized(surface, tiled);
208}
209
202static void set_fullscreen(struct sway_view *view, bool fullscreen) { 210static void set_fullscreen(struct sway_view *view, bool fullscreen) {
203 if (xwayland_view_from_view(view) == NULL) { 211 if (xwayland_view_from_view(view) == NULL) {
204 return; 212 return;
@@ -265,6 +273,7 @@ static const struct sway_view_impl view_impl = {
265 .get_int_prop = get_int_prop, 273 .get_int_prop = get_int_prop,
266 .configure = configure, 274 .configure = configure,
267 .set_activated = set_activated, 275 .set_activated = set_activated,
276 .set_tiled = set_tiled,
268 .set_fullscreen = set_fullscreen, 277 .set_fullscreen = set_fullscreen,
269 .wants_floating = wants_floating, 278 .wants_floating = wants_floating,
270 .close = _close, 279 .close = _close,
@@ -309,7 +318,6 @@ static void handle_map(struct wl_listener *listener, void *data) {
309 xwayland_view->commit.notify = handle_commit; 318 xwayland_view->commit.notify = handle_commit;
310 319
311 // Put it back into the tree 320 // Put it back into the tree
312 wlr_xwayland_surface_set_maximized(xsurface, true);
313 view_map(view, xsurface->surface); 321 view_map(view, xsurface->surface);
314 322
315 if (xsurface->fullscreen) { 323 if (xsurface->fullscreen) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index af55a54e..d8d5c34a 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -943,6 +943,9 @@ void container_set_floating(struct sway_container *container, bool enable) {
943 container_add_child(workspace, container); 943 container_add_child(workspace, container);
944 container->width = container->parent->width; 944 container->width = container->parent->width;
945 container->height = container->parent->height; 945 container->height = container->parent->height;
946 if (container->type == C_VIEW) {
947 view_set_tiled(container->sway_view, true);
948 }
946 container->is_sticky = false; 949 container->is_sticky = false;
947 container_reap_empty_recursive(workspace->sway_workspace->floating); 950 container_reap_empty_recursive(workspace->sway_workspace->floating);
948 } 951 }
diff --git a/sway/tree/view.c b/sway/tree/view.c
index de4ce2e6..98637c33 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -141,6 +141,9 @@ static void view_autoconfigure_floating(struct sway_view *view) {
141 view->border_top = view->border_bottom = true; 141 view->border_top = view->border_bottom = true;
142 view->border_left = view->border_right = true; 142 view->border_left = view->border_right = true;
143 143
144 // Don't maximize floating windows
145 view_set_tiled(view, false);
146
144 view_configure(view, lx, ly, width, height); 147 view_configure(view, lx, ly, width, height);
145} 148}
146 149
@@ -248,6 +251,7 @@ void view_autoconfigure(struct sway_view *view) {
248 251
249 view->x = x; 252 view->x = x;
250 view->y = y; 253 view->y = y;
254 view_set_tiled(view, true);
251 view_configure(view, x, y, width, height); 255 view_configure(view, x, y, width, height);
252} 256}
253 257
@@ -257,6 +261,13 @@ void view_set_activated(struct sway_view *view, bool activated) {
257 } 261 }
258} 262}
259 263
264void view_set_tiled(struct sway_view *view, bool tiled) {
265 view->border = tiled ? config->border : B_NONE;
266 if (view->impl->set_tiled) {
267 view->impl->set_tiled(view, tiled);
268 }
269}
270
260// Set fullscreen, but without IPC events or arranging windows. 271// Set fullscreen, but without IPC events or arranging windows.
261void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen) { 272void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen) {
262 if (view->is_fullscreen == fullscreen) { 273 if (view->is_fullscreen == fullscreen) {