[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt/main_interface: implement CSDBorderSize property
Jean-Baptiste Kempf
gitlab at videolan.org
Sat Jun 12 08:50:30 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
9f36226d by Prince Gupta at 2021-06-12T07:56:27+00:00
qt/main_interface: implement CSDBorderSize property
- - - - -
74913342 by Prince Gupta at 2021-06-12T07:56:27+00:00
qml: remove application margins in CSD
introduce widget 'CSDMouseStealer' which is used to disable mouse
interactions in MainInterface::csdBorderSize around Main UI
- - - - -
7 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/interface_window_handler.cpp
- modules/gui/qt/maininterface/main_interface.hpp
- modules/gui/qt/maininterface/qml/MainInterface.qml
- modules/gui/qt/style/VLCStyle.qml
- modules/gui/qt/vlc.qrc
- + modules/gui/qt/widgets/qml/CSDMouseStealer.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -761,6 +761,7 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/CSDWindowButton.qml \
gui/qt/widgets/qml/CSDWindowButtonSet.qml \
gui/qt/widgets/qml/CSDTitlebarTapNDrapHandler.qml \
+ gui/qt/widgets/qml/CSDMouseStealer.qml \
gui/qt/widgets/qml/CurrentIndicator.qml \
gui/qt/widgets/qml/DragItem.qml \
gui/qt/widgets/qml/DrawerExt.qml \
=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -102,7 +102,7 @@ bool InterfaceWindowHandler::CSDSetCursor(QMouseEvent* mouseEvent)
const int y = mouseEvent->y();
const int winHeight = m_window->height();
const int winWidth = m_window->width();
- const int b = 5 * m_mainInterface->getIntfScaleFactor();
+ const int b = m_mainInterface->CSDBorderSize();
if (x < b && y < b) shape = Qt::SizeFDiagCursor;
else if (x >= winWidth - b && y >= winHeight - b) shape = Qt::SizeFDiagCursor;
@@ -126,7 +126,7 @@ bool InterfaceWindowHandler::CSDHandleClick(QMouseEvent* mouseEvent)
{
if (!m_mainInterface->useClientSideDecoration())
return false;
- const int b = 5 * m_mainInterface->getIntfScaleFactor();
+ const int b = m_mainInterface->CSDBorderSize();
if( mouseEvent->buttons() != Qt::LeftButton)
return false;
if ((m_window->visibility() & QWindow::Maximized) != 0)
=====================================
modules/gui/qt/maininterface/main_interface.hpp
=====================================
@@ -157,6 +157,7 @@ class MainInterface : public QVLCMW
Q_PROPERTY(ColorSchemeModel* colorScheme READ getColorScheme CONSTANT)
Q_PROPERTY(bool hasVLM READ hasVLM CONSTANT)
Q_PROPERTY(bool clientSideDecoration READ useClientSideDecoration NOTIFY useClientSideDecorationChanged)
+ Q_PROPERTY(int csdBorderSize READ CSDBorderSize NOTIFY useClientSideDecorationChanged)
Q_PROPERTY(bool hasToolbarMenu READ hasToolbarMenu NOTIFY hasToolbarMenuChanged)
Q_PROPERTY(bool canShowVideoPIP READ canShowVideoPIP CONSTANT)
Q_PROPERTY(bool pinVideoControls READ pinVideoControls WRITE setPinVideoControls NOTIFY pinVideoControlsChanged)
@@ -197,6 +198,7 @@ public:
inline bool isShowRemainingTime() const { return m_showRemainingTime; }
inline float getIntfScaleFactor() const { return m_intfScaleFactor; }
inline float getIntfUserScaleFactor() const { return m_intfUserScaleFactor; }
+ inline int CSDBorderSize() const { return 5 * getIntfScaleFactor(); }
inline float getMinIntfUserScaleFactor() const { return MIN_INTF_USER_SCALE_FACTOR; }
inline float getMaxIntfUserScaleFactor() const { return MAX_INTF_USER_SCALE_FACTOR; }
inline bool hasMediaLibrary() const { return b_hasMedialibrary; }
=====================================
modules/gui/qt/maininterface/qml/MainInterface.qml
=====================================
@@ -173,4 +173,9 @@ Rectangle {
stackView.focus = true
}
}
+
+ Loader {
+ active: mainInterface.clientSideDecoration
+ source: "qrc:///widgets/CSDMouseStealer.qml"
+ }
}
=====================================
modules/gui/qt/style/VLCStyle.qml
=====================================
@@ -205,8 +205,8 @@ Item {
property int appHeight: 0
//global application margin "safe area"
- property int applicationHorizontalMargin: mainInterface.clientSideDecoration ? dp(5, scale) : 0
- property int applicationVerticalMargin: mainInterface.clientSideDecoration ? dp(5, scale) : 0
+ property int applicationHorizontalMargin: 0
+ property int applicationVerticalMargin: 0
property int globalToolbar_height: dp(40, scale)
property int localToolbar_height: dp(48, scale)
=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -195,6 +195,7 @@
<file alias="CSDWindowButton.qml">widgets/qml/CSDWindowButton.qml</file>
<file alias="CSDWindowButtonSet.qml">widgets/qml/CSDWindowButtonSet.qml</file>
<file alias="CSDTitlebarTapNDrapHandler.qml">widgets/qml/CSDTitlebarTapNDrapHandler.qml</file>
+ <file alias="CSDMouseStealer.qml">widgets/qml/CSDMouseStealer.qml</file>
<file alias="CurrentIndicator.qml">widgets/qml/CurrentIndicator.qml</file>
<file alias="GridItem.qml">widgets/qml/GridItem.qml</file>
<file alias="ListItem.qml">widgets/qml/ListItem.qml</file>
=====================================
modules/gui/qt/widgets/qml/CSDMouseStealer.qml
=====================================
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (C) 2021 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+import QtQuick 2.15
+
+Item {
+ parent: g_root
+
+ Repeater {
+ model: [
+ {
+ x: 0,
+ y: 0,
+ width: g_root.width,
+ height: mainInterface.csdBorderSize
+ },
+ {
+ x: 0,
+ y: 0,
+ width: mainInterface.csdBorderSize,
+ height: g_root.height
+ },
+ {
+ x: g_root.width - mainInterface.csdBorderSize,
+ y: 0,
+ width: mainInterface.csdBorderSize,
+ height: g_root.height
+ },
+ {
+ x: 0,
+ y: g_root.height - mainInterface.csdBorderSize,
+ width: g_root.width,
+ height: mainInterface.csdBorderSize
+ }
+ ]
+
+ delegate: MouseArea {
+ x: modelData.x
+ y: modelData.y
+ width: modelData.width
+ height: modelData.height
+ hoverEnabled: true
+ }
+ }
+}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6741fa8bbf22686b5c9e8162823f53e3d5cb400f...74913342349c1a8d7f9a945b249af85644f148ea
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6741fa8bbf22686b5c9e8162823f53e3d5cb400f...74913342349c1a8d7f9a945b249af85644f148ea
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list