aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2023-12-11 17:22:25 +0100
committerFederico Angelilli <code@fedang.net>2023-12-11 17:22:25 +0100
commitc13a74d93c62e8e867afcbed487bcbc7955b29e7 (patch)
tree9e18aa3f7d397612f1a7dbd4efcc0d2c9bda5086 /src
parentffdfcf5d8ad1265e6beeea5780bda895221cd506 (diff)
Fix drawing
Diffstat (limited to 'src')
-rw-r--r--src/comet.c5
-rw-r--r--src/draw.c17
2 files changed, 5 insertions, 17 deletions
diff --git a/src/comet.c b/src/comet.c
index ec7295b..b6b36c5 100644
--- a/src/comet.c
+++ b/src/comet.c
@@ -205,8 +205,7 @@ static void menu_action(Button *btn)
State *state;
} *menu_ctx = sbtn->action_data;
- // Otherwise the menu can't be closed
- g_assert(menu_ctx->group->children->data == btn);
+ // NOTE: To close the menu the toggle button must be inside
GList *temp = menu_ctx->group->children;
menu_ctx->group->children = menu_ctx->toggled;
@@ -329,7 +328,7 @@ int main(int argc, char **argv)
// Menu button(s)
Color grey = { 0.5, 0.5, 0.5, 1 };
- Button *group = button_group_create(PANGO_ALIGN_CENTER, grey, line_color);
+ Button *group = button_group_create(PANGO_ALIGN_LEFT, grey, line_color);
Button *child1 = button_simple_create(PANGO_ALIGN_CENTER, color, line_color);
button_set_padding(child1, 1);
diff --git a/src/draw.c b/src/draw.c
index 30f59a1..af5c493 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -66,19 +66,8 @@ void draw_paint(Drawable *draw, Window *win)
double degree = M_PI / 180.0;
+ // Fill the background
cairo_set_source_rgba(cr, draw->background.r, draw->background.g, draw->background.b, draw->background.a);
-
- // TODO: Here we should paint the shape of the bar, however there is a problem with the surface
- // painted in the pixmap to mask the window shape in window_paint_corners.
- //
- // This is caused by some difference between the two shapes (that should technically be the same)
- // which causes a mismatch between the two layers and leaves some black pixels visible
-
- //int radius = height / 2;
- //cairo_arc(cr, radius, radius, radius, 90.0 * degree, 270 * degree);
- //cairo_arc(cr, width - radius, radius, radius, 270 * degree, 450 * degree);
- //cairo_fill(cr);
-
cairo_paint(cr);
int line_w = draw->line_w * scale;
@@ -276,7 +265,7 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns)
};
if (layout_end[PANGO_ALIGN_RIGHT] > width) {
- log_error("LENGHT %d on %d", layout_end[PANGO_ALIGN_RIGHT], width);
+ log_error("Layout is bigger than the window (%d vs %d)", layout_end[PANGO_ALIGN_RIGHT], width);
}
int center = round(width / 2);
@@ -288,7 +277,7 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns)
layout->x += center_off;
}
- int right = width - layout_width[PANGO_ALIGN_LEFT];
+ int right = width - layout_width[PANGO_ALIGN_RIGHT];
// The width is off by 2 line width
int right_off = right - MAX(layout_end[PANGO_ALIGN_LEFT], layout_end[PANGO_ALIGN_CENTER]) + 2 * line_w;
log_debug("Aligning right layout [x=%d, off=%d]", right, right_off);