Fix problems with floating windows
Makes any tabbed/stacked layout a container to separate from floating windows which may be attached to a workspace.
This commit is contained in:
parent
ec7ff769c7
commit
8d700fe008
|
@ -240,6 +240,12 @@ bool swayc_is_parent_of(swayc_t *parent, swayc_t *child);
|
||||||
* Returns true if the child is a desecendant of the parent.
|
* Returns true if the child is a desecendant of the parent.
|
||||||
*/
|
*/
|
||||||
bool swayc_is_child_of(swayc_t *child, swayc_t *parent);
|
bool swayc_is_child_of(swayc_t *child, swayc_t *parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if view is stacked or tabbed.
|
||||||
|
*/
|
||||||
|
bool swayc_is_tabbed_stacked(swayc_t *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the gap (padding) of the container.
|
* Returns the gap (padding) of the container.
|
||||||
*
|
*
|
||||||
|
|
|
@ -237,7 +237,7 @@ void update_view_border(swayc_t *view) {
|
||||||
|
|
||||||
swayc_t *p = view->parent;
|
swayc_t *p = view->parent;
|
||||||
|
|
||||||
if (p->layout == L_TABBED || p->layout == L_STACKED) {
|
if (swayc_is_tabbed_stacked(view)) {
|
||||||
cr = create_border_buffer(view, view->border_geometry, &surface);
|
cr = create_border_buffer(view, view->border_geometry, &surface);
|
||||||
if (focused == view) {
|
if (focused == view) {
|
||||||
render_borders(view, cr, &config->border_colors.focused, false);
|
render_borders(view, cr, &config->border_colors.focused, false);
|
||||||
|
|
|
@ -1764,8 +1764,16 @@ static struct cmd_results *cmd_layout(int argc, char **argv) {
|
||||||
// cmd_workspace_layout
|
// cmd_workspace_layout
|
||||||
parent->layout = L_HORIZ;
|
parent->layout = L_HORIZ;
|
||||||
} else if (strcasecmp(argv[0], "tabbed") == 0) {
|
} else if (strcasecmp(argv[0], "tabbed") == 0) {
|
||||||
|
if (parent->type != C_CONTAINER) {
|
||||||
|
parent = new_container(parent, L_TABBED);
|
||||||
|
}
|
||||||
|
|
||||||
parent->layout = L_TABBED;
|
parent->layout = L_TABBED;
|
||||||
} else if (strcasecmp(argv[0], "stacking") == 0) {
|
} else if (strcasecmp(argv[0], "stacking") == 0) {
|
||||||
|
if (parent->type != C_CONTAINER) {
|
||||||
|
parent = new_container(parent, L_STACKED);
|
||||||
|
}
|
||||||
|
|
||||||
parent->layout = L_STACKED;
|
parent->layout = L_STACKED;
|
||||||
} else if (strcasecmp(argv[0], "splith") == 0) {
|
} else if (strcasecmp(argv[0], "splith") == 0) {
|
||||||
parent->layout = L_HORIZ;
|
parent->layout = L_HORIZ;
|
||||||
|
|
|
@ -237,7 +237,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
|
||||||
add_child(workspace, cont);
|
add_child(workspace, cont);
|
||||||
// give them proper layouts
|
// give them proper layouts
|
||||||
cont->layout = workspace->layout;
|
cont->layout = workspace->layout;
|
||||||
workspace->layout = layout;
|
/* TODO: might break shit in move_container!!! workspace->layout = layout; */
|
||||||
set_focused_container_for(workspace, get_focused_view(workspace));
|
set_focused_container_for(workspace, get_focused_view(workspace));
|
||||||
} else { // Or is built around container
|
} else { // Or is built around container
|
||||||
swayc_t *parent = replace_child(child, cont);
|
swayc_t *parent = replace_child(child, cont);
|
||||||
|
@ -722,9 +722,7 @@ void update_visibility_output(swayc_t *container, wlc_handle output) {
|
||||||
swayc_t *parent = container->parent;
|
swayc_t *parent = container->parent;
|
||||||
container->visible = parent->visible;
|
container->visible = parent->visible;
|
||||||
// special cases where visibility depends on focus
|
// special cases where visibility depends on focus
|
||||||
if (parent->type == C_OUTPUT
|
if (parent->type == C_OUTPUT || swayc_is_tabbed_stacked(container)) {
|
||||||
|| parent->layout == L_TABBED
|
|
||||||
|| parent->layout == L_STACKED) {
|
|
||||||
container->visible = parent->focused == container && parent->visible;
|
container->visible = parent->focused == container && parent->visible;
|
||||||
}
|
}
|
||||||
// Set visibility and output for view
|
// Set visibility and output for view
|
||||||
|
@ -814,3 +812,8 @@ static void close_view(swayc_t *container, void *data) {
|
||||||
void close_views(swayc_t *container) {
|
void close_views(swayc_t *container) {
|
||||||
container_map(container, close_view, NULL);
|
container_map(container, close_view, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool swayc_is_tabbed_stacked(swayc_t *view) {
|
||||||
|
return (view->parent->layout == L_TABBED
|
||||||
|
|| view->parent->layout == L_STACKED);
|
||||||
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ bool set_focused_container(swayc_t *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// rearrange if parent container is tabbed/stacked
|
// rearrange if parent container is tabbed/stacked
|
||||||
if (p->parent->layout == L_TABBED || p->parent->layout == L_STACKED) {
|
if (swayc_is_tabbed_stacked(p)) {
|
||||||
arrange_windows(p->parent, -1, -1);
|
arrange_windows(p->parent, -1, -1);
|
||||||
}
|
}
|
||||||
} else if (p->type == C_WORKSPACE) {
|
} else if (p->type == C_WORKSPACE) {
|
||||||
|
|
|
@ -458,7 +458,7 @@ void update_geometry(swayc_t *container) {
|
||||||
|
|
||||||
// use parent size if window is in a stacked/tabbed layout
|
// use parent size if window is in a stacked/tabbed layout
|
||||||
swayc_t *parent = container->parent;
|
swayc_t *parent = container->parent;
|
||||||
if (parent->layout == L_STACKED || parent->layout == L_TABBED) {
|
if (swayc_is_tabbed_stacked(container)) {
|
||||||
width = parent->width;
|
width = parent->width;
|
||||||
height = parent->height;
|
height = parent->height;
|
||||||
}
|
}
|
||||||
|
@ -833,6 +833,8 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
|
||||||
swayc_t *view = container->floating->items[i];
|
swayc_t *view = container->floating->items[i];
|
||||||
if (view->type == C_VIEW) {
|
if (view->type == C_VIEW) {
|
||||||
update_geometry(view);
|
update_geometry(view);
|
||||||
|
sway_log(L_DEBUG, "Set floating view to %.f x %.f @ %.f, %.f", view->width,
|
||||||
|
view->height, view->x, view->y);
|
||||||
if (swayc_is_fullscreen(view)) {
|
if (swayc_is_fullscreen(view)) {
|
||||||
wlc_view_bring_to_front(view->handle);
|
wlc_view_bring_to_front(view->handle);
|
||||||
} else if (!container->focused
|
} else if (!container->focused
|
||||||
|
|
Loading…
Reference in a new issue