mirror of
https://github.com/swaywm/sway.git
synced 2025-11-09 13:29:49 -05:00
Allow containers to float
Things worth noting:
* When a fullscreen view unmaps, the check to unset fullscreen on the
workspace has been moved out of view_unmap and into container_destroy,
because containers can be fullscreen too
* The calls to `container_reap_empty_recursive(workspace)` have been
removed from `container_set_floating`. That function reaps upwards so it
wouldn't do anything. I'm probably the one who originally added it...
* My fix (b14bd1b0b1) for the tabbed child
crash has a side effect where when you close a floating container, focus
is not given to the tiled container again. I've removed my fix and
removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We
should consider calling it from somewhere earlier in the call stack.
This commit is contained in:
parent
a2164c6661
commit
08cfba2192
11 changed files with 126 additions and 86 deletions
|
|
@ -168,55 +168,6 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void view_init_floating(struct sway_view *view) {
|
||||
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
|
||||
int min_width, min_height;
|
||||
int max_width, max_height;
|
||||
|
||||
if (config->floating_minimum_width == -1) { // no minimum
|
||||
min_width = 0;
|
||||
} else if (config->floating_minimum_width == 0) { // automatic
|
||||
min_width = 75;
|
||||
} else {
|
||||
min_width = config->floating_minimum_width;
|
||||
}
|
||||
|
||||
if (config->floating_minimum_height == -1) { // no minimum
|
||||
min_height = 0;
|
||||
} else if (config->floating_minimum_height == 0) { // automatic
|
||||
min_height = 50;
|
||||
} else {
|
||||
min_height = config->floating_minimum_height;
|
||||
}
|
||||
|
||||
if (config->floating_maximum_width == -1) { // no maximum
|
||||
max_width = INT_MAX;
|
||||
} else if (config->floating_maximum_width == 0) { // automatic
|
||||
max_width = ws->width * 0.6666;
|
||||
} else {
|
||||
max_width = config->floating_maximum_width;
|
||||
}
|
||||
|
||||
if (config->floating_maximum_height == -1) { // no maximum
|
||||
max_height = INT_MAX;
|
||||
} else if (config->floating_maximum_height == 0) { // automatic
|
||||
max_height = ws->height * 0.6666;
|
||||
} else {
|
||||
max_height = config->floating_maximum_height;
|
||||
}
|
||||
|
||||
view->width = fmax(min_width, fmin(view->natural_width, max_width));
|
||||
view->height = fmax(min_height, fmin(view->natural_height, max_height));
|
||||
view->x = ws->x + (ws->width - view->width) / 2;
|
||||
view->y = ws->y + (ws->height - view->height) / 2;
|
||||
|
||||
// If the view's border is B_NONE then these properties are ignored.
|
||||
view->border_top = view->border_bottom = true;
|
||||
view->border_left = view->border_right = true;
|
||||
|
||||
container_set_geometry_from_floating_view(view->swayc);
|
||||
}
|
||||
|
||||
void view_autoconfigure(struct sway_view *view) {
|
||||
if (!sway_assert(view->swayc,
|
||||
"Called view_autoconfigure() on a view without a swayc")) {
|
||||
|
|
@ -626,10 +577,8 @@ void view_unmap(struct sway_view *view) {
|
|||
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
|
||||
|
||||
struct sway_container *parent;
|
||||
if (view->swayc->is_fullscreen) {
|
||||
ws->sway_workspace->fullscreen = NULL;
|
||||
if (container_is_fullscreen_or_child(view->swayc)) {
|
||||
parent = container_destroy(view->swayc);
|
||||
|
||||
arrange_windows(ws->parent);
|
||||
} else {
|
||||
parent = container_destroy(view->swayc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue