From b6537b2969450aa6ce2631ecbf3c340dd2e2c23a Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Wed, 15 Nov 2023 16:31:29 +0100 Subject: Provide temporary fix for x shape mismatch (antialiasing) --- comet.c | 6 ++---- draw.c | 15 ++++++++++++--- x11.c | 5 ++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/comet.c b/comet.c index 40a302d..5cc7734 100644 --- a/comet.c +++ b/comet.c @@ -5,11 +5,9 @@ #include "log.h" #include "draw.h" - GMainLoop *mainloop = NULL; - static gboolean mainloop_quit(gpointer data) { - g_main_loop_quit(mainloop); + g_main_loop_quit(data); return G_SOURCE_CONTINUE; } @@ -23,7 +21,7 @@ int main(int argc, char **argv) { log_init(G_LOG_LEVEL_DEBUG); - mainloop = g_main_loop_new(g_main_context_default(), FALSE); + GMainLoop *mainloop = g_main_loop_new(NULL, FALSE); Window *win = window_create(); diff --git a/draw.c b/draw.c index 0eac18a..07aecb3 100644 --- a/draw.c +++ b/draw.c @@ -26,9 +26,18 @@ void draw(Window *win) double degree = M_PI / 180.0; cairo_set_source_rgb(cr, 0.3, 0.3, 0.3); - 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); + + // 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 + + //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); cairo_set_line_width(cr, 1 * scale); diff --git a/x11.c b/x11.c index 9a13bd9..ac1d858 100644 --- a/x11.c +++ b/x11.c @@ -20,8 +20,8 @@ #include "draw.h" struct Window { - xcb_screen_t *screen; xcb_connection_t *connection; + xcb_screen_t *screen; xcb_xrm_database_t *database; xcb_errors_context_t *errors; xcb_drawable_t window; @@ -495,6 +495,9 @@ static void window_paint_corners(Window *win) cairo_t *cr = cairo_create(surface); + // TODO: Fix antialiasing situation + //cairo_set_antialias(cr, CAIRO_ANTIALIAS_GOOD); + cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); -- cgit v1.2.3