2013-05-11 22:20:39 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2013 Kai Uwe Broulik <kde@privat.broulik.de>
|
|
|
|
|
|
|
|
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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
/*global effect, effects, animate, animationTime, Effect, QEasingCurve */
|
|
|
|
var scaleInEffect = {
|
2014-03-10 19:46:41 +00:00
|
|
|
duration: animationTime(150),
|
2013-05-11 22:20:39 +00:00
|
|
|
loadConfig: function () {
|
|
|
|
"use strict";
|
2014-03-10 19:46:41 +00:00
|
|
|
scaleInEffect.duration = animationTime(150);
|
2013-05-11 22:20:39 +00:00
|
|
|
},
|
|
|
|
isScaleWindow: function (window) {
|
|
|
|
"use strict";
|
2013-09-01 10:51:31 +00:00
|
|
|
if (window.popupMenu || window.specialWindow || window.utility || window.minimized ||
|
2013-05-11 22:20:39 +00:00
|
|
|
effect.isGrabbed(window, Effect.WindowAddedGrabRole)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
scaleIn: function (window) {
|
|
|
|
"use strict";
|
2016-10-31 10:22:24 +00:00
|
|
|
window.scaleInWindowTypeAnimation = animate({
|
2013-05-11 22:20:39 +00:00
|
|
|
window: window,
|
|
|
|
duration: scaleInEffect.duration,
|
|
|
|
curve: QEasingCurve.InOutQuad,
|
|
|
|
animations: [{
|
|
|
|
type: Effect.Opacity,
|
|
|
|
from: 0.0,
|
|
|
|
to: 1.0
|
|
|
|
}, {
|
|
|
|
type: Effect.Scale,
|
2014-03-10 19:46:41 +00:00
|
|
|
from: 0.75,
|
2013-05-11 22:20:39 +00:00
|
|
|
to: 1.0
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
},
|
|
|
|
added: function (window) {
|
|
|
|
"use strict";
|
|
|
|
if (!scaleInEffect.isScaleWindow(window)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
scaleInEffect.scaleIn(window);
|
|
|
|
},
|
2016-10-31 10:22:24 +00:00
|
|
|
dataChanged: function (window, role) {
|
|
|
|
"use strict";
|
|
|
|
if (role == Effect.WindowAddedGrabRole) {
|
|
|
|
if (effect.isGrabbed(window, Effect.WindowAddedGrabRole)) {
|
|
|
|
if (window.scaleInWindowTypeAnimation !== undefined) {
|
|
|
|
cancel(window.scaleInWindowTypeAnimation);
|
|
|
|
window.scaleInWindowTypeAnimation = undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-05-11 22:20:39 +00:00
|
|
|
init: function () {
|
|
|
|
"use strict";
|
|
|
|
effect.configChanged.connect(scaleInEffect.loadConfig);
|
|
|
|
effects.windowAdded.connect(scaleInEffect.added);
|
2016-10-31 10:22:24 +00:00
|
|
|
effects.windowDataChanged.connect(scaleInEffect.dataChanged);
|
2013-05-11 22:20:39 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
scaleInEffect.init();
|