aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-10-11 09:11:56 +0200
committerLibravatar D.B <thejan.2009@gmail.com>2016-10-11 09:16:59 +0200
commit166c2a3687d2819184457490132dd0c109238873 (patch)
tree13d40041fc41a2ba8d4f03ce403395334f8397d4 /sway
parentadd workspace_layout, ensure ws is always L_HORIZ (diff)
downloadsway-166c2a3687d2819184457490132dd0c109238873.tar.gz
sway-166c2a3687d2819184457490132dd0c109238873.tar.zst
sway-166c2a3687d2819184457490132dd0c109238873.zip
generalize wrapping views under workspaces
Diffstat (limited to 'sway')
-rw-r--r--sway/handlers.c11
-rw-r--r--sway/layout.c10
2 files changed, 10 insertions, 11 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 75f2d5a6..9a84182a 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -334,7 +334,6 @@ static bool handle_view_created(wlc_handle handle) {
334 wlc_view_get_geometry(handle)->size.h, wlc_view_get_title(handle), 334 wlc_view_get_geometry(handle)->size.h, wlc_view_get_title(handle),
335 wlc_view_get_class(handle), wlc_view_get_app_id(handle)); 335 wlc_view_get_class(handle), wlc_view_get_app_id(handle));
336 336
337 bool encapsulate_view = false;
338 // TODO properly figure out how each window should be handled. 337 // TODO properly figure out how each window should be handled.
339 switch (wlc_view_get_type(handle)) { 338 switch (wlc_view_get_type(handle)) {
340 // regular view created regularly 339 // regular view created regularly
@@ -342,12 +341,6 @@ static bool handle_view_created(wlc_handle handle) {
342 if (parent) { 341 if (parent) {
343 newview = new_floating_view(handle); 342 newview = new_floating_view(handle);
344 } else { 343 } else {
345 if (focused->type == C_WORKSPACE &&
346 /* focused->children->length == 0 && */
347 (focused->workspace_layout == L_TABBED || focused->workspace_layout == L_STACKED)) {
348 // will wrap the view in a container later on
349 encapsulate_view = true;
350 }
351 newview = new_view(focused, handle); 344 newview = new_view(focused, handle);
352 wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); 345 wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true);
353 } 346 }
@@ -381,10 +374,6 @@ static bool handle_view_created(wlc_handle handle) {
381 suspend_workspace_cleanup = true; 374 suspend_workspace_cleanup = true;
382 375
383 if (newview) { 376 if (newview) {
384 // first view on tabbed/stacked workspace was created, wrap it in a container
385 if (encapsulate_view && newview->parent) {
386 new_container(newview, newview->parent->workspace_layout);
387 }
388 ipc_event_window(newview, "new"); 377 ipc_event_window(newview, "new");
389 set_focused_container(newview); 378 set_focused_container(newview);
390 wlc_view_set_mask(handle, VISIBLE); 379 wlc_view_set_mask(handle, VISIBLE);
diff --git a/sway/layout.c b/sway/layout.c
index a57306e0..8565113d 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -66,6 +66,11 @@ void add_child(swayc_t *parent, swayc_t *child) {
66 if (!parent->focused) { 66 if (!parent->focused) {
67 parent->focused = child; 67 parent->focused = child;
68 } 68 }
69
70 // wrap view into a container
71 if (parent->type == C_WORKSPACE && child->type == C_VIEW) {
72 new_container(child, parent->workspace_layout);
73 }
69} 74}
70 75
71void insert_child(swayc_t *parent, swayc_t *child, int index) { 76void insert_child(swayc_t *parent, swayc_t *child, int index) {
@@ -80,6 +85,11 @@ void insert_child(swayc_t *parent, swayc_t *child, int index) {
80 if (!parent->focused) { 85 if (!parent->focused) {
81 parent->focused = child; 86 parent->focused = child;
82 } 87 }
88
89 // wrap view into a container
90 if (parent->type == C_WORKSPACE && child->type == C_VIEW) {
91 new_container(child, parent->workspace_layout);
92 }
83} 93}
84 94
85void add_floating(swayc_t *ws, swayc_t *child) { 95void add_floating(swayc_t *ws, swayc_t *child) {