mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
Welcome the all new EventsSink infrastructure
--each applet has now its own Sunk events to handle, and as such each applet can now have different paddings and that does not create any issues or missing events
This commit is contained in:
parent
de6f2282e6
commit
574135e084
@ -169,6 +169,11 @@ int main(int argc, char **argv)
|
||||
filterDebugInputMask.setDescription(QStringLiteral("Show visual window indicators for calculated input mask."));
|
||||
filterDebugInputMask.setFlags(QCommandLineOption::HiddenFromHelp);
|
||||
parser.addOption(filterDebugInputMask);
|
||||
|
||||
QCommandLineOption filterDebugEventSinkMask(QStringList() << QStringLiteral("events-sink"));
|
||||
filterDebugEventSinkMask.setDescription(QStringLiteral("Show visual indicators for areas of EventsSink."));
|
||||
filterDebugEventSinkMask.setFlags(QCommandLineOption::HiddenFromHelp);
|
||||
parser.addOption(filterDebugEventSinkMask);
|
||||
//! END: Hidden options
|
||||
|
||||
parser.process(app);
|
||||
|
@ -24,6 +24,7 @@ import org.kde.latte.abilities.definition 0.1 as AbilityDefinition
|
||||
import org.kde.latte.abilities.host 0.1 as AbilityHost
|
||||
|
||||
AbilityHost.Debug {
|
||||
eventsSinkEnabled: Qt.application.arguments.indexOf("--events-sink")>=0
|
||||
graphicsEnabled: Qt.application.arguments.indexOf("--graphics")>=0
|
||||
inputMaskEnabled: Qt.application.arguments.indexOf("--input")>=0
|
||||
layouterEnabled: Qt.application.arguments.indexOf("--layouter")>=0
|
||||
|
127
containment/package/contents/ui/applet/EventsSink.qml
Normal file
127
containment/package/contents/ui/applet/EventsSink.qml
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock 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.
|
||||
*
|
||||
* Latte-Dock 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.7
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.latte.core 0.2 as LatteCore
|
||||
|
||||
Item {
|
||||
property Item destination: null
|
||||
|
||||
readonly property int headThickness: appletItem.metrics.margin.thickness
|
||||
readonly property int tailThickness: destination ? destination.tailThicknessMargin : headThickness
|
||||
readonly property int lengthPadding: {
|
||||
if ( (root.panelAlignment === LatteCore.Types.Justify && appletItem.firstChildOfStartLayout)
|
||||
|| (root.panelAlignment === LatteCore.Types.Justify && appletItem.lastChildOfEndLayout)
|
||||
|| (root.panelAlignment !== LatteCore.Types.Justify && appletItem.firstChildOfMainLayout)
|
||||
|| (root.panelAlignment !== LatteCore.Types.Justify && appletItem.lastChildOfMainLayout)) {
|
||||
//! Fitts Law on corners
|
||||
return appletItem.lengthAppletFullMargin;
|
||||
}
|
||||
|
||||
return appletItem.lengthAppletPadding;
|
||||
}
|
||||
|
||||
readonly property bool active: parent ? parent.active : false
|
||||
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
active: appletItem.debug.eventsSinkEnabled && active
|
||||
|
||||
sourceComponent: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "yellow"
|
||||
opacity: 0.2
|
||||
visible: root.latteView && root.latteView.sink.destinationItem === destination
|
||||
}
|
||||
}
|
||||
|
||||
EventsSinkOriginArea {
|
||||
id: topArea
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? destination.width + 2 * lengthPadding : destination.width
|
||||
height: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
return lengthPadding;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
|
||||
return tailThickness;
|
||||
} else {
|
||||
return headThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventsSinkOriginArea {
|
||||
id: bottomArea
|
||||
anchors.top: parent.bottom
|
||||
anchors.topMargin: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? destination.width + 2 * lengthPadding : parent.width
|
||||
height: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
return lengthPadding;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
||||
return tailThickness;
|
||||
} else {
|
||||
return headThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventsSinkOriginArea {
|
||||
id: leftArea
|
||||
anchors.right: parent.left
|
||||
anchors.rightMargin: 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? parent.height : destination.height + 2 * lengthPadding
|
||||
width: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
|
||||
return lengthPadding;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
||||
return tailThickness;
|
||||
} else {
|
||||
return headThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventsSinkOriginArea {
|
||||
id: rightArea
|
||||
anchors.left: parent.right
|
||||
anchors.leftMargin: 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? parent.height : destination.height + 2 * lengthPadding
|
||||
width: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
|
||||
return lengthPadding;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
||||
return tailThickness;
|
||||
} else {
|
||||
return headThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock 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.
|
||||
*
|
||||
* Latte-Dock 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.7
|
||||
|
||||
MouseArea {
|
||||
id: __destinationArea
|
||||
enabled: visible
|
||||
hoverEnabled: true
|
||||
visible: root.latteView && root.latteView.sink.originItem !== __destinationArea
|
||||
|
||||
onEntered: {
|
||||
root.latteView.sink.setSink(__destinationArea, destination)
|
||||
}
|
||||
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
active: appletItem.debug.eventsSinkEnabled && active
|
||||
|
||||
sourceComponent: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "red"
|
||||
opacity: 0.2
|
||||
}
|
||||
}
|
||||
}
|
@ -473,6 +473,22 @@ Item{
|
||||
]
|
||||
}
|
||||
|
||||
//! EventsSink
|
||||
|
||||
Loader {
|
||||
id: eventsSinkLoader
|
||||
anchors.fill: _wrapperContainer
|
||||
active: (appletItem.lockZoom || !appletItem.parabolic.isEnabled || !appletItem.parabolicEffectIsSupported)
|
||||
&& !communicator.parabolicEffectIsSupported
|
||||
&& !isSeparator
|
||||
&& !isSpacer
|
||||
|
||||
sourceComponent: EventsSink {
|
||||
destination: _wrapperContainer
|
||||
}
|
||||
}
|
||||
|
||||
//! InternalViewSplitter
|
||||
Loader{
|
||||
anchors.fill: _wrapperContainer
|
||||
active: appletItem.isInternalViewSplitter && root.inConfigureAppletsMode
|
||||
|
@ -24,6 +24,7 @@ import org.kde.latte.abilities.definition 0.1 as AbilityDefinition
|
||||
AbilityDefinition.Debug {
|
||||
property Item bridge: null
|
||||
|
||||
eventsSinkEnabled: ref.debug.eventsSinkEnabled
|
||||
graphicsEnabled: ref.debug.graphicsEnabled
|
||||
inputMaskEnabled: ref.debug.inputMaskEnabled
|
||||
layouterEnabled: ref.debug.layouterEnabled
|
||||
|
@ -20,6 +20,7 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
property bool eventsSinkEnabled: false
|
||||
property bool graphicsEnabled: false
|
||||
property bool inputMaskEnabled: false
|
||||
property bool layouterEnabled: false
|
||||
|
Loading…
x
Reference in New Issue
Block a user