summaryrefslogtreecommitdiff
blob: 99155bf79e8c83ebffd447bfcec7dc4e9e3efe38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From 473ee3b3b0ce09feb23afcfc0ff276986db4f1af Mon Sep 17 00:00:00 2001
From: Eugene Paskevich <eugene@raptor.kiev.ua>
Date: Sun, 4 Nov 2018 21:45:07 +0200
Subject: [PATCH] Qt: don't let the volume slider go beyong upper and/or left
 screen boundaries.

---
 src/libaudqt/volumebutton.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libaudqt/volumebutton.cc b/src/libaudqt/volumebutton.cc
index e9144cb60..71edf16a1 100644
--- a/src/libaudqt/volumebutton.cc
+++ b/src/libaudqt/volumebutton.cc
@@ -134,7 +134,9 @@ void VolumeButton::showSlider ()
     int dy = container_size.height () / 2 - button_size.height () / 2;
 
     QPoint pos = mapToGlobal (QPoint (0, 0));
-    pos += QPoint (-dx, -dy);
+    pos -= QPoint (dx, dy);
+    pos.setX(qMax(pos.x(), 0));
+    pos.setY(qMax(pos.y(), 0));
 
     m_container->move (pos);
     window_bring_to_front (m_container);