[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Review Request: JavaScript bindings for KWin Effects
From:       Martin_Gräßlin <kde () martin-graesslin ! com>
Date:       2012-01-29 18:36:55
Message-ID: 20120129183655.17527.7364 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Jan. 29, 2012, 5:09 p.m., Thomas Lübking wrote:
> > For a quick first look, there seems no binding for the onedimensional animation \
> > source (ie. you cannot script the opacity from 10% to 100% but for using the \
> > from1/from2 variant) 
> > In general it will likely be interesting to have three variants of all types, \
> > because if either from or to FPx2 are not valid (FPx2()) the actual current value \
> > will be used (so you can omit the "to" position value and have a window slide in) \
> >                 
> > -> preproc scripts with somehow sane ordering to lower LOC ;-)
> > 
> > #define ANIMATION_SCRIPT_FROM(_TYPE_) \
> > void ScriptedEffect::animate(EffectWindow *w, Attribute a, _TYPE_ from, int ms, \
> > uint meta, QEasingCurve curve, int delay)\ { AnimationEffect::animate(w, a, meta, \
> > ms, FPx2(), curve, delay, from); } 
> > #define ANIMATION_SCRIPT_TO(_TYPE_) \
> > void ScriptedEffect::animate(EffectWindow *w, Attribute a, int ms, uint meta, \
> > QEasingCurve curve, int delay, _TYPE_ to)\ { AnimationEffect::animate(w, a, meta, \
> > ms, to, curve, delay, FPx2()); } 
> > #define ANIMATION_SCRIPT_FROM_TO(_TYPE_) \
> > void ScriptedEffect::animate(EffectWindow *w, Attribute a, _TYPE_ from, int ms, \
> > uint meta, QEasingCurve curve, int delay, _TYPE_ to)\ { \
> > AnimationEffect::animate(w, a, meta, ms, to, curve, delay, from); } 
> > ANIMATION_SCRIPT_FROM(float)
> > ANIMATION_SCRIPT_TO(float)
> > ANIMATION_SCRIPT_FROM_TO(float)
> > 
> > ANIMATION_SCRIPT_FROM(QPoint)
> > ANIMATION_SCRIPT_TO(QPoint)
> > ANIMATION_SCRIPT_FROM_TO(QPoint)
> > 
> > ...
> > 
> > Another thing would be to export at least the setMeta() function or provide some \
> > other simplification. The meta value carries various things like the anchor, the \
> > rotation axis, etc. - but esp. to server as wildcard for generic animation \
> > implementations, it's just a 32bit filed. So either the script author has access \
> > to the documentation and understands how to set bits (and which one) or he's got \
> > one or more handy functions for at least limited but easy setting.

ok seems like I have to add bindings for FPx2. Should not be that difficult...

Concerning meta I actually did not really understand it (but also did not read the \
documentation). So yes the setMeta is needed.


- Martin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103823/#review10199
-----------------------------------------------------------


On Jan. 29, 2012, 4:41 p.m., Martin Gräßlin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103823/
> -----------------------------------------------------------
> 
> (Updated Jan. 29, 2012, 4:41 p.m.)
> 
> 
> Review request for kwin.
> 
> 
> Description
> -------
> 
> The bindings are based on AnimationEffect. So Thomas please have a look whether I \
> use it correctly :-) The method is exported multiple times as I did not want to \
> wrap the FPx2 class. 
> An example script for fade effect:
> var duration = 250;
> effects.windowAdded.connect(function(w) {
> effect.animate(w, Effect.Opacity, duration, 1.0);
> });
> effects.windowClosed.connect(function(w) {
> effect.animate(w, Effect.Opacity, duration, 0.0, 1.0);
> });
> 
> There is quite some work to be done. EffectWindow does not yet have properties, for \
> EffectsHandler probably some more methods might be exported. 
> Unfortunately I had to change the signature of the signals as QtScript needs the \
> type being exported as a metatype and metatypes want full name. 
> 
> Diffs
> -----
> 
> kwin/CMakeLists.txt c4b75c0 
> kwin/effects.h 28ab72c 
> kwin/effects.cpp 4f55799 
> kwin/effects/blur/blur.h 65ba381 
> kwin/effects/blur/blur.cpp 06c6854 
> kwin/effects/boxswitch/boxswitch.h cfb6b47 
> kwin/effects/boxswitch/boxswitch.cpp fac6b3f 
> kwin/effects/coverswitch/coverswitch.h b49a36e 
> kwin/effects/coverswitch/coverswitch.cpp bdf2fbe 
> kwin/effects/cube/cubeslide.h ffbda88 
> kwin/effects/cube/cubeslide.cpp ed1f518 
> kwin/effects/dashboard/dashboard.h 46d3e98 
> kwin/effects/dashboard/dashboard.cpp 4f6dc65 
> kwin/effects/desktopgrid/desktopgrid.h b420389 
> kwin/effects/desktopgrid/desktopgrid.cpp 925d2f1 
> kwin/effects/dialogparent/dialogparent.h 439c67e 
> kwin/effects/dialogparent/dialogparent.cpp ac9493a 
> kwin/effects/diminactive/diminactive.h 24a80de 
> kwin/effects/diminactive/diminactive.cpp 6978f36 
> kwin/effects/dimscreen/dimscreen.h ee8c114 
> kwin/effects/dimscreen/dimscreen.cpp fd4c15a 
> kwin/effects/explosion/explosion.h 8a343c7 
> kwin/effects/explosion/explosion.cpp dc9cd14 
> kwin/effects/fade/fade.h 38c0040 
> kwin/effects/fade/fade.cpp 213516b 
> kwin/effects/fallapart/fallapart.h acc1446 
> kwin/effects/fallapart/fallapart.cpp 5db5ee7 
> kwin/effects/flipswitch/flipswitch.h 559e88b 
> kwin/effects/flipswitch/flipswitch.cpp f7f4307 
> kwin/effects/glide/glide.h 0003345 
> kwin/effects/glide/glide.cpp 99a8c8b 
> kwin/effects/highlightwindow/highlightwindow.h 8b46bd4 
> kwin/effects/highlightwindow/highlightwindow.cpp f048cfb 
> kwin/effects/invert/invert.h 3dc49fb 
> kwin/effects/invert/invert.cpp 0ef1545 
> kwin/effects/login/login.h db30044 
> kwin/effects/login/login.cpp a9da287 
> kwin/effects/logout/logout.h f08152f 
> kwin/effects/logout/logout.cpp 4e97ebe 
> kwin/effects/magiclamp/magiclamp.h 8000081 
> kwin/effects/magiclamp/magiclamp.cpp f7f73b4 
> kwin/effects/minimizeanimation/minimizeanimation.h 27e0dd3 
> kwin/effects/minimizeanimation/minimizeanimation.cpp 44d15ec 
> kwin/effects/presentwindows/presentwindows.h 08aa262 
> kwin/effects/presentwindows/presentwindows.cpp dc4d5c5 
> kwin/effects/resize/resize.h 0411d6d 
> kwin/effects/resize/resize.cpp 84bdd7f 
> kwin/effects/scalein/scalein.h 8ae7504 
> kwin/effects/scalein/scalein.cpp 25d78df 
> kwin/effects/screenshot/screenshot.h 22385a3 
> kwin/effects/screenshot/screenshot.cpp 6bd18e3 
> kwin/effects/sheet/sheet.h 7ec739b 
> kwin/effects/sheet/sheet.cpp 9156f0d 
> kwin/effects/slideback/slideback.h 0cba556 
> kwin/effects/slideback/slideback.cpp 380b3d5 
> kwin/effects/slidingpopups/slidingpopups.h eca9e2e 
> kwin/effects/slidingpopups/slidingpopups.cpp 8fb0608 
> kwin/effects/snaphelper/snaphelper.h ee60f8f 
> kwin/effects/snaphelper/snaphelper.cpp a30cc60 
> kwin/effects/taskbarthumbnail/taskbarthumbnail.h 77e5294 
> kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp 1ce6233 
> kwin/effects/thumbnailaside/thumbnailaside.h 323e2fd 
> kwin/effects/thumbnailaside/thumbnailaside.cpp 3a1b4e0 
> kwin/effects/translucency/translucency.h fa7b85c 
> kwin/effects/translucency/translucency.cpp 4e6d58d 
> kwin/effects/windowgeometry/windowgeometry.h ba20c05 
> kwin/effects/windowgeometry/windowgeometry.cpp a9fd796 
> kwin/effects/wobblywindows/wobblywindows.h d4844d3 
> kwin/effects/wobblywindows/wobblywindows.cpp c7d30fe 
> kwin/libkwineffects/kwinanimationeffect.h 106155c 
> kwin/libkwineffects/kwinanimationeffect.cpp 00a7887 
> kwin/libkwineffects/kwineffects.h 491ec58 
> kwin/scripting/scriptedeffect.h PRE-CREATION 
> kwin/scripting/scriptedeffect.cpp PRE-CREATION 
> 
> Diff: http://git.reviewboard.kde.org/r/103823/diff/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Martin Gräßlin
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/103823/">http://git.reviewboard.kde.org/r/103823/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On January 29th, 2012, 5:09 p.m., <b>Thomas \
Lübking</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">For a quick first look, there seems no binding for the onedimensional \
animation source (ie. you cannot script the opacity from 10% to 100% but for using \
the from1/from2 variant)

In general it will likely be interesting to have three variants of all types, because \
if either from or to FPx2 are not valid (FPx2()) the actual current value will be \
used (so you can omit the &quot;to&quot; position value and have a window slide in)

-&gt; preproc scripts with somehow sane ordering to lower LOC ;-)

#define ANIMATION_SCRIPT_FROM(_TYPE_) \
void ScriptedEffect::animate(EffectWindow *w, Attribute a, _TYPE_ from, int ms, uint \
meta, QEasingCurve curve, int delay)\ { AnimationEffect::animate(w, a, meta, ms, \
FPx2(), curve, delay, from); }

#define ANIMATION_SCRIPT_TO(_TYPE_) \
void ScriptedEffect::animate(EffectWindow *w, Attribute a, int ms, uint meta, \
QEasingCurve curve, int delay, _TYPE_ to)\ { AnimationEffect::animate(w, a, meta, ms, \
to, curve, delay, FPx2()); }

#define ANIMATION_SCRIPT_FROM_TO(_TYPE_) \
void ScriptedEffect::animate(EffectWindow *w, Attribute a, _TYPE_ from, int ms, uint \
meta, QEasingCurve curve, int delay, _TYPE_ to)\ { AnimationEffect::animate(w, a, \
meta, ms, to, curve, delay, from); }

ANIMATION_SCRIPT_FROM(float)
ANIMATION_SCRIPT_TO(float)
ANIMATION_SCRIPT_FROM_TO(float)

ANIMATION_SCRIPT_FROM(QPoint)
ANIMATION_SCRIPT_TO(QPoint)
ANIMATION_SCRIPT_FROM_TO(QPoint)

...

Another thing would be to export at least the setMeta() function or provide some \
other simplification. The meta value carries various things like the anchor, the \
rotation axis, etc. - but esp. to server as wildcard for generic animation \
implementations, it&#39;s just a 32bit filed. So either the script author has access \
to the documentation and understands how to set bits (and which one) or he&#39;s got \
one or more handy functions for at least limited but easy setting.</pre>  \
</blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">ok seems like I have to \
add bindings for FPx2. Should not be that difficult...

Concerning meta I actually did not really understand it (but also did not read the \
documentation). So yes the setMeta is needed.</pre> <br />








<p>- Martin</p>


<br />
<p>On January 29th, 2012, 4:41 p.m., Martin Gräßlin wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kwin.</div>
<div>By Martin Gräßlin.</div>


<p style="color: grey;"><i>Updated Jan. 29, 2012, 4:41 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">The bindings are based on AnimationEffect. So Thomas please have a look \
whether I use it correctly :-) The method is exported multiple times as I did not \
want to wrap the FPx2 class.

An example script for fade effect:
var duration = 250;
effects.windowAdded.connect(function(w) {
    effect.animate(w, Effect.Opacity, duration, 1.0);
});
effects.windowClosed.connect(function(w) {
    effect.animate(w, Effect.Opacity, duration, 0.0, 1.0);
});

There is quite some work to be done. EffectWindow does not yet have properties, for \
EffectsHandler probably some more methods might be exported.

Unfortunately I had to change the signature of the signals as QtScript needs the type \
being exported as a metatype and metatypes want full name.</pre>  </td>
 </tr>
</table>





<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/CMakeLists.txt <span style="color: grey">(c4b75c0)</span></li>

 <li>kwin/effects.h <span style="color: grey">(28ab72c)</span></li>

 <li>kwin/effects.cpp <span style="color: grey">(4f55799)</span></li>

 <li>kwin/effects/blur/blur.h <span style="color: grey">(65ba381)</span></li>

 <li>kwin/effects/blur/blur.cpp <span style="color: grey">(06c6854)</span></li>

 <li>kwin/effects/boxswitch/boxswitch.h <span style="color: \
grey">(cfb6b47)</span></li>

 <li>kwin/effects/boxswitch/boxswitch.cpp <span style="color: \
grey">(fac6b3f)</span></li>

 <li>kwin/effects/coverswitch/coverswitch.h <span style="color: \
grey">(b49a36e)</span></li>

 <li>kwin/effects/coverswitch/coverswitch.cpp <span style="color: \
grey">(bdf2fbe)</span></li>

 <li>kwin/effects/cube/cubeslide.h <span style="color: grey">(ffbda88)</span></li>

 <li>kwin/effects/cube/cubeslide.cpp <span style="color: grey">(ed1f518)</span></li>

 <li>kwin/effects/dashboard/dashboard.h <span style="color: \
grey">(46d3e98)</span></li>

 <li>kwin/effects/dashboard/dashboard.cpp <span style="color: \
grey">(4f6dc65)</span></li>

 <li>kwin/effects/desktopgrid/desktopgrid.h <span style="color: \
grey">(b420389)</span></li>

 <li>kwin/effects/desktopgrid/desktopgrid.cpp <span style="color: \
grey">(925d2f1)</span></li>

 <li>kwin/effects/dialogparent/dialogparent.h <span style="color: \
grey">(439c67e)</span></li>

 <li>kwin/effects/dialogparent/dialogparent.cpp <span style="color: \
grey">(ac9493a)</span></li>

 <li>kwin/effects/diminactive/diminactive.h <span style="color: \
grey">(24a80de)</span></li>

 <li>kwin/effects/diminactive/diminactive.cpp <span style="color: \
grey">(6978f36)</span></li>

 <li>kwin/effects/dimscreen/dimscreen.h <span style="color: \
grey">(ee8c114)</span></li>

 <li>kwin/effects/dimscreen/dimscreen.cpp <span style="color: \
grey">(fd4c15a)</span></li>

 <li>kwin/effects/explosion/explosion.h <span style="color: \
grey">(8a343c7)</span></li>

 <li>kwin/effects/explosion/explosion.cpp <span style="color: \
grey">(dc9cd14)</span></li>

 <li>kwin/effects/fade/fade.h <span style="color: grey">(38c0040)</span></li>

 <li>kwin/effects/fade/fade.cpp <span style="color: grey">(213516b)</span></li>

 <li>kwin/effects/fallapart/fallapart.h <span style="color: \
grey">(acc1446)</span></li>

 <li>kwin/effects/fallapart/fallapart.cpp <span style="color: \
grey">(5db5ee7)</span></li>

 <li>kwin/effects/flipswitch/flipswitch.h <span style="color: \
grey">(559e88b)</span></li>

 <li>kwin/effects/flipswitch/flipswitch.cpp <span style="color: \
grey">(f7f4307)</span></li>

 <li>kwin/effects/glide/glide.h <span style="color: grey">(0003345)</span></li>

 <li>kwin/effects/glide/glide.cpp <span style="color: grey">(99a8c8b)</span></li>

 <li>kwin/effects/highlightwindow/highlightwindow.h <span style="color: \
grey">(8b46bd4)</span></li>

 <li>kwin/effects/highlightwindow/highlightwindow.cpp <span style="color: \
grey">(f048cfb)</span></li>

 <li>kwin/effects/invert/invert.h <span style="color: grey">(3dc49fb)</span></li>

 <li>kwin/effects/invert/invert.cpp <span style="color: grey">(0ef1545)</span></li>

 <li>kwin/effects/login/login.h <span style="color: grey">(db30044)</span></li>

 <li>kwin/effects/login/login.cpp <span style="color: grey">(a9da287)</span></li>

 <li>kwin/effects/logout/logout.h <span style="color: grey">(f08152f)</span></li>

 <li>kwin/effects/logout/logout.cpp <span style="color: grey">(4e97ebe)</span></li>

 <li>kwin/effects/magiclamp/magiclamp.h <span style="color: \
grey">(8000081)</span></li>

 <li>kwin/effects/magiclamp/magiclamp.cpp <span style="color: \
grey">(f7f73b4)</span></li>

 <li>kwin/effects/minimizeanimation/minimizeanimation.h <span style="color: \
grey">(27e0dd3)</span></li>

 <li>kwin/effects/minimizeanimation/minimizeanimation.cpp <span style="color: \
grey">(44d15ec)</span></li>

 <li>kwin/effects/presentwindows/presentwindows.h <span style="color: \
grey">(08aa262)</span></li>

 <li>kwin/effects/presentwindows/presentwindows.cpp <span style="color: \
grey">(dc4d5c5)</span></li>

 <li>kwin/effects/resize/resize.h <span style="color: grey">(0411d6d)</span></li>

 <li>kwin/effects/resize/resize.cpp <span style="color: grey">(84bdd7f)</span></li>

 <li>kwin/effects/scalein/scalein.h <span style="color: grey">(8ae7504)</span></li>

 <li>kwin/effects/scalein/scalein.cpp <span style="color: grey">(25d78df)</span></li>

 <li>kwin/effects/screenshot/screenshot.h <span style="color: \
grey">(22385a3)</span></li>

 <li>kwin/effects/screenshot/screenshot.cpp <span style="color: \
grey">(6bd18e3)</span></li>

 <li>kwin/effects/sheet/sheet.h <span style="color: grey">(7ec739b)</span></li>

 <li>kwin/effects/sheet/sheet.cpp <span style="color: grey">(9156f0d)</span></li>

 <li>kwin/effects/slideback/slideback.h <span style="color: \
grey">(0cba556)</span></li>

 <li>kwin/effects/slideback/slideback.cpp <span style="color: \
grey">(380b3d5)</span></li>

 <li>kwin/effects/slidingpopups/slidingpopups.h <span style="color: \
grey">(eca9e2e)</span></li>

 <li>kwin/effects/slidingpopups/slidingpopups.cpp <span style="color: \
grey">(8fb0608)</span></li>

 <li>kwin/effects/snaphelper/snaphelper.h <span style="color: \
grey">(ee60f8f)</span></li>

 <li>kwin/effects/snaphelper/snaphelper.cpp <span style="color: \
grey">(a30cc60)</span></li>

 <li>kwin/effects/taskbarthumbnail/taskbarthumbnail.h <span style="color: \
grey">(77e5294)</span></li>

 <li>kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp <span style="color: \
grey">(1ce6233)</span></li>

 <li>kwin/effects/thumbnailaside/thumbnailaside.h <span style="color: \
grey">(323e2fd)</span></li>

 <li>kwin/effects/thumbnailaside/thumbnailaside.cpp <span style="color: \
grey">(3a1b4e0)</span></li>

 <li>kwin/effects/translucency/translucency.h <span style="color: \
grey">(fa7b85c)</span></li>

 <li>kwin/effects/translucency/translucency.cpp <span style="color: \
grey">(4e6d58d)</span></li>

 <li>kwin/effects/windowgeometry/windowgeometry.h <span style="color: \
grey">(ba20c05)</span></li>

 <li>kwin/effects/windowgeometry/windowgeometry.cpp <span style="color: \
grey">(a9fd796)</span></li>

 <li>kwin/effects/wobblywindows/wobblywindows.h <span style="color: \
grey">(d4844d3)</span></li>

 <li>kwin/effects/wobblywindows/wobblywindows.cpp <span style="color: \
grey">(c7d30fe)</span></li>

 <li>kwin/libkwineffects/kwinanimationeffect.h <span style="color: \
grey">(106155c)</span></li>

 <li>kwin/libkwineffects/kwinanimationeffect.cpp <span style="color: \
grey">(00a7887)</span></li>

 <li>kwin/libkwineffects/kwineffects.h <span style="color: \
grey">(491ec58)</span></li>

 <li>kwin/scripting/scriptedeffect.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>kwin/scripting/scriptedeffect.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/103823/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic