1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-21 10:50:30 +03:00

drop fastEntering for directRenderDelayer

--the directRenderDelayer is used during first
entering in order to delay the activation of
directRendering. The cons of previous fastEntering
implementation added the necessity for this
replacement.
This commit is contained in:
Michail Vourlakos 2018-03-14 16:30:22 +02:00
parent 5b77c09faa
commit 0bb70c1595
4 changed files with 38 additions and 56 deletions

View File

@ -575,7 +575,6 @@ Item {
visible: !container.latteApplet && !lockZoom && canBeHovered && !(container.isSeparator && !root.editMode) //&& (root.zoomFactor>1)
property bool blockWheel: false
property bool fastEnteringFlag: false
property bool pressed: false
onClicked: {
@ -597,13 +596,9 @@ Item {
//console.log("entered applet:" + layoutsContainer.hoveredIndex);
if (fastEnteringFlag) {
fastEnteringFlag = false;
}
if ((layoutsContainer.hoveredIndex !== -1 || root.latteAppletHoveredIndex!==-1)
&& !root.globalDirectRender) {
fastEnteringFlag = true;
if (layoutsContainer.hoveredIndex === -1 && root.latteAppletHoveredIndex===-1) {
root.startDirectRenderDelayerDuringEntering();
}
if (!(root.dockIsHidden || root.inSlidingIn || root.inSlidingOut)){
@ -630,10 +625,6 @@ Item {
}
onExited:{
if (fastEnteringFlag) {
fastEnteringFlag = false;
}
if (appletIconItem && appletIconItem.visible)
appletIconItem.active = false;
@ -656,25 +647,8 @@ 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 (!root.globalDirectRender) {
root.setGlobalDirectRender(true);
}
fastEnteringFlag = false;
}
if (!root.globalDirectRender && !root.directRenderDelayerIsRunning) {
root.setGlobalDirectRender(true);
}
if( ((wrapper.zoomScale == 1 || wrapper.zoomScale === root.zoomFactor) && !root.globalDirectRender) || root.globalDirectRender) {

View File

@ -130,6 +130,7 @@ DragDrop.DropArea {
true : (plasmoid.configuration.useThemePanel || plasmoid.configuration.solidBackgroundForMaximized)
property alias hoveredIndex: layoutsContainer.hoveredIndex
property alias directRenderDelayerIsRunning: directRenderDelayerForEnteringTimer.running
property int activeIndicator: plasmoid.configuration.activeIndicator
@ -1176,6 +1177,10 @@ DragDrop.DropArea {
checkRestoreZoom.stop();
}
function startDirectRenderDelayerDuringEntering(){
directRenderDelayerForEnteringTimer.start();
}
function setGlobalDirectRender(value) {
if (latteApplet && latteApplet.waitingLaunchers.length > 0)
return;
@ -1754,6 +1759,14 @@ DragDrop.DropArea {
}
}
//! Delayer in order to not activate directRendering when the mouse
//! enters until the timer has ended. This way we make sure that the
//! zoom-in animations will have ended.
Timer{
id:directRenderDelayerForEnteringTimer
interval: 3.2 * root.durationTime * units.shortDuration
}
//this is a delayer to update mask area, it is used in cases
//that animations can not catch up with animations signals
//e.g. the automaicIconSize case

View File

@ -165,6 +165,7 @@ Item {
//BEGIN Latte Dock properties
property bool enableShadows: latteDock ? latteDock.enableShadows > 0 : plasmoid.configuration.showShadows
property bool forceHidePanel: false
property bool directRenderDelayerIsRunning: latteDock ? latteDock.directRenderDelayerIsRunning : directRenderDelayerForEnteringTimer.running
property bool disableLeftSpacer: false
property bool disableRightSpacer: false
property bool dockIsHidden: latteDock ? latteDock.dockIsHidden : false
@ -906,6 +907,14 @@ Item {
}
}
//! Delayer in order to not activate directRendering when the mouse
//! enters until the timer has ended. This way we make sure that the
//! zoom-in animations will have ended.
Timer{
id:directRenderDelayerForEnteringTimer
interval: 3.2 * root.durationTime * units.shortDuration
}
//this timer restores the draggingPhase flag to false
//after a dragging has finished... This delay is needed
//in order to not animate any tasks are added after a
@ -1696,6 +1705,14 @@ Item {
}
}
function startDirectRenderDelayerDuringEntering(){
if (latteDock) {
latteDock.startDirectRenderDelayerDuringEntering();
} else {
directRenderDelayerForEnteringTimer.start();
}
}
///REMOVE
/*function createContextMenu(task) {
var menu = root.contextMenuComponent.createObject(task);

View File

@ -85,7 +85,6 @@ 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
property bool scalesUpdatedOnce: false
//states that exist in windows in a Group of windows
@ -512,13 +511,8 @@ MouseArea{
}
// console.log("entered task:" + icList.hoveredIndex);
if (fastEnteringFlag) {
fastEnteringFlag = false;
}
if ((icList.hoveredIndex!==-1 || root.dockHoveredIndex!==-1)
&& !root.globalDirectRender) {
fastEnteringFlag = true;
if (icList.hoveredIndex === -1 && root.dockHoveredIndex ===-1) {
root.startDirectRenderDelayerDuringEntering();
}
if ((icList.hoveredIndex !== itemIndex) && isLauncher && windowsPreviewDlg.visible) {
@ -561,10 +555,6 @@ MouseArea{
onExited: {
mainItemContainer.scalesUpdatedOnce = false;
if (fastEnteringFlag) {
fastEnteringFlag = false;
}
if (root.latteDock && (!root.showPreviews || (root.showPreviews && isLauncher))){
root.latteDock.hideTooltipLabel();
}
@ -604,20 +594,8 @@ MouseArea{
icList.hoveredIndex = index;
}
if (fastEnteringFlag) {
var lengthPos = mousePos;
//! 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.globalDirectRender) {
root.setGlobalDirectRender(true);
}
fastEnteringFlag = false;
}
if (!root.globalDirectRender && !root.directRenderDelayerIsRunning) {
root.setGlobalDirectRender(true);
}
if( ((wrapper.mScale == 1 || wrapper.mScale === root.zoomFactor) && !root.globalDirectRender)