mirror of
https://github.com/swaywm/sway.git
synced 2026-04-16 08:21:30 -04:00
Merge 0c45122862 into 81246fc6dc
This commit is contained in:
commit
2bd2bfdd73
5 changed files with 18 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include "list.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ struct sway_output {
|
|||
struct wlr_scene_rect *fullscreen_background;
|
||||
|
||||
struct wlr_output *wlr_output;
|
||||
char *previous_output_name;
|
||||
|
||||
struct wlr_scene_output *scene_output;
|
||||
struct sway_server *server;
|
||||
struct wl_list link;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ struct sway_workspace {
|
|||
struct side_gaps gaps_outer;
|
||||
|
||||
struct sway_output *output; // NULL if no outputs are connected
|
||||
char *previous_output_name; // NULL if no previous output
|
||||
list_t *floating; // struct sway_container
|
||||
list_t *tiling; // struct sway_container
|
||||
list_t *output_priority;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ enum wlr_direction opposite_direction(enum wlr_direction d) {
|
|||
}
|
||||
|
||||
static void restore_workspaces(struct sway_output *output) {
|
||||
sway_log(SWAY_DEBUG, "Restore Workspaces: restoring workspaces for output %s", output->wlr_output->name);
|
||||
// Workspace output priority
|
||||
for (int i = 0; i < root->outputs->length; i++) {
|
||||
struct sway_output *other = root->outputs->items[i];
|
||||
|
|
@ -38,9 +39,13 @@ static void restore_workspaces(struct sway_output *output) {
|
|||
|
||||
for (int j = 0; j < other->workspaces->length; j++) {
|
||||
struct sway_workspace *ws = other->workspaces->items[j];
|
||||
|
||||
struct sway_output *highest =
|
||||
workspace_output_get_highest_available(ws);
|
||||
if (highest == output) {
|
||||
if (highest == output ||
|
||||
(ws->previous_output_name != NULL &&
|
||||
!strcmp(ws->previous_output_name, output->wlr_output->name)))
|
||||
{
|
||||
workspace_detach(ws);
|
||||
output_add_workspace(output, ws);
|
||||
ipc_event_workspace(NULL, ws, "move");
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ struct sway_workspace *workspace_create(struct sway_output *output,
|
|||
}
|
||||
|
||||
ws->name = strdup(name);
|
||||
ws->previous_output_name = NULL;
|
||||
ws->prev_split_layout = L_NONE;
|
||||
ws->layout = output_get_default_layout(output);
|
||||
ws->floating = create_list();
|
||||
|
|
@ -287,6 +288,7 @@ void workspace_destroy(struct sway_workspace *workspace) {
|
|||
wlr_scene_node_destroy(&workspace->layers.fullscreen->node);
|
||||
|
||||
free(workspace->name);
|
||||
free(workspace->previous_output_name);
|
||||
free(workspace->representation);
|
||||
list_free_items_and_destroy(workspace->output_priority);
|
||||
list_free(workspace->floating);
|
||||
|
|
@ -434,8 +436,6 @@ static void workspace_name_from_binding(const struct sway_binding * binding,
|
|||
}
|
||||
|
||||
char *workspace_next_name(const char *output_name) {
|
||||
sway_log(SWAY_DEBUG, "Workspace: Generating new workspace name for output %s",
|
||||
output_name);
|
||||
// Scan for available workspace names by looking through output-workspace
|
||||
// assignments primarily, falling back to bindings and numbers.
|
||||
struct sway_mode *mode = config->current_mode;
|
||||
|
|
@ -930,6 +930,12 @@ void workspace_detach(struct sway_workspace *workspace) {
|
|||
if (index != -1) {
|
||||
list_del(output->workspaces, index);
|
||||
}
|
||||
if (workspace->previous_output_name) {
|
||||
free(workspace->previous_output_name);
|
||||
workspace->previous_output_name = NULL;
|
||||
}
|
||||
|
||||
workspace->previous_output_name = strdup(output->wlr_output->name);
|
||||
workspace->output = NULL;
|
||||
|
||||
node_set_dirty(&workspace->node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue