diff options
author | 2016-04-03 13:48:39 +0200 | |
---|---|---|
committer | 2016-04-25 00:00:49 +0200 | |
commit | 969f76a1a44b5da92a03d9ac3c865109b0ef9f39 (patch) | |
tree | 80a3e4041e70c23ce47f302c4093d18e2ea60bda /sway | |
parent | Reapply prev layout when exiting tabbed/stacked (diff) | |
download | sway-969f76a1a44b5da92a03d9ac3c865109b0ef9f39.tar.gz sway-969f76a1a44b5da92a03d9ac3c865109b0ef9f39.tar.zst sway-969f76a1a44b5da92a03d9ac3c865109b0ef9f39.zip |
Make floating border fixes work with tabbed/stacked code
Diffstat (limited to 'sway')
-rw-r--r-- | sway/border.c | 26 | ||||
-rw-r--r-- | sway/layout.c | 12 |
2 files changed, 12 insertions, 26 deletions
diff --git a/sway/border.c b/sway/border.c index 061c1427..80e51580 100644 --- a/sway/border.c +++ b/sway/border.c | |||
@@ -141,34 +141,22 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col | |||
141 | static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *colors) { | 141 | static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *colors) { |
142 | struct wlc_geometry *tb = &view->title_bar_geometry; | 142 | struct wlc_geometry *tb = &view->title_bar_geometry; |
143 | struct wlc_geometry *b = &view->border_geometry; | 143 | struct wlc_geometry *b = &view->border_geometry; |
144 | int title_y = MIN(view->actual_geometry.origin.y - (int)tb->size.h, 0); | 144 | int x = MIN(tb->origin.x, tb->origin.x - b->origin.x); |
145 | int y = MIN(tb->origin.y, tb->origin.y - b->origin.y); | ||
145 | 146 | ||
146 | // borders | ||
147 | /* render_borders(view, cr, colors); */ | ||
148 | |||
149 | int x = tb->origin.x - b->origin.x; | ||
150 | int y = tb->origin.y - b->origin.y; | ||
151 | |||
152 | /* // title bar background */ | ||
153 | /* cairo_set_source_u32(cr, colors->child_border); */ | ||
154 | /* cairo_rectangle(cr, x, y, tb->size.w, tb->size.h); */ | ||
155 | /* cairo_fill(cr); */ | ||
156 | // title bar background | 147 | // title bar background |
157 | cairo_set_source_u32(cr, colors->background); | 148 | cairo_set_source_u32(cr, colors->background); |
158 | cairo_rectangle(cr, 0, title_y, tb->size.w, tb->size.h); | 149 | cairo_rectangle(cr, x, y, tb->size.w, tb->size.h); |
159 | cairo_fill(cr); | 150 | cairo_fill(cr); |
160 | 151 | ||
161 | // header top line | 152 | // header top line |
162 | /* render_sharp_line(cr, colors->border, x, y, tb->size.w, 1); */ | 153 | render_sharp_line(cr, colors->border, x, y, tb->size.w, 1); |
163 | render_sharp_line(cr, colors->border, 0, title_y, tb->size.w, 1); | ||
164 | 154 | ||
165 | // text | 155 | // text |
166 | if (view->name) { | 156 | if (view->name) { |
167 | int width, height; | 157 | int width, height; |
168 | get_text_size(cr, config->font, &width, &height, false, "%s", view->name); | 158 | get_text_size(cr, config->font, &width, &height, false, "%s", view->name); |
169 | int x_text = MIN(view->actual_geometry.origin.x, view->border_thickness); | 159 | cairo_move_to(cr, x + 2, y + 2); |
170 | int y_text = MIN(view->actual_geometry.origin.y - height - 2, 2); | ||
171 | cairo_move_to(cr, x_text, y_text); | ||
172 | cairo_set_source_u32(cr, colors->text); | 160 | cairo_set_source_u32(cr, colors->text); |
173 | pango_printf(cr, config->font, false, "%s", view->name); | 161 | pango_printf(cr, config->font, false, "%s", view->name); |
174 | } | 162 | } |
@@ -192,13 +180,13 @@ static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *c | |||
192 | if ((uint32_t)(view->actual_geometry.origin.y - tb->origin.y) == tb->size.h) { | 180 | if ((uint32_t)(view->actual_geometry.origin.y - tb->origin.y) == tb->size.h) { |
193 | // header bottom line | 181 | // header bottom line |
194 | render_sharp_line(cr, colors->border, | 182 | render_sharp_line(cr, colors->border, |
195 | x + view->actual_geometry.origin.x - b->origin.x, | 183 | x + view->actual_geometry.origin.x - tb->origin.x, |
196 | y + tb->size.h - 1, | 184 | y + tb->size.h - 1, |
197 | view->actual_geometry.size.w, 1); | 185 | view->actual_geometry.size.w, 1); |
198 | } else { | 186 | } else { |
199 | // header bottom line | 187 | // header bottom line |
200 | render_sharp_line(cr, colors->border, x, | 188 | render_sharp_line(cr, colors->border, x, |
201 | title_y + tb->size.h - 1, | 189 | y + tb->size.h - 1, |
202 | tb->size.w, 1); | 190 | tb->size.w, 1); |
203 | } | 191 | } |
204 | } | 192 | } |
diff --git a/sway/layout.c b/sway/layout.c index e9eb8add..65ca2402 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -384,16 +384,14 @@ static void adjust_border_geometry(swayc_t *c, struct wlc_geometry *g, | |||
384 | g->size.w += left + right; | 384 | g->size.w += left + right; |
385 | if (g->origin.x - left < 0) { | 385 | if (g->origin.x - left < 0) { |
386 | g->size.w += g->origin.x - left; | 386 | g->size.w += g->origin.x - left; |
387 | } | 387 | } else if (g->origin.x + g->size.w - right > res->w) { |
388 | else if (g->origin.x + g->size.w - right > res->w) { | ||
389 | g->size.w = res->w - g->origin.x + right; | 388 | g->size.w = res->w - g->origin.x + right; |
390 | } | 389 | } |
391 | 390 | ||
392 | g->size.h += top + bottom; | 391 | g->size.h += top + bottom; |
393 | if (g->origin.y - top < 0) { | 392 | if (g->origin.y - top < 0) { |
394 | g->size.h += g->origin.y - top; | 393 | g->size.h += g->origin.y - top; |
395 | } | 394 | } else if (g->origin.y + g->size.h - top > res->h) { |
396 | else if (g->origin.y + g->size.h - top > res->h) { | ||
397 | g->size.h = res->h - g->origin.y + top; | 395 | g->size.h = res->h - g->origin.y + top; |
398 | } | 396 | } |
399 | 397 | ||
@@ -425,11 +423,11 @@ static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geo | |||
425 | 423 | ||
426 | struct wlc_geometry title_bar = { | 424 | struct wlc_geometry title_bar = { |
427 | .origin = { | 425 | .origin = { |
428 | .x = g.origin.x, | 426 | .x = c->actual_geometry.origin.x - c->border_thickness, |
429 | .y = g.origin.y | 427 | .y = c->actual_geometry.origin.y - title_bar_height |
430 | }, | 428 | }, |
431 | .size = { | 429 | .size = { |
432 | .w = g.size.w, | 430 | .w = c->actual_geometry.size.w + (2 * c->border_thickness), |
433 | .h = title_bar_height | 431 | .h = title_bar_height |
434 | } | 432 | } |
435 | }; | 433 | }; |