Bug 488898 - Scripting: API Reports non-primary monitor as output, breaking Polonium KWin script
Summary: Scripting: API Reports non-primary monitor as output, breaking Polonium KWin ...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: Quick Tiling (show other bugs)
Version: 6.1.0
Platform: Arch Linux Linux
: HI normal
Target Milestone: ---
Assignee: Alik Aslanyan
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-06-21 14:26 UTC by Alik Aslanyan
Modified: 2024-06-26 01:25 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alik Aslanyan 2024-06-21 14:26:44 UTC
SUMMARY


STEPS TO REPRODUCE
1. Install KWin 6.10 and Polonium 6 (515f6990c848d935c56de5e12cec74ca4aab1baf)
2. Open Plasma (Wayland) session
3. Reproduced on 1080p and 1440p (primary) monitors.
4. Open any Window on 1440p monitor.

OBSERVED RESULT

Window is teleported to the non-primary 1080p monitor. As `window.output` property in KWin Scripting API contains 1080p monitor output, instead of 1440p monitor output.

EXPECTED RESULT

Window is behaving as on KWin 6.05 (opens on the same monitor).

SOFTWARE/OS VERSIONS


Linux/KDE Plasma: Arch Linux KDE Plasma 6.1
(available in About System)
KDE Plasma Version: 6.10
KDE Frameworks Version: 6.30 
Qt Version: 6.7.1

ADDITIONAL INFORMATION

Manually bisecting this issue points to commit

commit 52b92904dead8dedd8134d532f507e6f5bc78958 (HEAD -> bad-commit)
Author: Marco Martin <notmart@gmail.com>
Date:   Mon Apr 15 12:18:09 2024 +0000

    Quick tiling double buffereing
    
    The quicktileMode member now is just for the requested tile mode, base the "real" mode only on m_tile.
    
    The requested tile mode is used for double buffering, to look and behave just like requestedMAximizeMode() which is updated immediately, but needs to acknowledge the configure request and render for quickTileMode() (and the right tile() instanced to be associated) to be updated accordingly

 autotests/integration/move_resize_window_test.cpp |  27 ++++++++++---
 autotests/integration/quick_tiling_test.cpp       | 125 +++++++++++++++++++++++++++++++++++++++--------------------
 src/placementtracker.cpp                          |   4 +-
 src/tiles/quicktile.cpp                           |   4 ++
 src/tiles/tile.cpp                                |   6 ++-
 src/tiles/tilemanager.cpp                         |   6 +++
 src/tiles/tilemanager.h                           |   3 ++
 src/window.cpp                                    |  91 ++++++++++++++++++++++++++++++-------------
 src/window.h                                      |  15 +++----
 src/x11window.cpp                                 |  10 ++++-
 src/x11window.h                                   |   1 +
 src/xdgshellwindow.cpp                            |  35 ++++++++++++-----
 12 files changed, 228 insertions(+), 99 deletions(-)
Comment 1 Alik Aslanyan 2024-06-21 15:02:24 UTC
Bisecting https://invent.kde.org/plasma/kwin/-/merge_requests/5532 shows that bug is present from first commit 



12226a891f8d2c77116cbaf9b97bde63b2af610e is the first bad commit
commit 12226a891f8d2c77116cbaf9b97bde63b2af610e (HEAD)
Author: Marco Martin <notmart@gmail.com>
Date:   Thu Mar 14 13:28:26 2024 +0100

    Remove m_quickTileMode and base only on tiles
    
    This removes the tracking member and uses the tile information, removing a duplication of data and source of truth

 src/window.cpp | 48 ++++++++++++++++++++++++++++++++++--------------
 src/window.h   | 12 ++----------
 2 files changed, 36 insertions(+), 24 deletions(-)
Comment 2 Bug Janitor Service 2024-06-22 14:10:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5960
Comment 3 Vlad Zahorodnii 2024-06-25 06:15:11 UTC
Git commit 47ee47dcc82bc38daf22d7fcf03fe0d35e3afe16 by Vlad Zahorodnii, on behalf of Alik Aslanyan.
Committed on 25/06/2024 at 05:59.
Pushed by vladz into branch 'master'.

tiling: Add fallback path for the first Polonium tile

After !5532 a new code path was triggered during Workspace::rearrange call.
When first Polonium window opens on any screen, there is no active tile yet.
This forces geometry calculation in Window::checkWorkspacePosition -> Window::ensureSpecialStateGeometry
To return empty QRect, which depending on the screen arrangement will move window to the other screen.

This confuses Polonium plugin, as it receives wrong outputChanged signal in scripting API.
Signed-off-by: Alik Aslanyan <inline0@pm.me>

M  +0    -2    src/window.cpp

https://invent.kde.org/plasma/kwin/-/commit/47ee47dcc82bc38daf22d7fcf03fe0d35e3afe16
Comment 4 Vlad Zahorodnii 2024-06-25 07:23:09 UTC
Git commit 7578f70b404acbceb53b057e8c483926badf7e21 by Vlad Zahorodnii, on behalf of Alik Aslanyan.
Committed on 25/06/2024 at 06:34.
Pushed by vladz into branch 'Plasma/6.1'.

tiling: Add fallback path for the first Polonium tile

After !5532 a new code path was triggered during Workspace::rearrange call.
When first Polonium window opens on any screen, there is no active tile yet.
This forces geometry calculation in Window::checkWorkspacePosition -> Window::ensureSpecialStateGeometry
To return empty QRect, which depending on the screen arrangement will move window to the other screen.

This confuses Polonium plugin, as it receives wrong outputChanged signal in scripting API.
Signed-off-by: Alik Aslanyan <inline0@pm.me>
(cherry picked from commit 47ee47dcc82bc38daf22d7fcf03fe0d35e3afe16)

M  +0    -2    src/window.cpp

https://invent.kde.org/plasma/kwin/-/commit/7578f70b404acbceb53b057e8c483926badf7e21