From 981bb399c10c8a08b39643674190a4f28d2e8e92 Mon Sep 17 00:00:00 2001 From: Zakk Date: Sun, 7 Apr 2024 20:53:11 -0400 Subject: [PATCH] Fix rendering on displays with scale > 1. Remove debug output. Go back to using commas as parameter seperator because I'm dumb --- README.md | 8 +++----- easymotionDeco.cpp | 7 +++---- main.cpp | 6 +++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8e9f3cd..5ff367f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,8 @@ plugin { textfont=Sans #padding around the text (inside the label box) size in pixels, adjusted for - #monitor scaling. This is the same format as hyprland's gaps_in/gaps_out + #monitor scaling. This is the same format as hyprland's gapsin/gapsout workspace layout rule + #example: textpadding=2 5 5 2 (spaces not commas) textpadding=0 #size of the border around the label box. A border size of zero disables border rendering. @@ -50,10 +51,7 @@ plugin { Every one of these variables is also settable via the dispatcher, so you can create multiple dispatchers that look different based on function. -`bind = SUPER, z, easymotion, bgcolor:rgba(ff0000ff);bordersize:5;action:hyprctl dispatch closewindow address:{}` - -### IMPORTANT -The easymotion arguments are separated by a semicolon, not a comma. (gap/padding format uses commas :/) +`bind = SUPER, z, easymotion, bgcolor:rgba(ff0000ff),bordersize:5,action:hyprctl dispatch closewindow address:{}` # Installing diff --git a/easymotionDeco.cpp b/easymotionDeco.cpp index 2b9ae91..33f0a2d 100644 --- a/easymotionDeco.cpp +++ b/easymotionDeco.cpp @@ -68,13 +68,12 @@ void CHyprEasyLabel::renderMotionString(Vector2D& bufferSize, const float scale) PangoRectangle ink_rect; PangoRectangle logical_rect; pango_layout_get_pixel_extents(layout, &ink_rect, &logical_rect); - Debug::log(LOG, "INK {} {} {} {} LOGICAL {} {} {} {}", ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height, logical_rect.x, logical_rect.y, logical_rect.width, logical_rect.height); layoutWidth = ink_rect.width+m_iPaddingLeft+m_iPaddingRight; layoutHeight = ink_rect.height+m_iPaddingTop+m_iPaddingBottom; - bufferSize.x = layoutWidth*scale; - bufferSize.y = layoutHeight*scale; + bufferSize.x = layoutWidth; + bufferSize.y = layoutHeight; const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y); const auto CAIRO = cairo_create(CAIROSURFACE); @@ -83,7 +82,7 @@ void CHyprEasyLabel::renderMotionString(Vector2D& bufferSize, const float scale) cairo_set_operator(CAIRO, CAIRO_OPERATOR_CLEAR); cairo_paint(CAIRO); cairo_restore(CAIRO); - cairo_move_to(CAIRO, -ink_rect.x+m_iPaddingLeft, -ink_rect.y+m_iPaddingTop); + cairo_move_to(CAIRO, -ink_rect.x+(m_iPaddingLeft), -ink_rect.y+(m_iPaddingTop)); cairo_set_source_rgba(CAIRO, textColor.r, textColor.g, textColor.b, textColor.a); pango_cairo_show_layout(CAIRO, layout); g_object_unref(layout); diff --git a/main.cpp b/main.cpp index f921649..2b82d96 100644 --- a/main.cpp +++ b/main.cpp @@ -111,7 +111,7 @@ void easymotionDispatch(std::string args) static auto *const ROUNDING = (Hyprlang::INT* const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:rounding")->getDataStaticPtr(); static auto *const MOTIONKEYS = (Hyprlang::STRING const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:motionkeys")->getDataStaticPtr(); - CVarList emargs(args, 0, ';'); + CVarList emargs(args, 0, ','); SMotionActionDesc actionDesc; actionDesc.textSize = **TEXTSIZE; @@ -144,14 +144,14 @@ void easymotionDispatch(std::string args) } else if (kv[0] == "textfont") { actionDesc.textFont = kv[1]; } else if (kv[0] == "textpadding") { - CVarList padVars = CVarList(kv[1]); + CVarList padVars = CVarList(kv[1], 0, 's'); actionDesc.boxPadding.parseGapData(padVars); } else if (kv[0] == "rounding") { actionDesc.rounding = configStringToInt(kv[1]); } else if (kv[0] == "bordersize") { actionDesc.borderSize = configStringToInt(kv[1]); } else if (kv[0] == "bordercolor") { - CVarList varlist(kv[1], 0, ' '); + CVarList varlist(kv[1], 0, 's'); actionDesc.borderColor.m_vColors.clear(); actionDesc.borderColor.m_fAngle = 0; if(!parseBorderGradient(kv[1], &actionDesc.borderColor)) {