Commit graph

24 commits

Author SHA1 Message Date
Vlad Zahorodnii
55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
Albert Astals Cid
e144748c7a Add some const &
Summary:
Won't make things go much faster since everything that was
being passed by value is refcounted but still const & is a bit faster
than refcounting

For shared pointers instead of adding const & we move them into the
destination variable saving some cpu usage but at the same time making
clear the pointer is being stored by not being const &

Reviewers: zzag

Reviewed By: zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25022
2019-10-30 19:23:01 +01:00
Vlad Zahorodnii
f93875535c Update my last name 2019-09-29 17:03:25 +03:00
Vlad Zagorodniy
5e104fbc12 [scripting] Introduce redirect function
Summary:
Consider current implementation of the Squash effect: if a window was
minimized, an animation will be started; if the window is unminimized
and the animation is still active (that can happen when user clicks on
app's icon really fast), the animation will be stopped and a new one will
be created. Such behavior can lead to rapid jumps in the observed
"animation".

A better approach would be first try to **reverse** the already active
animation, and if that attempt wasn't successful, start a new animation.

This patch introduces a new function to the scripted effects API that
lets JavaScript effects to control direction of animations. The
prototype of the function looks as follows:

    redirect(<animation id(s)>, <direction>, [<termination policy>])

the first argument is an animation id or a list of animation ids, the
second argument specifies the new direction of the animation or
animations if a list of ids was passed as the first argument. The
third argument specifies whether the animation(s) should be terminated
when it(they) reaches the source position, currently it's relevant only
for animations that are created with set() function. The termination
policy argument is optional, by default it's Effect.TerminateAtSource.

We can use this function to fix issues with rapid jumps in the Squash
effect. Also, redirect() lets us to write effects for simple animations
in slightly different style: first, we have to start the main animation
(e.g. for the Dialog Parent effect, it would be dimming of main windows)
and then change direction of the animation depending on external events,
e.g. when the Desktop Cube effect is activated.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16449
2018-11-17 13:44:16 +02:00
Vlad Zagorodniy
ee72569647 [libkwineffects] Port AnimationEffect to TimeLine
Summary:
TimeLine has nice API for controlling its direction that can be re-used
later by AnimationEffect.

Test Plan: The existing tests for scripting effects still pass.

Reviewers: #kwin, davidedmundson, graesslin

Reviewed By: #kwin, davidedmundson, graesslin

Subscribers: davidedmundson, abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16448
2018-11-17 13:43:57 +02:00
Vlad Zagorodniy
688d946ffb [libkwineffects] Gracefully release previous window pixmap
Summary:
If the cross fade animation is cancelled, we are not gracefully
unreference the previous window pixmap.

This change addresses that issue by using RAII approach to
reference/unreference the previous window pixmap.

Test Plan: Manually. The Maximize and the Morphing Popups effect still work.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16391
2018-11-12 12:51:08 +02:00
Vlad Zagorodniy
7b19fa87d0 [libkwineffects] Delete unused field in AniData
Summary: windowType is not used anywhere so delete it.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16389
2018-10-23 18:25:44 +03:00
Vlad Zagorodniy
655d8af8be [libkwineffects] Delete unused constant
Summary:
The constant is a leftover after
2569768074.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16373
2018-10-22 18:27:22 +03:00
Vlad Zagorodniy
a281f2bce1 [effects/dialogparent] Fix flickering of parent windows
Summary:
If a modal window is closed and some alternative effect that animates
the disappearing of windows is enabled(e.g. the Glide effect, or the
Scale effect), the Dialog Parent effect can cause flickering of the
parent window because its animation duration doesn't match duration of
those alternative effects.

Also, if the Fade effect, the Glide effect, and the Scale effect are
disabled, the Dialog Parent will keep the parent window alive for no
good reason.

This change addresses that problem by adding keepAlive property to
`animate` function so scripted effects have more control over lifetime
of animated windows.

If both a modal window and its parent window are closed at the same time
(and there is no effect that animates the disappearing of windows), the
Dialog Parent will stop immediately(because windowDeleted will be
emitted right after windowClosed signal).

If both a modal window and its parent window are closed at the same time
(and there is effect that animates the disappearing of windows), the
Dialog Parent won't reference the latter window. Thus, it won't cause
flickering. I.e. it will "passively" animate parent windows.

BUG: 355036
FIXED-IN: 5.15.0

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14919
2018-10-10 18:34:12 +03:00
Vlad Zagorodniy
2569768074 [libkwineffects] Drop AniData constructor that receives QString
Summary:
This code has several bugs, it's untested, it's not used anywhere, it
adds unnecessary complexity -> delete it.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16099
2018-10-10 12:57:07 +03:00
Vlad Zagorodniy
5d5816be2b [libkwineffects] Don't expose the fullscreen effect lock to the public API
Summary:
The fullscreen effect lock is purely an implementation detail of the
AnimationEffect, we don't need to have it in the public API.

Test Plan: KWin still compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16075
2018-10-09 19:06:04 +03:00
David Edmundson
99b33e7428 [libkwineffects] Expose getting/setting activeFullScript to scripted effects
Summary:
Getter is exposed as a property on scripted effect in a way that hides
pointers from the scripting side.

Setter is implicitly handled as a property of newly created animations
and holds the activeFullScreenEffect whilst any of them are active. Like
existing effects it remains up to the effect author to avoid the
problems of multiple full screen effects. The RAII lock pattern is
somewhat overkill currently, but it's the direction I hope we can take
EffectsHandler in next API break.

BUG: 396790

--

This patch is against the QJSEngine port, though it's not conceptually a
requirement.

Test Plan: Unit test

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14688
2018-10-04 00:57:44 +03:00
David Edmundson
7b65aa9199 [libkwineffects] Remove broken copy constructor of AniData
This doesn't copy everything, it misses the ID which breaks
everything.

Given it's just a direct copy of members the auto-generated one does a
better job
2018-07-31 12:29:00 +01:00
Nick Shaforostoff
3a8d7d866a optimize string operations
-use qstringliteral only when necessary (i.e. not in concat or comparison)
-use qbytearray instead of qstring when dealing with latin1 input and output (glplatform)
-use qstringref to extract numbers from strings (glplatform)
-define qt_use_qstringbuilder to optimize all string concatenations
-anidata: use ctor init lists, add windowType member initialization

REVIEW: 125933
2015-11-05 14:14:06 +00:00
Martin Gräßlin
57c521c214 [libkwineffects] Introduce logging categories for libkwineffects 2015-07-31 12:16:15 +02:00
Volker Krause
5db2d5a556 Make constants const, saves a few symbols in the .data section. 2014-09-27 20:30:49 +02:00
Martin Gräßlin
99bcac1cc7 Port libkwineffects away from KDebug
And with that it doesn't need kde4support anymore.
2013-09-02 10:43:55 +02:00
Martin Gräßlin
330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Jaime Torres
4ec0f64ea3 initialize a member and initialize a boolean
one less valgrind warning and one cppcheck warning less

REVIEW: 107603
2013-04-29 18:14:50 +02:00
Thomas Lübking
ee1d6d568d add effect debug interface and dbus export
allows for effect specific debugging details

REVIEW: 107063
2013-03-28 20:31:02 +01:00
Thomas Lübking
39499de9cc add AnimationEffect::set() and ::cancel()
This will allow to sue the AnimationEffect class for
(temorarily) persistent changes like required by the
translucency effect

REVIEW: 109211
2013-03-05 19:24:30 +01:00
Thomas Lübking
7bc5832429 use QELapsedTimer to measure animation delay
QElapsedTimer uses a monotic clock on all relevant systems
and is thus invarant against date/time changes (while the
bug was likely caused by daybreaks)

BUG: 306186
REVIEW: 107250
FIXED-IN: 4.10

use monitc clock
2012-11-14 21:16:32 +01:00
Thomas Lübking
41a39a9928 add clipping support to AnimationEffect
REVIEW: 104898
2012-05-10 19:35:13 +02:00
Thomas Lübking
67e79ea13a Add AnimationEffect class
REVIEW: 102922
2011-10-27 21:40:14 +02:00