diff options
| author | Dmytro Budnyk <dmitriy.budnik@gmail.com> | 2026-01-02 21:10:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-02 20:10:47 +0100 |
| commit | ee67278038b5b6597172b2a3ee9d57f6ad0eafc7 (patch) | |
| tree | 03c2b1b94811a246b451765464704efba36f6591 /src/hyprerror/HyprError.cpp | |
| parent | b9bd9d147fc00b7cc65f9545722182720cbd521d (diff) | |
hyprerror: fix horizontal overflow and damage box (#12719)
* hyprerror: fix horizontal overflow and damage box
* hyprerror: remove redundant m_queued preservation logic
The logic to save and restore m_queued into a temporary string 'q' was redundant because m_queued is explicitly cleared at the end of createQueued() (line 164). Restoring it to a non-empty state would cause createQueued() to be called every frame in draw(), which is not the intended behavior for the static error bar.
* Fixes style
Diffstat (limited to 'src/hyprerror/HyprError.cpp')
| -rw-r--r-- | src/hyprerror/HyprError.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/hyprerror/HyprError.cpp b/src/hyprerror/HyprError.cpp index c8125e5b..65c95204 100644 --- a/src/hyprerror/HyprError.cpp +++ b/src/hyprerror/HyprError.cpp @@ -83,7 +83,8 @@ void CHyprError::createQueued() { const double X = PAD; const double Y = TOPBAR ? PAD : PMONITOR->m_pixelSize.y - HEIGHT - PAD; - m_damageBox = {0, 0, sc<int>(PMONITOR->m_pixelSize.x), sc<int>(HEIGHT) + sc<int>(PAD) * 2}; + m_damageBox = {sc<int>(PMONITOR->m_position.x), sc<int>(PMONITOR->m_position.y + (TOPBAR ? 0 : PMONITOR->m_pixelSize.y - (HEIGHT + PAD * 2))), sc<int>(PMONITOR->m_pixelSize.x), + sc<int>(HEIGHT + PAD * 2)}; cairo_new_sub_path(CAIRO); cairo_arc(CAIRO, X + WIDTH - RADIUS, Y + RADIUS, RADIUS, -90 * DEGREES, 0 * DEGREES); @@ -111,6 +112,8 @@ void CHyprError::createQueued() { pango_font_description_set_style(pangoFD, PANGO_STYLE_NORMAL); pango_font_description_set_weight(pangoFD, PANGO_WEIGHT_NORMAL); pango_layout_set_font_description(layoutText, pangoFD); + pango_layout_set_width(layoutText, (WIDTH - 2 * (1 + RADIUS)) * PANGO_SCALE); + pango_layout_set_ellipsize(layoutText, PANGO_ELLIPSIZE_END); float yoffset = TOPBAR ? 0 : Y - PAD; int renderedcnt = 0; @@ -132,9 +135,8 @@ void CHyprError::createQueued() { pango_layout_set_text(layoutText, moreString.c_str(), -1); pango_cairo_show_layout(CAIRO, layoutText); } - m_queued = ""; - m_lastHeight = yoffset + PAD + 1 - (TOPBAR ? 0 : Y - PAD); + m_lastHeight = HEIGHT; pango_font_description_free(pangoFD); g_object_unref(layoutText); @@ -200,12 +202,13 @@ void CHyprError::draw() { } } - const auto PMONITOR = g_pHyprOpenGL->m_renderData.pMonitor; + const auto PMONITOR = g_pHyprOpenGL->m_renderData.pMonitor; - CBox monbox = {0, 0, PMONITOR->m_pixelSize.x, PMONITOR->m_pixelSize.y}; + CBox monbox = {0, 0, PMONITOR->m_pixelSize.x, PMONITOR->m_pixelSize.y}; - m_damageBox.x = sc<int>(PMONITOR->m_position.x); - m_damageBox.y = sc<int>(PMONITOR->m_position.y); + static auto BAR_POSITION = CConfigValue<Hyprlang::INT>("debug:error_position"); + m_damageBox.x = sc<int>(PMONITOR->m_position.x); + m_damageBox.y = sc<int>(PMONITOR->m_position.y + (*BAR_POSITION == 0 ? 0 : PMONITOR->m_pixelSize.y - m_damageBox.height)); if (m_fadeOpacity->isBeingAnimated() || m_monitorChanged) g_pHyprRenderer->damageBox(m_damageBox); |
