Bug 437507 - workspace.clientArea() does not work anymore with a client object as argument
Summary: workspace.clientArea() does not work anymore with a client object as argument
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-05-22 15:30 UTC by Flupp
Modified: 2021-06-07 18:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Flupp 2021-05-22 15:30:02 UTC
Within a KWin script, the method workspace.clientArea() with the overloaded type clientArea(ClientAreaOption,const KWin::AbstractClient*) cannot be called anymore.

Version information: KWin 5.22.80 on KDE Neon unstable (neon-unstable-20210516-0329.iso).

Consider the following example. The respective error messages mentioned in the comments are printed to the console. (With KWin 5.21.5 the script works without errors.)


e = KWin.MaximizeArea;
c = workspace.activeClient;


// succeeding:

r = workspace.clientArea(e, 0, 0);
print("rect:", e, r, r.x, r.y, r.width, r.height);


// failing with:
// kwin_scripting: …/interactiveconsoleautosave.js:17: error: Unable to determine callable overload.  Candidates are:
//     clientArea(ClientAreaOption,const KWin::AbstractClient*)
//     clientArea(ClientAreaOption,QPoint,int)
//     clientArea(ClientAreaOption,int,int)

r = workspace.clientArea(e, c);
print("rect:", e, r, r.x, r.y, r.width, r.height);


// failing with:
// kwin_scripting: …/interactiveconsoleautosave.js:24: error: Property 'clientArea(ClientAreaOption,const KWin::AbstractClient*)' of object KWin::QtScriptWorkspaceWrapper(0x55fa011865f0) is not a function

r = workspace['clientArea(ClientAreaOption,const KWin::AbstractClient*)'](e, c);
print("rect:", e, r, r.x, r.y, r.width, r.height);
Comment 1 Vlad Zahorodnii 2021-06-07 08:18:52 UTC
Can you please provide a test script?
Comment 2 Bug Janitor Service 2021-06-07 17:27:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1077
Comment 3 Vlad Zahorodnii 2021-06-07 18:08:45 UTC
Git commit d4f75f3e64412fe739c590ab976385e6e881e83a by Vlad Zahorodnii.
Committed on 07/06/2021 at 18:08.
Pushed by vladz into branch 'master'.

scripting: Add clientArea() overload that takes mutable client

Even though there is a clientArea() overload that takes const abstract
clients, QJSEngine seems to be unable to find the right clientArea()
overload if a mutable abstract client has been passed.

M  +5    -0    src/scripting/workspace_wrapper.cpp
M  +1    -0    src/scripting/workspace_wrapper.h

https://invent.kde.org/plasma/kwin/commit/d4f75f3e64412fe739c590ab976385e6e881e83a
Comment 4 Vlad Zahorodnii 2021-06-07 18:09:17 UTC
Git commit 44539bce74ad99b476ced6a1c7d0e3a7e6f7f535 by Vlad Zahorodnii.
Committed on 07/06/2021 at 18:09.
Pushed by vladz into branch 'Plasma/5.22'.

scripting: Add clientArea() overload that takes mutable client

Even though there is a clientArea() overload that takes const abstract
clients, QJSEngine seems to be unable to find the right clientArea()
overload if a mutable abstract client has been passed.


(cherry picked from commit d4f75f3e64412fe739c590ab976385e6e881e83a)

M  +5    -0    src/scripting/workspace_wrapper.cpp
M  +1    -0    src/scripting/workspace_wrapper.h

https://invent.kde.org/plasma/kwin/commit/44539bce74ad99b476ced6a1c7d0e3a7e6f7f535