From 20c592ad10801e4af970cfae910d32cb157e0728 Mon Sep 17 00:00:00 2001 From: bun137 Date: Sun, 17 Nov 2024 19:24:18 +0530 Subject: [PATCH] feat: adds hexcode below the cursor --- src/hyprpicker.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/hyprpicker.cpp b/src/hyprpicker.cpp index 9b82b04..a485ac4 100644 --- a/src/hyprpicker.cpp +++ b/src/hyprpicker.cpp @@ -425,26 +425,18 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) { cairo_clip(PCAIRO); cairo_paint(PCAIRO); - const auto THECOLOR = getColorFromPixel(pSurface, CLICKPOS); - printf("thecolor has been gotten and it is %d %d %d\n", THECOLOR.r, THECOLOR.g, THECOLOR.b); - - char hexBuffer[8]; - sprintf(hexBuffer, "#%02x%02x%02x", THECOLOR.r, THECOLOR.g, THECOLOR.b); + const auto currentColor = getColorFromPixel(pSurface, CLICKPOS); + char hexBuffer[8]; + sprintf(hexBuffer, "#%02x%02x%02x", currentColor.r, currentColor.g, currentColor.b); cairo_set_source_rgba(PCAIRO, 1.0, 1.0, 1.0, 1.0); - printf("hallo\n"); cairo_select_font_face(PCAIRO, "monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(PCAIRO, 18); cairo_move_to(PCAIRO, CLICKPOS.x, CLICKPOS.y + 40); - printf("pos is %f %f\n", CLICKPOS.x, CLICKPOS.y); - printf("Rendering hex code at position: (%f, %f)\n", CLICKPOS.x, CLICKPOS.y + 40); - - printf("hexbuffer contains %s\n", hexBuffer); cairo_show_text(PCAIRO, hexBuffer); + cairo_surface_flush(PBUFFER->surface); - cairo_restore(PCAIRO); - cairo_pattern_destroy(PATTERN); } } else if (!m_bRenderInactive) {