mirror of
https://github.com/swaywm/sway.git
synced 2026-04-18 06:46:56 -04:00
Merge 79007ce07f into 131045ce55
This commit is contained in:
commit
f434a3fa8f
5 changed files with 44 additions and 5 deletions
|
|
@ -157,4 +157,6 @@ size_t workspace_num_sticky_containers(struct sway_workspace *ws);
|
||||||
*/
|
*/
|
||||||
void workspace_squash(struct sway_workspace *workspace);
|
void workspace_squash(struct sway_workspace *workspace);
|
||||||
|
|
||||||
|
void workspace_reorient_auto(struct sway_workspace *ws);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -641,6 +641,7 @@ static void workspace_move_to_output(struct sway_workspace *workspace,
|
||||||
}
|
}
|
||||||
|
|
||||||
output_add_workspace(output, workspace);
|
output_add_workspace(output, workspace);
|
||||||
|
workspace_reorient_auto(workspace);
|
||||||
|
|
||||||
// If moving the last workspace from the old output, create a new workspace
|
// If moving the last workspace from the old output, create a new workspace
|
||||||
// on the old output
|
// on the old output
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include "sway/server.h"
|
#include "sway/server.h"
|
||||||
#include "sway/tree/arrange.h"
|
#include "sway/tree/arrange.h"
|
||||||
#include "sway/tree/root.h"
|
#include "sway/tree/root.h"
|
||||||
|
#include "sway/tree/workspace.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
@ -1088,6 +1089,10 @@ static bool apply_resolved_output_configs(struct matched_output_config *configs,
|
||||||
struct matched_output_config *cfg = &configs[idx];
|
struct matched_output_config *cfg = &configs[idx];
|
||||||
output_update_position(cfg->output);
|
output_update_position(cfg->output);
|
||||||
arrange_layers(cfg->output);
|
arrange_layers(cfg->output);
|
||||||
|
for (int i = 0; i < cfg->output->workspaces->length; i++) {
|
||||||
|
struct sway_workspace *ws = cfg->output->workspaces->items[i];
|
||||||
|
workspace_reorient_auto(ws);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arrange_root();
|
arrange_root();
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ static void restore_workspaces(struct sway_output *output) {
|
||||||
if (highest == output) {
|
if (highest == output) {
|
||||||
workspace_detach(ws);
|
workspace_detach(ws);
|
||||||
output_add_workspace(output, ws);
|
output_add_workspace(output, ws);
|
||||||
|
workspace_reorient_auto(ws);
|
||||||
ipc_event_workspace(NULL, ws, "move");
|
ipc_event_workspace(NULL, ws, "move");
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
|
|
@ -59,6 +60,7 @@ static void restore_workspaces(struct sway_output *output) {
|
||||||
struct sway_workspace *ws = root->fallback_output->workspaces->items[0];
|
struct sway_workspace *ws = root->fallback_output->workspaces->items[0];
|
||||||
workspace_detach(ws);
|
workspace_detach(ws);
|
||||||
output_add_workspace(output, ws);
|
output_add_workspace(output, ws);
|
||||||
|
workspace_reorient_auto(ws);
|
||||||
|
|
||||||
// If the floater was made floating while on the NOOP output, its width
|
// If the floater was made floating while on the NOOP output, its width
|
||||||
// and height will be zero and it should be reinitialized as a floating
|
// and height will be zero and it should be reinitialized as a floating
|
||||||
|
|
@ -172,11 +174,8 @@ void output_enable(struct sway_output *output) {
|
||||||
ipc_event_workspace(NULL, ws, "init");
|
ipc_event_workspace(NULL, ws, "init");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ws && config->default_orientation == L_NONE) {
|
if (ws) {
|
||||||
// Since the output transformation and resolution could have changed
|
workspace_reorient_auto(ws);
|
||||||
// due to applying the output config, the previously set layout for the
|
|
||||||
// created workspace may not be correct for `default_orientation auto`
|
|
||||||
ws->layout = output_get_default_layout(output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit_mutable(&root->events.new_node, &output->node);
|
wl_signal_emit_mutable(&root->events.new_node, &output->node);
|
||||||
|
|
@ -241,6 +240,7 @@ static void output_evacuate(struct sway_output *output) {
|
||||||
|
|
||||||
workspace_output_add_priority(workspace, new_output);
|
workspace_output_add_priority(workspace, new_output);
|
||||||
output_add_workspace(new_output, workspace);
|
output_add_workspace(new_output, workspace);
|
||||||
|
workspace_reorient_auto(workspace);
|
||||||
output_sort_workspaces(new_output);
|
output_sort_workspaces(new_output);
|
||||||
ipc_event_workspace(NULL, workspace, "move");
|
ipc_event_workspace(NULL, workspace, "move");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -985,3 +985,34 @@ void workspace_squash(struct sway_workspace *workspace) {
|
||||||
i += container_squash(child);
|
i += container_squash(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void workspace_reorient_auto(struct sway_workspace *ws) {
|
||||||
|
if (config->default_orientation != L_NONE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!ws->output) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ws->tiling->length > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ws->layout == L_TABBED || ws->layout == L_STACKED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum sway_container_layout new_layout = output_get_default_layout(ws->output);
|
||||||
|
if (ws->layout == new_layout) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ws->layout = new_layout;
|
||||||
|
workspace_update_representation(ws);
|
||||||
|
|
||||||
|
if (ws->tiling->length == 1) {
|
||||||
|
struct sway_container *child = ws->tiling->items[0];
|
||||||
|
if (!child->view &&
|
||||||
|
(child->pending.layout == L_HORIZ || child->pending.layout == L_VERT)) {
|
||||||
|
child->pending.layout = new_layout;
|
||||||
|
container_update_representation(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue