mirror of
https://github.com/swaywm/sway.git
synced 2024-11-05 16:03:11 +00:00
generalize wrapping views under workspaces
This commit is contained in:
parent
571321a1d8
commit
166c2a3687
|
@ -334,7 +334,6 @@ static bool handle_view_created(wlc_handle handle) {
|
|||
wlc_view_get_geometry(handle)->size.h, wlc_view_get_title(handle),
|
||||
wlc_view_get_class(handle), wlc_view_get_app_id(handle));
|
||||
|
||||
bool encapsulate_view = false;
|
||||
// TODO properly figure out how each window should be handled.
|
||||
switch (wlc_view_get_type(handle)) {
|
||||
// regular view created regularly
|
||||
|
@ -342,12 +341,6 @@ static bool handle_view_created(wlc_handle handle) {
|
|||
if (parent) {
|
||||
newview = new_floating_view(handle);
|
||||
} else {
|
||||
if (focused->type == C_WORKSPACE &&
|
||||
/* focused->children->length == 0 && */
|
||||
(focused->workspace_layout == L_TABBED || focused->workspace_layout == L_STACKED)) {
|
||||
// will wrap the view in a container later on
|
||||
encapsulate_view = true;
|
||||
}
|
||||
newview = new_view(focused, handle);
|
||||
wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true);
|
||||
}
|
||||
|
@ -381,10 +374,6 @@ static bool handle_view_created(wlc_handle handle) {
|
|||
suspend_workspace_cleanup = true;
|
||||
|
||||
if (newview) {
|
||||
// first view on tabbed/stacked workspace was created, wrap it in a container
|
||||
if (encapsulate_view && newview->parent) {
|
||||
new_container(newview, newview->parent->workspace_layout);
|
||||
}
|
||||
ipc_event_window(newview, "new");
|
||||
set_focused_container(newview);
|
||||
wlc_view_set_mask(handle, VISIBLE);
|
||||
|
|
|
@ -66,6 +66,11 @@ void add_child(swayc_t *parent, swayc_t *child) {
|
|||
if (!parent->focused) {
|
||||
parent->focused = child;
|
||||
}
|
||||
|
||||
// wrap view into a container
|
||||
if (parent->type == C_WORKSPACE && child->type == C_VIEW) {
|
||||
new_container(child, parent->workspace_layout);
|
||||
}
|
||||
}
|
||||
|
||||
void 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) {
|
|||
if (!parent->focused) {
|
||||
parent->focused = child;
|
||||
}
|
||||
|
||||
// wrap view into a container
|
||||
if (parent->type == C_WORKSPACE && child->type == C_VIEW) {
|
||||
new_container(child, parent->workspace_layout);
|
||||
}
|
||||
}
|
||||
|
||||
void add_floating(swayc_t *ws, swayc_t *child) {
|
||||
|
|
Loading…
Reference in a new issue