Scripting: Make client.activities writable
Needs ReviewPublic

Authored by tcorreabr on Tue, May 5, 8:53 PM.


Group Reviewers

Allows KWin scripts to change the value of client.activities property.

Diff Detail

R108 KWin
Lint Skipped
Unit Tests Skipped
tcorreabr created this revision.Tue, May 5, 8:53 PM
Restricted Application added a project: KWin. · View Herald TranscriptTue, May 5, 8:53 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
tcorreabr requested review of this revision.Tue, May 5, 8:53 PM
zzag requested changes to this revision.Wed, May 6, 6:51 AM
zzag added a subscriber: zzag.

The Toplevel class contains mostly read-only properties (I wonder whether it's actually worth to put properties in the Toplevel class since Deleted windows are not exposed to scripting). Could you please put Q_PROPERTY(QStringList activities READ activities WRITE setOnActivities NOTIFY activitiesChanged) in the AbstractClient class instead?

This revision now requires changes to proceed.Wed, May 6, 6:51 AM
tcorreabr updated this revision to Diff 82115.Wed, May 6, 3:58 PM

activities property moved from Toplevel to AbstractClient class.

tcorreabr retitled this revision from client.activities write access to scripting: Make client.activities writable.Wed, May 6, 9:05 PM
zzag added inline comments.Thu, May 7, 5:45 AM
244 ↗(On Diff #82115)

Keep it here please. We'll basically override the definition of the activities property in AbstractClient. I know it's a bit weird, but we already do the same thing for the desktop property.

610 ↗(On Diff #82115)

Keep it here please.

tcorreabr updated this revision to Diff 82310.Fri, May 8, 7:57 PM

toplevel.h changes removed.

zzag added inline comments.Sat, May 9, 7:44 AM

It's already declared in the Toplevel class, remove it?

tcorreabr added inline comments.Sun, May 10, 4:29 PM

Initially I had tried without it, but I got this compilation error:

[ 48%] Building CXX object CMakeFiles/kwin.dir/kwin_autogen/mocs_compilation.cpp.o
In file included from /home/tiago/kde/build/kwin/kwin_autogen/mocs_compilation.cpp:2:
/home/tiago/kde/build/kwin/kwin_autogen/EWIEGA46WW/moc_abstract_client.cpp: In function ‘void checkNotifySignalValidity_KWin__AbstractClient(KWin::AbstractClient*)’:
/home/tiago/kde/build/kwin/kwin_autogen/EWIEGA46WW/moc_abstract_client.cpp:1155:26: error: no matching function for call to ‘KWin::AbstractClient::activitiesChanged()’
 1155 |     t->activitiesChanged();
      |                          ^
In file included from /home/tiago/kde/src/kwin/abstract_client.h:24,
                 from /home/tiago/kde/build/kwin/kwin_autogen/EWIEGA46WW/moc_abstract_client.cpp:10,
                 from /home/tiago/kde/build/kwin/kwin_autogen/mocs_compilation.cpp:2:
/home/tiago/kde/src/kwin/toplevel.h:610:10: note: candidate: ‘void KWin::Toplevel::activitiesChanged(KWin::Toplevel*)’
  610 |     void activitiesChanged(KWin::Toplevel* toplevel);
      |          ^~~~~~~~~~~~~~~~~
/home/tiago/kde/src/kwin/toplevel.h:610:10: note:   candidate expects 1 argument, 0 provided
[ 48%] Linking CXX executable ../bin/testScriptedEffectLoader
zzag added inline comments.Mon, May 11, 11:42 AM

Hmm, that's interesting... I'll need some time to think how to resolve this issue.

tcorreabr retitled this revision from scripting: Make client.activities writable to Scripting: Make client.activities writable.Fri, May 15, 7:08 PM
abetts added a subscriber: abetts.Fri, May 22, 6:41 PM

Hey man, can you join our vdg team on Telegram? Here is the link:

We would like to talk about Parachute