Bug 351687 - Desktop grid expands onto other screens during zoom-in animation
Summary: Desktop grid expands onto other screens during zoom-in animation
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-desktop-grid (show other bugs)
Version: 5.19.5
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-24 10:36 UTC by Victor Tran
Modified: 2021-10-18 17:00 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Tran 2015-08-24 10:36:07 UTC
When the 'Desktop Grid' effect ends and you have two monitors connected using the 'Extend Displays' configuration, one of the grids overlays the other.

Reproducible: Always

Steps to Reproduce:
1. Connect another monitor
2. Turn on Desktop Grid
3. Create a new desktop
4. Activate the effect
5. Click on a desktop (it needs to be the leftmost one if the other monitor is on the right and vice versa)  and observe the effect on one monitor.

Actual Results:  
One of the grids overlayed the other for a split second

Expected Results:  
The grids would have clipped on the edge and not go onto the other monitor
Comment 1 Albin Engström 2018-10-21 14:53:50 UTC
This bug is still present in 5.14.1.
Comment 2 bastimeyer123 2018-11-19 07:48:47 UTC
This bug makes the desktop grid very annoying to use and has already prevented me many times to fully switch to the Plasma desktop environment. I'd really appreciate it if it could be fixed soon, as it has been reported more than 3 years ago.

To add a bit more detail, imagine having 2 screens, a secondary one on the left hand side and the primary one on the right hand side, and you are using 9 workspaces in a 3x3 grid with the 5th workspace being the current active one (the one in the center). Zooming out and showing the desktop grid is working absolutely fine, but if you want to zoom back in, the grid of the secondary screen is being expanded onto the primary screen for the duration of the whole animation. This means that for a split second, the content of the 6th workspace of the secondary screen is being shown on the primary screen.

What needs to be done here is that the expanding grid of the zoom-in animation has to be cropped on a per-screen basis, so that it doesn't expand onto the other screens.

Thank you!
Comment 3 bastimeyer123 2019-02-08 01:42:45 UTC
I think I have found a fix for this issue.

In the DesktopGridEffect's prePaintScreen method, two additional bits are set on the ScreenPrePaintData mask:
PAINT_SCREEN_TRANSFORMED and PAINT_SCREEN_BACKGROUND_FIRST
https://github.com/KDE/kwin/blob/v5.14.90/effects/desktopgrid/desktopgrid.cpp#L164

According to the scene header file, the whole screen will be painted if PAINT_SCREEN_TRANSFORMED is set. PAINT_SCREEN_REGION on the other hand will only paint a region of the screen.
https://github.com/KDE/kwin/blob/v5.14.90/scene.h#L116-L120

So in order to fix the issue of the overlaying tiles, I tried to replace PAINT_SCREEN_TRANSFORMED with PAINT_SCREEN_REGION and rebuilt my disto's kwin package with this change applied. This did indeed fix it, but another issue I could observe was a bit of occasional jittering on the borders of each tile after the end of the animation. Because of this, I changed the bitmask again and made it so, that PAINT_SCREEN_TRANSFORMED gets set at the end of the animation, while PAINT_SCREEN_REGION gets set during the animation. This fixed the jittering and everything seems to be working well now.

But since I don't know anything about the internals of KWin and since I'm also not a c++ dev, I don't want to submit a patch and would instead kindly ask for somebody else to properly take a look at this, so that this annoying bug can finally be fixed. Thanks!

Here is my diff:
https://gist.githubusercontent.com/bastimeyer/81c60699e5f5e762beb01a4bfeff1700/raw/04a2ab784f05f9f3cec522f4ac2a470e9cc803ac/desktopgrid-overlaying-tiles-fix.patch
Comment 4 Vlad Zahorodnii 2019-02-08 11:11:13 UTC
I think it's not a good idea to unset PAINT_SCREEN_TRANSFORMED because KWin checks that flag when deciding what method to use for clipping windows.
Comment 5 Vlad Zahorodnii 2019-03-14 13:13:49 UTC
The problem seems to be that SceneOpenGL::Window::beginRenderWindow clips windows incorrectly, it doesn't take into account transformations applied to the window.

Though if we fix that clipping code, I fear that we'll break the slide effect. Quite delicate situation...
Comment 6 Santiago Podestá 2020-09-25 02:11:47 UTC
(In reply to Vlad Zahorodnii from comment #4)
> I think it's not a good idea to unset PAINT_SCREEN_TRANSFORMED because KWin
> checks that flag when deciding what method to use for clipping windows.

What problems would that bring?
Comment 7 Vlad Zahorodnii 2020-09-25 07:59:00 UTC
Some windows will be incorrectly rendered.
Comment 8 bastimeyer123 2021-10-18 12:55:10 UTC
The issue is still present on 5.23, and I still have to patch kwin to be able to use the desktop grid effect on my multi-monitor setup (been doing this now for 2 1/2 years), otherwise it's completely unusable. Same patch as mentioned above, just rebased onto 5.23:
https://github.com/bastimeyer/arch-packages/blob/e39a0633c4916f2302323c4fc6b3e500d1745429/kwin/desktopgrid-overlaying-tile-fix.patch
Comment 9 Vlad Zahorodnii 2021-10-18 13:00:15 UTC
Hmm, we received confirmation from other people that this issue is fixed in 5.23. Please make sure that it's not a packaging issue.
Comment 10 Nate Graham 2021-10-18 16:21:48 UTC
Indeed.
Comment 11 bastimeyer123 2021-10-18 17:00:36 UTC
(In reply to Vlad Zahorodnii from comment #9)
> Hmm, we received confirmation from other people that this issue is fixed in
> 5.23. Please make sure that it's not a packaging issue.

Yes, apologies, my mistake. Looks like it's indeed fixed now. Thanks!