[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix CSD button location when desktop scale factor isn't 1.0 on windows
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Apr 27 08:52:18 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
43cd010f by Pierre Lamot at 2023-04-27T08:09:22+00:00
qt: fix CSD button location when desktop scale factor isn't 1.0 on windows
- - - - -
9aa4648b by Pierre Lamot at 2023-04-27T08:09:22+00:00
qt: exclude resize border area of window when computing CSD button location
- - - - -
1 changed file:
- modules/gui/qt/maininterface/mainctx_win32.cpp
Changes:
=====================================
modules/gui/qt/maininterface/mainctx_win32.cpp
=====================================
@@ -215,11 +215,12 @@ private:
class CSDWin32EventHandler : public QObject, public QAbstractNativeEventFilter
{
public:
- CSDWin32EventHandler(const bool useClientSideDecoration, QWindow *window, CSDButtonModel *buttonmodel, QObject *parent)
+ CSDWin32EventHandler(MainCtx* mainctx, QWindow *window, QObject *parent)
: QObject {parent}
- , m_useClientSideDecoration {useClientSideDecoration}
+ , m_mainctx(mainctx)
+ , m_useClientSideDecoration {mainctx->useClientSideDecoration()}
, m_window {window}
- , m_buttonmodel {buttonmodel}
+ , m_buttonmodel {mainctx->csdButtonModel()}
{
QApplication::instance()->installNativeEventFilter(this);
updateCSDSettings();
@@ -325,7 +326,16 @@ public:
// Map the point to client coordinates.
::MapWindowPoints(nullptr, msg->hwnd, &point, 1);
- const QPoint qtPoint {point.x, point.y};
+ // excluse resize handle area
+ if ((m_window->windowState() != Qt::WindowFullScreen)
+ && (point.y < resizeBorderHeight(m_window)
+ || point.x > (m_window->width() * m_window->devicePixelRatio() - resizeBorderWidth(m_window))))
+ return false;
+
+ //getIntfScaleFactor uses logicalDotsPerInch, here we want the actual window DPR
+ double scaleFactor = m_mainctx->getIntfUserScaleFactor() * m_window->devicePixelRatio();
+ //divide by scale factor as buttons coordinates will be in dpr
+ const QPoint qtPoint {static_cast<int>(point.x / scaleFactor), static_cast<int>(point.y / scaleFactor)};
auto button = overlappingButton(qtPoint);
if (!button)
return false;
@@ -515,6 +525,7 @@ private:
}
}
+ MainCtx* m_mainctx = nullptr;
bool m_useClientSideDecoration;
QWindow *m_window;
CSDButtonModel *m_buttonmodel;
@@ -787,8 +798,7 @@ InterfaceWindowHandlerWin32::InterfaceWindowHandlerWin32(qt_intf_t *_p_intf, Mai
: InterfaceWindowHandler(_p_intf, mainCtx, window, widget, parent)
#if QT_CLIENT_SIDE_DECORATION_AVAILABLE
- , m_CSDWindowEventHandler(new CSDWin32EventHandler(mainCtx->useClientSideDecoration(),
- window, mainCtx->csdButtonModel(), window))
+ , m_CSDWindowEventHandler(new CSDWin32EventHandler(mainCtx, window, window))
#endif
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8dc0ae12051b480aec33a8c43b62879c77495fa4...9aa4648b22f72384980f1e3a8b45b8373834c591
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8dc0ae12051b480aec33a8c43b62879c77495fa4...9aa4648b22f72384980f1e3a8b45b8373834c591
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list