Make floating border fixes work with tabbed/stacked code

master
Mikkel Oscar Lyderik 9 years ago
parent e226b20bd8
commit 969f76a1a4

@ -141,34 +141,22 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col
static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *colors) { static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *colors) {
struct wlc_geometry *tb = &view->title_bar_geometry; struct wlc_geometry *tb = &view->title_bar_geometry;
struct wlc_geometry *b = &view->border_geometry; struct wlc_geometry *b = &view->border_geometry;
int title_y = MIN(view->actual_geometry.origin.y - (int)tb->size.h, 0); int x = MIN(tb->origin.x, tb->origin.x - b->origin.x);
int y = MIN(tb->origin.y, tb->origin.y - b->origin.y);
// borders
/* render_borders(view, cr, colors); */
int x = tb->origin.x - b->origin.x;
int y = tb->origin.y - b->origin.y;
/* // title bar background */
/* cairo_set_source_u32(cr, colors->child_border); */
/* cairo_rectangle(cr, x, y, tb->size.w, tb->size.h); */
/* cairo_fill(cr); */
// title bar background // title bar background
cairo_set_source_u32(cr, colors->background); cairo_set_source_u32(cr, colors->background);
cairo_rectangle(cr, 0, title_y, tb->size.w, tb->size.h); cairo_rectangle(cr, x, y, tb->size.w, tb->size.h);
cairo_fill(cr); cairo_fill(cr);
// header top line // header top line
/* render_sharp_line(cr, colors->border, x, y, tb->size.w, 1); */ render_sharp_line(cr, colors->border, x, y, tb->size.w, 1);
render_sharp_line(cr, colors->border, 0, title_y, tb->size.w, 1);
// text // text
if (view->name) { if (view->name) {
int width, height; int width, height;
get_text_size(cr, config->font, &width, &height, false, "%s", view->name); get_text_size(cr, config->font, &width, &height, false, "%s", view->name);
int x_text = MIN(view->actual_geometry.origin.x, view->border_thickness); cairo_move_to(cr, x + 2, y + 2);
int y_text = MIN(view->actual_geometry.origin.y - height - 2, 2);
cairo_move_to(cr, x_text, y_text);
cairo_set_source_u32(cr, colors->text); cairo_set_source_u32(cr, colors->text);
pango_printf(cr, config->font, false, "%s", view->name); pango_printf(cr, config->font, false, "%s", view->name);
} }
@ -192,13 +180,13 @@ static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *c
if ((uint32_t)(view->actual_geometry.origin.y - tb->origin.y) == tb->size.h) { if ((uint32_t)(view->actual_geometry.origin.y - tb->origin.y) == tb->size.h) {
// header bottom line // header bottom line
render_sharp_line(cr, colors->border, render_sharp_line(cr, colors->border,
x + view->actual_geometry.origin.x - b->origin.x, x + view->actual_geometry.origin.x - tb->origin.x,
y + tb->size.h - 1, y + tb->size.h - 1,
view->actual_geometry.size.w, 1); view->actual_geometry.size.w, 1);
} else { } else {
// header bottom line // header bottom line
render_sharp_line(cr, colors->border, x, render_sharp_line(cr, colors->border, x,
title_y + tb->size.h - 1, y + tb->size.h - 1,
tb->size.w, 1); tb->size.w, 1);
} }
} }

@ -384,16 +384,14 @@ static void adjust_border_geometry(swayc_t *c, struct wlc_geometry *g,
g->size.w += left + right; g->size.w += left + right;
if (g->origin.x - left < 0) { if (g->origin.x - left < 0) {
g->size.w += g->origin.x - left; g->size.w += g->origin.x - left;
} } else if (g->origin.x + g->size.w - right > res->w) {
else if (g->origin.x + g->size.w - right > res->w) {
g->size.w = res->w - g->origin.x + right; g->size.w = res->w - g->origin.x + right;
} }
g->size.h += top + bottom; g->size.h += top + bottom;
if (g->origin.y - top < 0) { if (g->origin.y - top < 0) {
g->size.h += g->origin.y - top; g->size.h += g->origin.y - top;
} } else if (g->origin.y + g->size.h - top > res->h) {
else if (g->origin.y + g->size.h - top > res->h) {
g->size.h = res->h - g->origin.y + top; g->size.h = res->h - g->origin.y + top;
} }
@ -425,11 +423,11 @@ static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geo
struct wlc_geometry title_bar = { struct wlc_geometry title_bar = {
.origin = { .origin = {
.x = g.origin.x, .x = c->actual_geometry.origin.x - c->border_thickness,
.y = g.origin.y .y = c->actual_geometry.origin.y - title_bar_height
}, },
.size = { .size = {
.w = g.size.w, .w = c->actual_geometry.size.w + (2 * c->border_thickness),
.h = title_bar_height .h = title_bar_height
} }
}; };

Loading…
Cancel
Save