summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/log.h2
-rw-r--r--sway/commands/focus.c3
-rw-r--r--sway/commands/layout.c2
-rw-r--r--sway/commands/move.c3
-rw-r--r--sway/desktop/render.c2
-rw-r--r--sway/input/seat.c7
-rw-r--r--sway/tree/arrange.c11
-rw-r--r--sway/tree/view.c35
8 files changed, 37 insertions, 28 deletions
diff --git a/include/log.h b/include/log.h
index dd526143..6fb2f277 100644
--- a/include/log.h
+++ b/include/log.h
@@ -15,7 +15,7 @@ void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2);
15 15
16bool _sway_assert(bool condition, const char* format, ...) ATTRIB_PRINTF(2, 3); 16bool _sway_assert(bool condition, const char* format, ...) ATTRIB_PRINTF(2, 3);
17#define sway_assert(COND, FMT, ...) \ 17#define sway_assert(COND, FMT, ...) \
18 _sway_assert(COND, "[%s:%d] %s:" FMT, _wlr_strip_path(__FILE__), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__) 18 _sway_assert(COND, "[%s:%d] %s:" FMT, _wlr_strip_path(__FILE__), __LINE__, __func__, ##__VA_ARGS__)
19 19
20void error_handler(int sig); 20void error_handler(int sig);
21 21
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 83b8c64a..58721b7e 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -102,6 +102,9 @@ static struct sway_node *node_get_in_direction(struct sway_container *container,
102 // Fullscreen container with a direction - go straight to outputs 102 // Fullscreen container with a direction - go straight to outputs
103 struct sway_output *output = container->workspace->output; 103 struct sway_output *output = container->workspace->output;
104 struct sway_output *new_output = output_get_in_direction(output, dir); 104 struct sway_output *new_output = output_get_in_direction(output, dir);
105 if (!new_output) {
106 return NULL;
107 }
105 return get_node_in_output_direction(new_output, dir); 108 return get_node_in_output_direction(new_output, dir);
106 } 109 }
107 if (dir == MOVE_PARENT) { 110 if (dir == MOVE_PARENT) {
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index 44ce2970..ef3ec1cb 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -29,7 +29,7 @@ static enum sway_container_layout get_layout_toggle(int argc, char **argv,
29 enum sway_container_layout layout, 29 enum sway_container_layout layout,
30 enum sway_container_layout prev_split_layout) { 30 enum sway_container_layout prev_split_layout) {
31 // "layout toggle" 31 // "layout toggle"
32 if (argc == 0) { 32 if (argc == 1) {
33 return layout == L_HORIZ ? L_VERT : L_HORIZ; 33 return layout == L_HORIZ ? L_VERT : L_HORIZ;
34 } 34 }
35 35
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 7b503624..59f1cf78 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -117,7 +117,8 @@ static void container_move_to_container_from_direction(
117 struct sway_container *container, struct sway_container *destination, 117 struct sway_container *container, struct sway_container *destination,
118 enum movement_direction move_dir) { 118 enum movement_direction move_dir) {
119 if (destination->view) { 119 if (destination->view) {
120 if (destination->parent == container->parent) { 120 if (destination->parent == container->parent &&
121 destination->workspace == container->workspace) {
121 wlr_log(WLR_DEBUG, "Swapping siblings"); 122 wlr_log(WLR_DEBUG, "Swapping siblings");
122 list_t *siblings = container_get_siblings(container); 123 list_t *siblings = container_get_siblings(container);
123 int container_index = list_find(siblings, container); 124 int container_index = list_find(siblings, container);
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 9d80f3c7..bb3902ec 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -266,7 +266,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
266 struct sway_view *view = con->view; 266 struct sway_view *view = con->view;
267 if (view->saved_buffer) { 267 if (view->saved_buffer) {
268 render_saved_view(view, output, damage, view->container->alpha); 268 render_saved_view(view, output, damage, view->container->alpha);
269 } else { 269 } else if (view->surface) {
270 render_view_toplevels(view, output, damage, view->container->alpha); 270 render_view_toplevels(view, output, damage, view->container->alpha);
271 } 271 }
272 272
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 92d9d7ec..b1808793 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -168,11 +168,8 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
168 168
169 // the structure change might have caused it to move up to the top of 169 // the structure change might have caused it to move up to the top of
170 // the focus stack without sending focus notifications to the view 170 // the focus stack without sending focus notifications to the view
171 if (seat_get_focus(seat) == next_focus) { 171 seat_send_focus(next_focus, seat);
172 seat_send_focus(next_focus, seat); 172 seat_set_focus(seat, next_focus);
173 } else {
174 seat_set_focus(seat, next_focus);
175 }
176 } 173 }
177} 174}
178 175
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index edb05f86..d50be25d 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -97,15 +97,14 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
97 if (!children->length) { 97 if (!children->length) {
98 return; 98 return;
99 } 99 }
100 size_t parent_offset = container_titlebar_height();
101 size_t parent_height = parent->height - parent_offset;
102 for (int i = 0; i < children->length; ++i) { 100 for (int i = 0; i < children->length; ++i) {
103 struct sway_container *child = children->items[i]; 101 struct sway_container *child = children->items[i];
102 size_t parent_offset = child->view ? 0 : container_titlebar_height();
104 container_remove_gaps(child); 103 container_remove_gaps(child);
105 child->x = parent->x; 104 child->x = parent->x;
106 child->y = parent->y + parent_offset; 105 child->y = parent->y + parent_offset;
107 child->width = parent->width; 106 child->width = parent->width;
108 child->height = parent_height; 107 child->height = parent->height - parent_offset;
109 container_add_gaps(child); 108 container_add_gaps(child);
110 } 109 }
111} 110}
@@ -114,15 +113,15 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) {
114 if (!children->length) { 113 if (!children->length) {
115 return; 114 return;
116 } 115 }
117 size_t parent_offset = container_titlebar_height() * children->length;
118 size_t parent_height = parent->height - parent_offset;
119 for (int i = 0; i < children->length; ++i) { 116 for (int i = 0; i < children->length; ++i) {
120 struct sway_container *child = children->items[i]; 117 struct sway_container *child = children->items[i];
118 size_t parent_offset = child->view ? 0 :
119 container_titlebar_height() * children->length;
121 container_remove_gaps(child); 120 container_remove_gaps(child);
122 child->x = parent->x; 121 child->x = parent->x;
123 child->y = parent->y + parent_offset; 122 child->y = parent->y + parent_offset;
124 child->width = parent->width; 123 child->width = parent->width;
125 child->height = parent_height; 124 child->height = parent->height - parent_offset;
126 container_add_gaps(child); 125 container_add_gaps(child);
127 } 126 }
128} 127}
diff --git a/sway/tree/view.c b/sway/tree/view.c
index f63a35b5..f9dcb11a 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -219,14 +219,17 @@ void view_autoconfigure(struct sway_view *view) {
219 x = y = width = height = 0; 219 x = y = width = height = 0;
220 double y_offset = 0; 220 double y_offset = 0;
221 221
222 // In a tabbed or stacked container, the swayc's y is the bottom of the 222 // In a tabbed or stacked container, the container's y is the top of the
223 // title area. We have to disable any top border because the title bar is 223 // title area. We have to offset the surface y by the height of the title,
224 // rendered by the parent. 224 // bar, and disable any top border because we'll always have the title bar.
225 enum sway_container_layout layout = container_parent_layout(con); 225 enum sway_container_layout layout = container_parent_layout(con);
226 if (layout == L_TABBED || layout == L_STACKED) { 226 if (layout == L_TABBED) {
227 view->border_top = false;
228 } else {
229 y_offset = container_titlebar_height(); 227 y_offset = container_titlebar_height();
228 view->border_top = false;
229 } else if (layout == L_STACKED) {
230 list_t *siblings = container_get_siblings(con);
231 y_offset = container_titlebar_height() * siblings->length;
232 view->border_top = false;
230 } 233 }
231 234
232 enum sway_container_border border = view->border; 235 enum sway_container_border border = view->border;
@@ -237,17 +240,17 @@ void view_autoconfigure(struct sway_view *view) {
237 switch (border) { 240 switch (border) {
238 case B_NONE: 241 case B_NONE:
239 x = con->x; 242 x = con->x;
240 y = con->y; 243 y = con->y + y_offset;
241 width = con->width; 244 width = con->width;
242 height = con->height; 245 height = con->height - y_offset;
243 break; 246 break;
244 case B_PIXEL: 247 case B_PIXEL:
245 x = con->x + view->border_thickness * view->border_left; 248 x = con->x + view->border_thickness * view->border_left;
246 y = con->y + view->border_thickness * view->border_top; 249 y = con->y + view->border_thickness * view->border_top + y_offset;
247 width = con->width 250 width = con->width
248 - view->border_thickness * view->border_left 251 - view->border_thickness * view->border_left
249 - view->border_thickness * view->border_right; 252 - view->border_thickness * view->border_right;
250 height = con->height 253 height = con->height - y_offset
251 - view->border_thickness * view->border_top 254 - view->border_thickness * view->border_top
252 - view->border_thickness * view->border_bottom; 255 - view->border_thickness * view->border_bottom;
253 break; 256 break;
@@ -257,9 +260,15 @@ void view_autoconfigure(struct sway_view *view) {
257 width = con->width 260 width = con->width
258 - view->border_thickness * view->border_left 261 - view->border_thickness * view->border_left
259 - view->border_thickness * view->border_right; 262 - view->border_thickness * view->border_right;
260 y = con->y + y_offset; 263 if (y_offset) {
261 height = con->height - y_offset 264 y = con->y + y_offset;
262 - view->border_thickness * view->border_bottom; 265 height = con->height - y_offset
266 - view->border_thickness * view->border_bottom;
267 } else {
268 y = con->y + container_titlebar_height();
269 height = con->height - container_titlebar_height()
270 - view->border_thickness * view->border_bottom;
271 }
263 break; 272 break;
264 } 273 }
265 274