Created
August 1, 2012 03:45
-
-
Save brAzzi64/3223443 to your computer and use it in GitHub Desktop.
Diff with changes that introduce the Slide animation in Compiz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== modified file 'plugins/animation/animation.xml.in' | |
--- plugins/animation/animation.xml.in 2012-05-16 17:40:41 +0000 | |
+++ plugins/animation/animation.xml.in 2012-07-29 23:18:19 +0000 | |
@@ -580,6 +580,33 @@ | |
</subgroup> | |
<subgroup> | |
+ <_short>Slide</_short> | |
+ <option name="slide_direction" type="int"> | |
+ <_short>Slide from</_short> | |
+ <_long>Directon from which the window will slide.</_long> | |
+ <default>0</default> | |
+ <min>0</min> | |
+ <max>3</max> | |
+ <desc> | |
+ <value>0</value> | |
+ <_name>Left</_name> | |
+ </desc> | |
+ <desc> | |
+ <value>1</value> | |
+ <_name>Above</_name> | |
+ </desc> | |
+ <desc> | |
+ <value>2</value> | |
+ <_name>Right</_name> | |
+ </desc> | |
+ <desc> | |
+ <value>3</value> | |
+ <_name>Below</_name> | |
+ </desc> | |
+ </option> | |
+ </subgroup> | |
+ | |
+ <subgroup> | |
<_short>Wave</_short> | |
<option name="wave_width" type="float"> | |
<_short>Wave Width</_short> | |
@@ -727,6 +754,10 @@ | |
<base_option>close_effects</base_option> | |
<base_option>close_random_effects</base_option> | |
<restriction> | |
+ <value>animation:Slide</value> | |
+ <_name>Slide</_name> | |
+ </restriction> | |
+ <restriction> | |
<value>animation:Wave</value> | |
<_name>Wave</_name> | |
</restriction> | |
=== modified file 'plugins/animation/src/animation.cpp' | |
--- plugins/animation/src/animation.cpp 2012-05-25 04:06:13 +0000 | |
+++ plugins/animation/src/animation.cpp 2012-07-29 23:18:19 +0000 | |
@@ -2497,6 +2497,7 @@ | |
AnimEffect AnimEffectMagicLampWavy; | |
AnimEffect AnimEffectRollUp; | |
AnimEffect AnimEffectSidekick; | |
+AnimEffect AnimEffectSlide; | |
AnimEffect AnimEffectWave; | |
AnimEffect AnimEffectZoom; | |
@@ -2633,6 +2634,10 @@ | |
new AnimEffectInfo ("animation:Sidekick", | |
true, true, true, false, false, | |
&createAnimation<SidekickAnim>); | |
+ animEffects[i++] = AnimEffectSlide = | |
+ new AnimEffectInfo ("animation:Slide", | |
+ true, true, true, false, true, | |
+ &createAnimation<SlideAnim>); | |
animEffects[i++] = AnimEffectWave = | |
new AnimEffectInfo ("animation:Wave", | |
true, true, true, false, true, | |
=== modified file 'plugins/animation/src/private.h' | |
--- plugins/animation/src/private.h 2012-05-27 04:32:55 +0000 | |
+++ plugins/animation/src/private.h 2012-07-29 23:18:19 +0000 | |
@@ -86,10 +86,11 @@ | |
extern AnimEffect AnimEffectMagicLampWavy; | |
extern AnimEffect AnimEffectRollUp; | |
extern AnimEffect AnimEffectSidekick; | |
+extern AnimEffect AnimEffectSlide; | |
extern AnimEffect AnimEffectWave; | |
extern AnimEffect AnimEffectZoom; | |
-#define NUM_EFFECTS 16 | |
+#define NUM_EFFECTS 17 | |
extern int customOptionOptionIds[AnimEventNum]; | |
@@ -505,6 +506,19 @@ | |
bool requiresTransformedWindow () const { return true; } | |
}; | |
+class SlideAnim : | |
+ public TransformAnim | |
+{ | |
+public: | |
+ SlideAnim (CompWindow *w, | |
+ WindowEvent curWindowEvent, | |
+ float duration, | |
+ const AnimEffect info, | |
+ const CompRect &icon); | |
+protected: | |
+ void applyTransform (); | |
+}; | |
+ | |
class WaveAnim : | |
public GridTransformAnim | |
{ | |
=== added file 'plugins/animation/src/slide.cpp' | |
--- plugins/animation/src/slide.cpp 1970-01-01 00:00:00 +0000 | |
+++ plugins/animation/src/slide.cpp 2012-07-29 23:18:19 +0000 | |
@@ -0,0 +1,62 @@ | |
+/* | |
+ * Animation plugin for compiz/beryl | |
+ * | |
+ * slide.cpp | |
+ * | |
+ * 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, write to the Free Software | |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
+ */ | |
+ | |
+#include "private.h" | |
+ | |
+// ===================== Effect: Slide ========================= | |
+ | |
+void | |
+SlideAnim::applyTransform () | |
+{ | |
+ float amountX = 0.0f; | |
+ float amountY = 0.0f; | |
+ | |
+ int dir = optValI (AnimationOptions::SlideDirection); | |
+ switch (dir) | |
+ { | |
+ case AnimationOptions::SlideDirectionLeft: | |
+ amountX = ( mWindow->borderRect().width() + mWindow->borderRect().x() ) * -progressLinear(); | |
+ break; | |
+ case AnimationOptions::SlideDirectionAbove: | |
+ amountY = ( mWindow->borderRect().height() + mWindow->borderRect().y() ) * -progressLinear(); | |
+ break; | |
+ case AnimationOptions::SlideDirectionRight: | |
+ amountX = ( ::screen->width() - mWindow->borderRect().x() ) * progressLinear(); | |
+ break; | |
+ case AnimationOptions::SlideDirectionBelow: | |
+ amountY = ( ::screen->height() - mWindow->borderRect().y() ) * progressLinear(); | |
+ break; | |
+ default: | |
+ break; | |
+ } | |
+ | |
+ mTransform.translate (amountX, amountY, 0.0f); | |
+} | |
+ | |
+SlideAnim::SlideAnim (CompWindow *w, | |
+ WindowEvent curWindowEvent, | |
+ float duration, | |
+ const AnimEffect info, | |
+ const CompRect &icon) : | |
+ Animation::Animation (w, curWindowEvent, duration, info, icon), | |
+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon) | |
+{ | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment