groupbar: fix title scaling (#5969)

modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.hpp
This commit is contained in:
MightyPlaza 2024-05-09 20:47:59 +00:00 committed by Vaxry
parent 635a02d83f
commit eeebbc0e7e
2 changed files with 5 additions and 5 deletions

View file

@ -154,8 +154,8 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
if (!pTitleTex) if (!pTitleTex)
pTitleTex = m_sTitleTexs.titleTexs pTitleTex = m_sTitleTexs.titleTexs
.emplace_back(std::make_unique<CTitleTex>(m_dwGroupMembers[i].lock(), .emplace_back(std::make_unique<CTitleTex>(
Vector2D{m_fBarWidth * pMonitor->scale, (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale})) m_dwGroupMembers[i].lock(), Vector2D{m_fBarWidth * pMonitor->scale, (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale}, pMonitor->scale))
.get(); .get();
rect.y += (ASSIGNEDBOX.h / 2.0 - (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) / 2.0) * pMonitor->scale; rect.y += (ASSIGNEDBOX.h / 2.0 - (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) / 2.0) * pMonitor->scale;
@ -184,7 +184,7 @@ void CHyprGroupBarDecoration::invalidateTextures() {
m_sTitleTexs.titleTexs.clear(); m_sTitleTexs.titleTexs.clear();
} }
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize) { CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) {
szContent = pWindow->m_szTitle; szContent = pWindow->m_szTitle;
pWindowOwner = pWindow; pWindowOwner = pWindow;
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);
@ -207,7 +207,7 @@ CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize) {
pango_layout_set_text(layout, szContent.c_str(), -1); pango_layout_set_text(layout, szContent.c_str(), -1);
PangoFontDescription* fontDesc = pango_font_description_from_string((*PTITLEFONTFAMILY).c_str()); PangoFontDescription* fontDesc = pango_font_description_from_string((*PTITLEFONTFAMILY).c_str());
pango_font_description_set_size(fontDesc, *PTITLEFONTSIZE * PANGO_SCALE); pango_font_description_set_size(fontDesc, *PTITLEFONTSIZE * PANGO_SCALE * monitorScale);
pango_layout_set_font_description(layout, fontDesc); pango_layout_set_font_description(layout, fontDesc);
pango_font_description_free(fontDesc); pango_font_description_free(fontDesc);

View file

@ -9,7 +9,7 @@
class CTitleTex { class CTitleTex {
public: public:
CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize); CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale);
~CTitleTex(); ~CTitleTex();
CTexture tex; CTexture tex;