mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 15:05:59 +01:00
notifications: fix notifications on manually rotated monitor (#5599)
This commit is contained in:
parent
02cbf049d2
commit
c99803af15
2 changed files with 11 additions and 7 deletions
|
@ -76,7 +76,7 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
|
||||||
|
|
||||||
const auto SCALE = pMonitor->scale;
|
const auto SCALE = pMonitor->scale;
|
||||||
|
|
||||||
const auto MONSIZE = pMonitor->vecPixelSize;
|
const auto MONSIZE = pMonitor->vecTransformedSize;
|
||||||
|
|
||||||
cairo_text_extents_t cairoExtents;
|
cairo_text_extents_t cairoExtents;
|
||||||
int iconW = 0, iconH = 0;
|
int iconW = 0, iconH = 0;
|
||||||
|
@ -185,16 +185,19 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
|
||||||
|
|
||||||
void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
|
void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
|
||||||
|
|
||||||
if (m_pLastMonitor != pMonitor || !m_pCairo || !m_pCairoSurface) {
|
const auto MONSIZE = pMonitor->vecTransformedSize;
|
||||||
|
|
||||||
|
if (m_pLastMonitor != pMonitor || m_vecLastSize != MONSIZE || !m_pCairo || !m_pCairoSurface) {
|
||||||
|
|
||||||
if (m_pCairo && m_pCairoSurface) {
|
if (m_pCairo && m_pCairoSurface) {
|
||||||
cairo_destroy(m_pCairo);
|
cairo_destroy(m_pCairo);
|
||||||
cairo_surface_destroy(m_pCairoSurface);
|
cairo_surface_destroy(m_pCairoSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, MONSIZE.x, MONSIZE.y);
|
||||||
m_pCairo = cairo_create(m_pCairoSurface);
|
m_pCairo = cairo_create(m_pCairoSurface);
|
||||||
m_pLastMonitor = pMonitor;
|
m_pLastMonitor = pMonitor;
|
||||||
|
m_vecLastSize = MONSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the notifications
|
// Draw the notifications
|
||||||
|
@ -232,9 +235,9 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, MONSIZE.x, MONSIZE.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
|
||||||
|
|
||||||
CBox pMonBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
CBox pMonBox = {0, 0, MONSIZE.x, MONSIZE.y};
|
||||||
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ class CHyprNotificationOverlay {
|
||||||
cairo_t* m_pCairo = nullptr;
|
cairo_t* m_pCairo = nullptr;
|
||||||
|
|
||||||
CMonitor* m_pLastMonitor = nullptr;
|
CMonitor* m_pLastMonitor = nullptr;
|
||||||
|
Vector2D m_vecLastSize = Vector2D(-1, -1);
|
||||||
|
|
||||||
CTexture m_tTexture;
|
CTexture m_tTexture;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue