mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
port container into new parabolic architecture
--drop the checkListHovered that was using an heuristic algorithm to discover if the mouse is still inside the window. In its place use the dock.visibility.containsMouse --use one single globalDirectRender flag from containment in order for all dock elements to investigate if they should use directRendering- painting or play animations instead
This commit is contained in:
parent
4ee9370012
commit
9b77117870
@ -175,8 +175,14 @@ Item {
|
||||
}
|
||||
|
||||
function clearZoom(){
|
||||
if (restoreAnimation)
|
||||
if (root.globalDirectRender){
|
||||
wrapper.zoomScale = 1;
|
||||
} else {
|
||||
restoreAnimation.start();
|
||||
}
|
||||
|
||||
//if (restoreAnimation)
|
||||
// restoreAnimation.start();
|
||||
// if(wrapper)
|
||||
// wrapper.zoomScale = 1;
|
||||
}
|
||||
@ -513,7 +519,7 @@ Item {
|
||||
}
|
||||
|
||||
onZoomScaleChanged: {
|
||||
if ((zoomScale === root.zoomFactor) && !enableDirectRenderTimer.running && !layoutsContainer.directRender) {
|
||||
if ((zoomScale === root.zoomFactor) && !enableDirectRenderTimer.running && !root.globalDirectRender) {
|
||||
enableDirectRenderTimer.start();
|
||||
}
|
||||
|
||||
@ -1131,7 +1137,6 @@ Item {
|
||||
}
|
||||
|
||||
onExited:{
|
||||
checkListHovered.start();
|
||||
if (appletIconItem)
|
||||
appletIconItem.active = false;
|
||||
}
|
||||
@ -1275,5 +1280,3 @@ Item {
|
||||
}
|
||||
//END animations
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,14 +141,7 @@ Item{
|
||||
|
||||
function slotContainsMouseChanged() {
|
||||
if(dock.visibility.containsMouse) {
|
||||
if (delayerTimer.running) {
|
||||
delayerTimer.stop();
|
||||
}
|
||||
|
||||
updateMaskArea();
|
||||
} else {
|
||||
// initialize the zoom
|
||||
delayerTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,18 +488,6 @@ Item{
|
||||
}
|
||||
|
||||
////////////// Timers //////
|
||||
//Timer to delay onLeave event
|
||||
Timer {
|
||||
id: delayerTimer
|
||||
interval: 400
|
||||
onTriggered: {
|
||||
if (!root.containsMouse()) {
|
||||
root.clearZoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Timer to delay onLeave event
|
||||
Timer {
|
||||
id: delayAnimationTimer
|
||||
interval: manager.inStartup ? 1000 : 500
|
||||
|
@ -45,13 +45,14 @@ DragDrop.DropArea {
|
||||
|
||||
////BEGIN properties
|
||||
property bool debugMode: Qt.application.arguments.indexOf("--graphics")>=0
|
||||
property bool globalDirectRender: false //it is used to check both the applet and the containment for direct render
|
||||
property bool globalDirectRender: false //it is used as a globalDirectRender for all elements in the dock
|
||||
|
||||
property bool addLaunchersMessage: false
|
||||
property bool addLaunchersInTaskManager: plasmoid.configuration.addLaunchersInTaskManager
|
||||
property bool autoDecreaseIconSize: plasmoid.configuration.autoDecreaseIconSize
|
||||
property bool blurEnabled: plasmoid.configuration.blurEnabled
|
||||
property bool confirmedDragEntered: false
|
||||
property bool dockContainsMouse: dock && dock.visibility ? dock.visibility.containsMouse : false
|
||||
property bool drawShadowsExternal: visibilityManager.panelIsBiggerFromIconSize && (zoomFactor === 1.0)
|
||||
&& (dock.visibility.mode === Latte.Dock.AlwaysVisible || dock.visibility.mode === Latte.Dock.WindowsGoBelow)
|
||||
&& (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && !root.solidPanel
|
||||
@ -196,8 +197,6 @@ DragDrop.DropArea {
|
||||
// TO BE DELETED, if not needed: property int counter:0;
|
||||
|
||||
///BEGIN properties provided to Latte Plasmoid
|
||||
property bool directRender: layoutsContainer.directRender
|
||||
|
||||
property bool enableShadows: plasmoid.configuration.shadows
|
||||
property bool dockIsHidden: dock ? dock.visibility.isHidden : true
|
||||
property bool dotsOnActive: plasmoid.configuration.dotsOnActive
|
||||
@ -481,20 +480,6 @@ DragDrop.DropArea {
|
||||
//// END OF Behaviors
|
||||
|
||||
//////////////START OF CONNECTIONS
|
||||
Connections {
|
||||
target: latteApplet
|
||||
onDirectRenderChanged: {
|
||||
root.globalDirectRender = latteApplet.directRender || layoutsContainer.directRender;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: layoutsContainer
|
||||
onDirectRenderChanged: {
|
||||
root.globalDirectRender = latteApplet ? latteApplet.directRender || layoutsContainer.directRender : layoutsContainer.directRender;
|
||||
}
|
||||
}
|
||||
|
||||
onEditModeChanged: {
|
||||
if (editMode) {
|
||||
visibilityManager.updateMaskArea();
|
||||
@ -941,35 +926,18 @@ DragDrop.DropArea {
|
||||
}
|
||||
|
||||
function clearZoom(){
|
||||
if (enableDirectRenderTimer.running)
|
||||
enableDirectRenderTimer.stop();
|
||||
|
||||
layoutsContainer.directRender = false;
|
||||
layoutsContainer.currentSpot = -1000;
|
||||
layoutsContainer.hoveredIndex = -1;
|
||||
root.clearZoomSignal();
|
||||
}
|
||||
|
||||
function containmentActions(){
|
||||
return dock.containmentActions();
|
||||
}
|
||||
|
||||
function containsMouse(){
|
||||
var result = root.outsideContainsMouse();
|
||||
|
||||
if(result)
|
||||
return true;
|
||||
|
||||
if(!result && latteApplet && latteApplet.outsideContainsMouse()){
|
||||
layoutsContainer.hoveredIndex = latteAppletContainer.index;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (latteApplet){
|
||||
latteApplet.clearZoom();
|
||||
}
|
||||
|
||||
return false;
|
||||
root.clearZoomSignal();
|
||||
}
|
||||
|
||||
function containmentActions(){
|
||||
return dock.containmentActions();
|
||||
}
|
||||
|
||||
function internalViewSplittersCount(){
|
||||
@ -998,41 +966,6 @@ DragDrop.DropArea {
|
||||
return splitters;
|
||||
}
|
||||
|
||||
function outsideContainsMouse(){
|
||||
var applets = startLayout.children;
|
||||
|
||||
for(var i=0; i<applets.length; ++i){
|
||||
var applet = applets[i];
|
||||
|
||||
if(applet && applet.containsMouse && !applet.lockZoom && applet.canBeHovered){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
applets = mainLayout.children;
|
||||
|
||||
for(var i=0; i<applets.length; ++i){
|
||||
var applet = applets[i];
|
||||
|
||||
if(applet && applet.containsMouse && !applet.lockZoom && applet.canBeHovered){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
///check second layout also
|
||||
applets = endLayout.children;
|
||||
|
||||
for(var i=0; i<applets.length; ++i){
|
||||
var applet = applets[i];
|
||||
|
||||
if(applet && applet.containsMouse && !applet.lockZoom && applet.canBeHovered){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeInternalViewSplitters(){
|
||||
for (var container in mainLayout.children) {
|
||||
var item = mainLayout.children[container];
|
||||
@ -1269,6 +1202,17 @@ DragDrop.DropArea {
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: dock.visibility
|
||||
onContainsMouseChanged: {
|
||||
if (dock.visibility.containsMouse) {
|
||||
if (checkRestoreZoom.running)
|
||||
checkRestoreZoom.stop();
|
||||
} else {
|
||||
checkRestoreZoom.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////END interfaces
|
||||
|
||||
@ -1281,6 +1225,18 @@ DragDrop.DropArea {
|
||||
|
||||
///////////////BEGIN UI elements
|
||||
|
||||
//it is used to check if the mouse is outside the layoutsContainer borders,
|
||||
//so in that case the onLeave event behavior should be trigerred
|
||||
MouseArea{
|
||||
id: rootMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
if(!root.editMode)
|
||||
checkRestoreZoom.start();
|
||||
}
|
||||
}
|
||||
|
||||
Loader{
|
||||
active: Qt.application.arguments.indexOf("--with-window") >= 0
|
||||
sourceComponent: DebugWindow{}
|
||||
@ -1370,8 +1326,6 @@ DragDrop.DropArea {
|
||||
property int currentSpot: -1000
|
||||
property int hoveredIndex: -1
|
||||
|
||||
property bool directRender: false
|
||||
|
||||
x: {
|
||||
if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal
|
||||
&& !root.editMode && !root.drawShadowsExternal ){
|
||||
@ -1792,19 +1746,37 @@ DragDrop.DropArea {
|
||||
|
||||
///////////////BEGIN TIMER elements
|
||||
|
||||
//Timer to check if the mouse is still inside the ListView
|
||||
|
||||
//Timer to check if the mouse is still outside the dock in order to restore zooms to 1.0
|
||||
Timer{
|
||||
id:checkListHovered
|
||||
id:checkRestoreZoom
|
||||
repeat:false;
|
||||
interval: 150;
|
||||
|
||||
onTriggered: {
|
||||
if(!root.containsMouse()) {
|
||||
if (!dock.visibility.containsMouse || (rootMouseArea.containsMouse && !root.editMode)){
|
||||
if (enableDirectRenderTimer.running)
|
||||
enableDirectRenderTimer.stop();
|
||||
|
||||
root.globalDirectRender = false;
|
||||
root.clearZoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//this timer adds a delay into enabling direct rendering...
|
||||
//it gives the time to neighbour tasks to complete their animation
|
||||
//during first hovering phase
|
||||
Timer {
|
||||
id: enableDirectRenderTimer
|
||||
interval: 4 * root.durationTime * units.shortDuration
|
||||
onTriggered: {
|
||||
if (dock.visibility.containsMouse)
|
||||
root.globalDirectRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//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
|
||||
@ -1823,14 +1795,5 @@ DragDrop.DropArea {
|
||||
}
|
||||
}
|
||||
|
||||
//this timer adds a delay into enabling direct rendering...
|
||||
//it gives the time to neighbour tasks to complete their animation
|
||||
//during first hovering phase
|
||||
Timer {
|
||||
id: enableDirectRenderTimer
|
||||
interval: 4 * root.durationTime * units.shortDuration
|
||||
onTriggered: layoutsContainer.directRender = true;
|
||||
}
|
||||
|
||||
///////////////END TIMER elements
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user