summaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/output.c13
-rw-r--r--sway/desktop/render.c7
-rw-r--r--sway/desktop/transaction.c4
-rw-r--r--sway/input/seat.c6
-rw-r--r--sway/tree/container.c5
-rw-r--r--sway/tree/view.c22
-rw-r--r--sway/tree/workspace.c10
7 files changed, 49 insertions, 18 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index ed9300bb..4d6c0336 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -39,6 +39,19 @@ struct sway_output *output_by_name(const char *name) {
return NULL;
}
+struct sway_output *output_by_identifier(const char *identifier) {
+ for (int i = 0; i < root->outputs->length; ++i) {
+ struct sway_output *output = root->outputs->items[i];
+ char output_identifier[128];
+ snprintf(output_identifier, sizeof(output_identifier), "%s %s %s", output->wlr_output->make,
+ output->wlr_output->model, output->wlr_output->serial);
+ if (strcasecmp(output_identifier, identifier) == 0) {
+ return output;
+ }
+ }
+ return NULL;
+}
+
/**
* Rotate a child's position relative to a parent. The parent size is (pw, ph),
* the child position is (*sx, *sy) and its size is (sw, sh).
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 1a72f752..c1fa0c8c 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -781,6 +781,13 @@ static void render_containers_stacked(struct sway_output *output,
static void render_containers(struct sway_output *output,
pixman_region32_t *damage, struct parent_data *parent) {
+ if (parent->children->length == 1) {
+ struct sway_container *child = parent->children->items[0];
+ if (child->view) {
+ render_containers_linear(output, damage, parent);
+ return;
+ }
+ }
switch (parent->layout) {
case L_NONE:
case L_HORIZ:
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 955b05d6..c3efb210 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -301,7 +301,9 @@ static void transaction_apply(struct sway_transaction *transaction) {
if (root->outputs->length) {
struct sway_seat *seat;
wl_list_for_each(seat, &server.input->seats, link) {
- cursor_rebase(seat->cursor);
+ if (seat->operation == OP_NONE) {
+ cursor_rebase(seat->cursor);
+ }
}
}
}
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 577619a7..64419afa 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -185,7 +185,11 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
seat_set_focus(seat, next_focus);
} else {
// Setting focus_inactive
+ focus = seat_get_focus_inactive(seat, &root->node);
seat_set_raw_focus(seat, next_focus);
+ if (focus->type == N_CONTAINER) {
+ seat_set_raw_focus(seat, &focus->sway_container->workspace->node);
+ }
seat_set_raw_focus(seat, focus);
}
}
@@ -944,7 +948,7 @@ struct sway_node *seat_get_focus(struct sway_seat *seat) {
if (!seat->has_focus) {
return NULL;
}
- if (wl_list_length(&seat->focus_stack) == 0) {
+ if (wl_list_empty(&seat->focus_stack)) {
return NULL;
}
struct sway_seat_node *current =
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 58d3df34..8ab6ebf8 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -676,11 +676,8 @@ void container_set_floating(struct sway_container *container, bool enable) {
container_detach(container);
struct sway_container *reference =
seat_get_focus_inactive_tiling(seat, workspace);
- if (reference && reference->view) {
- reference = reference->parent;
- }
if (reference) {
- container_add_child(reference, container);
+ container_add_sibling(reference, container, 1);
container->width = reference->width;
container->height = reference->height;
} else {
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 4bc9e0f3..cf67acbb 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -242,23 +242,23 @@ void view_autoconfigure(struct sway_view *view) {
view->border_bottom = bottom_y != ws->y + ws->height;
}
- double x, y, width, height;
- x = y = width = height = 0;
- double y_offset = 0;
-
// In a tabbed or stacked container, the container's y is the top of the
// title area. We have to offset the surface y by the height of the title,
// bar, and disable any top border because we'll always have the title bar.
+ double y_offset = 0;
enum sway_container_layout layout = container_parent_layout(con);
- if (layout == L_TABBED && !container_is_floating(con)) {
- y_offset = container_titlebar_height();
- view->border_top = false;
- } else if (layout == L_STACKED && !container_is_floating(con)) {
- list_t *siblings = container_get_siblings(con);
- y_offset = container_titlebar_height() * siblings->length;
- view->border_top = false;
+ list_t *siblings = container_get_siblings(con);
+ if (siblings->length > 1 && !container_is_floating(con)) {
+ if (layout == L_TABBED) {
+ y_offset = container_titlebar_height();
+ view->border_top = false;
+ } else if (layout == L_STACKED) {
+ y_offset = container_titlebar_height() * siblings->length;
+ view->border_top = false;
+ }
}
+ double x = 0, y = 0, width = 0, height = 0;
switch (view->border) {
case B_CSD:
case B_NONE:
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 27e9ac7a..05cda5c0 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -35,6 +35,10 @@ struct sway_output *workspace_get_initial_output(const char *name) {
struct workspace_config *wsc = workspace_find_config(name);
if (wsc && wsc->output) {
struct sway_output *output = output_by_name(wsc->output);
+ if (!output) {
+ output = output_by_identifier(wsc->output);
+ }
+
if (output) {
return output;
}
@@ -143,7 +147,11 @@ void workspace_consider_destroy(struct sway_workspace *ws) {
static bool workspace_valid_on_output(const char *output_name,
const char *ws_name) {
struct workspace_config *wsc = workspace_find_config(ws_name);
- return !wsc || !wsc->output || strcmp(wsc->output, output_name) == 0;
+ char identifier[128];
+ struct sway_output *output = output_by_name(output_name);
+ output_get_identifier(identifier, sizeof(identifier), output);
+
+ return !wsc || !wsc->output || strcmp(wsc->output, output_name) == 0 || strcasecmp(identifier, output_name) == 0;
}
static void workspace_name_from_binding(const struct sway_binding * binding,