aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUFSoB <[email protected]>2024-04-16 01:47:39 +0500
committerGitHub <[email protected]>2024-04-15 21:47:39 +0100
commitc99803af157c4715e3a9a4477c64e12cb4749833 (patch)
tree2ecd5766098f3cc3f1803813775ae0331a36c0b8
parent02cbf049d2fbecfe64fc80e0ce388a6ac240bcb6 (diff)
downloadHyprland-c99803af157c4715e3a9a4477c64e12cb4749833.tar.gz
Hyprland-c99803af157c4715e3a9a4477c64e12cb4749833.zip
notifications: fix notifications on manually rotated monitor (#5599)
-rw-r--r--src/debug/HyprNotificationOverlay.cpp15
-rw-r--r--src/debug/HyprNotificationOverlay.hpp3
2 files changed, 11 insertions, 7 deletions
diff --git a/src/debug/HyprNotificationOverlay.cpp b/src/debug/HyprNotificationOverlay.cpp
index ced27814..dffa6889 100644
--- a/src/debug/HyprNotificationOverlay.cpp
+++ b/src/debug/HyprNotificationOverlay.cpp
@@ -76,7 +76,7 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
const auto SCALE = pMonitor->scale;
- const auto MONSIZE = pMonitor->vecPixelSize;
+ const auto MONSIZE = pMonitor->vecTransformedSize;
cairo_text_extents_t cairoExtents;
int iconW = 0, iconH = 0;
@@ -185,16 +185,19 @@ CBox CHyprNotificationOverlay::drawNotifications(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) {
cairo_destroy(m_pCairo);
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_pLastMonitor = pMonitor;
+ m_vecLastSize = MONSIZE;
}
// Draw the notifications
@@ -232,12 +235,12 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
#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);
}
bool CHyprNotificationOverlay::hasAny() {
return !m_dNotifications.empty();
-} \ No newline at end of file
+}
diff --git a/src/debug/HyprNotificationOverlay.hpp b/src/debug/HyprNotificationOverlay.hpp
index 5599b71b..25934734 100644
--- a/src/debug/HyprNotificationOverlay.hpp
+++ b/src/debug/HyprNotificationOverlay.hpp
@@ -55,6 +55,7 @@ class CHyprNotificationOverlay {
cairo_t* m_pCairo = nullptr;
CMonitor* m_pLastMonitor = nullptr;
+ Vector2D m_vecLastSize = Vector2D(-1, -1);
CTexture m_tTexture;
@@ -62,4 +63,4 @@ class CHyprNotificationOverlay {
std::string m_szIconFontName = "Sans";
};
-inline std::unique_ptr<CHyprNotificationOverlay> g_pHyprNotificationOverlay; \ No newline at end of file
+inline std::unique_ptr<CHyprNotificationOverlay> g_pHyprNotificationOverlay;