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:
@@ -30,7 +30,8 @@ plugin {
|
|||||||
textfont=Sans
|
textfont=Sans
|
||||||
|
|
||||||
#padding around the text (inside the label box) size in pixels, adjusted for
|
#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
|
textpadding=0
|
||||||
|
|
||||||
#size of the border around the label box. A border size of zero disables border rendering.
|
#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.
|
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:{}`
|
`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 :/)
|
|
||||||
|
|
||||||
# Installing
|
# Installing
|
||||||
|
|
||||||
|
|||||||
@@ -68,13 +68,12 @@ void CHyprEasyLabel::renderMotionString(Vector2D& bufferSize, const float scale)
|
|||||||
PangoRectangle ink_rect;
|
PangoRectangle ink_rect;
|
||||||
PangoRectangle logical_rect;
|
PangoRectangle logical_rect;
|
||||||
pango_layout_get_pixel_extents(layout, &ink_rect, &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;
|
layoutWidth = ink_rect.width+m_iPaddingLeft+m_iPaddingRight;
|
||||||
layoutHeight = ink_rect.height+m_iPaddingTop+m_iPaddingBottom;
|
layoutHeight = ink_rect.height+m_iPaddingTop+m_iPaddingBottom;
|
||||||
|
|
||||||
bufferSize.x = layoutWidth*scale;
|
bufferSize.x = layoutWidth;
|
||||||
bufferSize.y = layoutHeight*scale;
|
bufferSize.y = layoutHeight;
|
||||||
|
|
||||||
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
|
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
|
||||||
const auto CAIRO = cairo_create(CAIROSURFACE);
|
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_set_operator(CAIRO, CAIRO_OPERATOR_CLEAR);
|
||||||
cairo_paint(CAIRO);
|
cairo_paint(CAIRO);
|
||||||
cairo_restore(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);
|
cairo_set_source_rgba(CAIRO, textColor.r, textColor.g, textColor.b, textColor.a);
|
||||||
pango_cairo_show_layout(CAIRO, layout);
|
pango_cairo_show_layout(CAIRO, layout);
|
||||||
g_object_unref(layout);
|
g_object_unref(layout);
|
||||||
|
|||||||
6
main.cpp
6
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 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();
|
static auto *const MOTIONKEYS = (Hyprlang::STRING const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:motionkeys")->getDataStaticPtr();
|
||||||
|
|
||||||
CVarList emargs(args, 0, ';');
|
CVarList emargs(args, 0, ',');
|
||||||
SMotionActionDesc actionDesc;
|
SMotionActionDesc actionDesc;
|
||||||
|
|
||||||
actionDesc.textSize = **TEXTSIZE;
|
actionDesc.textSize = **TEXTSIZE;
|
||||||
@@ -144,14 +144,14 @@ void easymotionDispatch(std::string args)
|
|||||||
} else if (kv[0] == "textfont") {
|
} else if (kv[0] == "textfont") {
|
||||||
actionDesc.textFont = kv[1];
|
actionDesc.textFont = kv[1];
|
||||||
} else if (kv[0] == "textpadding") {
|
} else if (kv[0] == "textpadding") {
|
||||||
CVarList padVars = CVarList(kv[1]);
|
CVarList padVars = CVarList(kv[1], 0, 's');
|
||||||
actionDesc.boxPadding.parseGapData(padVars);
|
actionDesc.boxPadding.parseGapData(padVars);
|
||||||
} else if (kv[0] == "rounding") {
|
} else if (kv[0] == "rounding") {
|
||||||
actionDesc.rounding = configStringToInt(kv[1]);
|
actionDesc.rounding = configStringToInt(kv[1]);
|
||||||
} else if (kv[0] == "bordersize") {
|
} else if (kv[0] == "bordersize") {
|
||||||
actionDesc.borderSize = configStringToInt(kv[1]);
|
actionDesc.borderSize = configStringToInt(kv[1]);
|
||||||
} else if (kv[0] == "bordercolor") {
|
} else if (kv[0] == "bordercolor") {
|
||||||
CVarList varlist(kv[1], 0, ' ');
|
CVarList varlist(kv[1], 0, 's');
|
||||||
actionDesc.borderColor.m_vColors.clear();
|
actionDesc.borderColor.m_vColors.clear();
|
||||||
actionDesc.borderColor.m_fAngle = 0;
|
actionDesc.borderColor.m_fAngle = 0;
|
||||||
if(!parseBorderGradient(kv[1], &actionDesc.borderColor)) {
|
if(!parseBorderGradient(kv[1], &actionDesc.borderColor)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user