[vlc-commits] qt: prevent window jumps on resize (X11)
Romain Vimont
git at videolan.org
Thu May 3 12:36:15 CEST 2018
vlc/vlc-3.0 | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Apr 30 21:57:36 2018 +0200| [94442595fa69db679a569e528eec2dced4531803] | committer: Hugo Beauzée-Luyssen
qt: prevent window jumps on resize (X11)
On X11 with Qt < 5.10, a resize request invoked XMoveResizeWindow() (see
0285ba4eeaa55608573a48e50a036ee2b437ae8b), which both moves and resizes.
To avoid moving, it was called with the current geometry() coordinates
as position arguments.
However, the calculated position may be wrong when several displays have
a different devicePixelRatio(). As a consequence, on a secondary
display, every (automatic) resize of the window made it jump to
unexpected locations.
To avoid the problem, just call XResizeWindow(), so that the window is
not moved at all.
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
(cherry picked from commit d7fec54badc42733faf41bffdad4d31e0b8a0d55)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=94442595fa69db679a569e528eec2dced4531803
---
modules/gui/qt/main_interface.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index e3b76ee228..787be786ef 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1343,9 +1343,8 @@ void MainInterface::resizeWindow(int w, int h)
* By calling XMoveResizeWindow directly, Qt will not see our change
* request until the ConfigureNotify event on success
* and not at all if it is rejected. */
- XMoveResizeWindow( QX11Info::display(), winId(),
- geometry().x() * dpr, geometry().y() * dpr,
- (unsigned int)size.width() * dpr, (unsigned int)size.height() * dpr);
+ XResizeWindow( QX11Info::display(), winId(),
+ (unsigned int)size.width() * dpr, (unsigned int)size.height() * dpr);
return;
}
#endif
More information about the vlc-commits
mailing list