Fix rendering on displays with scale > 1. Remove debug output. Go back to using commas as parameter seperator because I'm dumb

This commit is contained in:
Zakk
2024-04-07 20:53:11 -04:00
parent f44e3f8fe7
commit 981bb399c1
3 changed files with 9 additions and 12 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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)) {