1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-24 02:50:35 +03:00

delay a bit the directRender activation

--previously directRender was activating also when
from the first entered element the mouse moved fast
enough to the second element. But this could happen
also accidentaly some times. This improvements indicates
also the mouse position in the second element to be
near the center of that element
This commit is contained in:
Michail Vourlakos 2018-02-18 17:06:59 +02:00
parent 764f7d06b6
commit 05e08e57c5
4 changed files with 56 additions and 7 deletions
containment/package/contents/ui
plasmoid/package/contents/ui

@ -545,6 +545,7 @@ Item {
//! plasma tooltips are disabled
visible: !container.latteApplet && !lockZoom && canBeHovered && !(container.isSeparator && !root.editMode) //&& (root.zoomFactor>1)
property bool fastEnteringFlag: false
property bool pressed: false
onClicked: {
@ -559,10 +560,13 @@ Item {
//console.log("entered applet:" + layoutsContainer.hoveredIndex);
if ((wrapper.zoomScale>=root.midZoomFactor) && (layoutsContainer.hoveredIndex !== -1)
if (fastEnteringFlag) {
fastEnteringFlag = false;
}
if ((layoutsContainer.hoveredIndex !== -1 || layoutsContainer.hoveredIndex===index)
&& !enableDirectRenderTimer.running && !root.globalDirectRender) {
root.setGlobalDirectRender(true);
enableDirectRenderTimer.start();
fastEnteringFlag = true;
}
if (!(root.dockIsHidden || root.inSlidingIn || root.inSlidingOut)){
@ -609,6 +613,28 @@ Item {
return;
}
if (fastEnteringFlag) {
var lengthPos;
if (root.vertical) {
lengthPos = mouse.x;
} else {
lengthPos = mouse.y;
}
//! check if the mouse enters a second applet and it is near the center
//! this way the directRendering isnt activated too fast or when the
//! mouse enters between two tasks at start
if (lengthPos >= (wrapper.center - root.iconSize/2)
&& lengthPos <= (wrapper.center + root.iconSize/2)) {
if (!enableDirectRenderTimer.running && !root.globalDirectRender) {
root.setGlobalDirectRender(true);
enableDirectRenderTimer.start();
}
fastEnteringFlag = false;
}
}
if( ((wrapper.zoomScale == 1 || wrapper.zoomScale === root.zoomFactor) && !root.globalDirectRender) || root.globalDirectRender) {
if (!(root.dockIsHidden || root.inSlidingIn || root.inSlidingOut)){
layoutsContainer.hoveredIndex = index;

@ -257,7 +257,6 @@ DragDrop.DropArea {
Latte.Dock.Center : plasmoid.configuration.panelPosition )
property real zoomFactor: (Latte.WindowSystem.compositingActive && durationTime>0) ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
property real midZoomFactor: 1 //(1 + (zoomFactor-1)/3)
readonly property string plasmoidName: "org.kde.latte.plasmoid"

@ -193,7 +193,6 @@ Item {
property real durationTime: latteDock ? latteDock.durationTime : plasmoid.configuration.durationTime
property real zoomFactor: latteDock ? latteDock.zoomFactor : ( 1 + (plasmoid.configuration.zoomLevel / 20) )
property real midZoomFactor: latteDock ? latteDock.midZoomFactor : (1 + (zoomFactor-1)/2)
property int appShadowSize: latteDock ? latteDock.appShadowSize : Math.ceil(0.12*iconSize)
property string appShadowColor: latteDock ? latteDock.appShadowColor : "#ff080808"

@ -85,6 +85,7 @@ MouseArea{
//opacity : isSeparator && (hiddenSpacerLeft.neighbourSeparator || hiddenSpacerRight.neighbourSeparator) ? 0 : 1
property bool buffersAreReady: false
property bool fastEnteringFlag: false //!flag to check if the mouse entered the dock very fast
property bool delayingRemove: ListView.delayRemove
//states that exist in windows in a Group of windows
property bool hasActive: isActive
@ -503,10 +504,13 @@ MouseArea{
return;
// console.log("entered task:" + icList.hoveredIndex);
if (fastEnteringFlag) {
fastEnteringFlag = false;
}
if ((wrapper.mScale>=root.midZoomFactor) && (icList.hoveredIndex!==-1 || icList.hoveredIndex===index)
if ((icList.hoveredIndex!==-1 || icList.hoveredIndex===index)
&& !root.directRenderTimerIsRunning && !root.globalDirectRender) {
root.startEnableDirectRenderTimer();
fastEnteringFlag = true;
}
if ((icList.hoveredIndex !== itemIndex) && isLauncher && windowsPreviewDlg.visible) {
@ -581,6 +585,27 @@ MouseArea{
return;
}
if (fastEnteringFlag) {
var lengthPos;
if (root.vertical) {
lengthPos = mouse.x;
} else {
lengthPos = mouse.y;
}
//! check if the mouse enters a second task and it is near the center
//! this way the directRendering isnt activated too fast or when the
//! mouse enters between two tasks at start
if (lengthPos >= (wrapper.center - root.iconSize/2)
&& lengthPos <= (wrapper.center + root.iconSize/2)) {
if (!root.directRenderTimerIsRunning && !root.globalDirectRender) {
root.startEnableDirectRenderTimer();
}
fastEnteringFlag = false;
}
}
if((inAnimation == false)&&(!root.taskInAnimation)&&(!root.disableRestoreZoom) && hoverEnabled){
if (!latteDock || (latteDock && !(latteDock.dockIsHidden || latteDock.inSlidingIn || latteDock.inSlidingOut))){
icList.hoveredIndex = index;