Bug 289747

Summary: Desktop Grid effect gets "confused" when adding a new desktop
Product: [Plasma] kwin Reporter: Stefano <stavallo>
Component: effects-variousAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal Flags: thomas.luebking: ReviewRequest+
Priority: NOR    
Version: 4.8.0   
Target Milestone: 4.9.2   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.2
Sentry Crash Report:

Description Stefano 2011-12-24 15:42:00 UTC
Version:           4.8.0 (using Devel) 
OS:                Linux

Assume you have one desktop with some applications running and activate the desktop grid effect (Ctrl+F8). Then, add a new desktop. If you place the mouse pointer in the new desktop in a point corresponding to the position of a window in the first desktop, press the mouse button and move the mouse, then the window in the first desktop moves, while you are moving the mouse pointer in the new desktop. Also, if you click in the new desktop in a point which corresponds, in the first desktop, to a point covered by a window, then the first desktop is activated, otherwise the new desktop is activated.

Please note that these problems only arise when Present windows effect is used. Also, these problems do not arise the next time you activate the desktop grid effect (unless you add a new desktop).

Reproducible: Always

Steps to Reproduce:
Described above.

Actual Results:  
Described above.

Expected Results:  
When you click on the new desktop, that desktop should be activated. Also, the window in the first desktop should not move when pressing the mouse button and moving the mouse in the new desktop.
Comment 1 Thomas Lübking 2012-03-12 23:24:16 UTC
can't reproduce, please specify the desktop grid, ie.
- how many desktops are there initially?
- how is the grid laid out? (grid config dialog, automatic, pager, custom. what's the result)
- is this a multiscreen setup?
Comment 2 Stefano 2012-03-13 11:15:10 UTC
> can't reproduce, please specify the desktop grid, ie.

I still see this issue with 4.8.1

> - how many desktops are there initially?

No matter how many desktops are there initially, this issue exists when you add a new desktop. Suppose you have 2 desktops, with some applications on desktop 2. Press Ctrl+F8 and then '+', then if you grab desktop 3 in a point corresponding to a point covered by a window in desktop 2 and move then mouse, then that application is moved. Please note that if you Esc and then press Ctrl+F8 again, everything works correctly

> - how is the grid laid out? (grid config dialog, automatic, pager, custom.
> what's the result)

The result is independent of the grid layout. The issue only exists when the box "Use Present Windows effect to layout windows" is checked in the desktop grid config dialog.

> - is this a multiscreen setup?

No, I haven't a multiscreen setup. I recorded a video to show this issue:

http://wpage.unina.it/stavallo/test.mpg

Hope it helps. Thanks for looking into this issue
Comment 3 Thomas Lübking 2012-08-19 18:30:21 UTC
Coming back to this

a) i guess it's still an issue?
b) it seems to happen every other invocation (ie. odd or even ones), right?
c) do you use the plasma-netbook shell thing (looks like from the video)
Comment 4 Stefano 2012-08-20 19:18:49 UTC
Thanks for coming back to this.

a)-b)  I am on holidays till the end of august, so I can't check, but as far as I remember, the issue is still present in 4.9 . I will check as soon as I'm back home
c) no, I do not use the plasma netbook shell
Comment 5 Thomas Lübking 2012-08-26 13:25:18 UTC
also see bug #299657
Comment 6 Stefano 2012-09-09 10:21:25 UTC
(In reply to comment #3)
> Coming back to this
> 
> a) i guess it's still an issue?

Yes, still present with 4.9.1

> b) it seems to happen every other invocation (ie. odd or even ones), right?

No, it's not a matter of odd or even invocations. The problem only appears when you add a new desktop (e.g., Ctrl+F8 and press '+'). Then, (say the new desktop is number x) when you grab a point in desktop x with the mouse and in desktop x-1 there is a window in that point, the result is that you move the window in desktop x-1 even if your mouse is on desktop x. If you press Ctrl+F8 and you _don't_ add a new desktop, the problem is not present.

Please also note that the problem only appears when  "Use Present Windows effect to layout windows" is enabled.

> c) do you use the plasma-netbook shell thing (looks like from the video)

I am now using the desktop shell and the issue is there as well.
Comment 7 Thomas Lübking 2012-09-09 11:06:10 UTC
It's important that the window has been there when the effect started (what isn't apparent if there's only one VD in the beginning ;-)
Comment 8 Thomas Lübking 2012-09-09 12:47:33 UTC
We can fix what we can see.

http://git.reviewboard.kde.org/r/106391/
Comment 9 Thomas Lübking 2012-09-19 19:09:19 UTC
Git commit 3e5fdde239056760b2c0b46bf176a8ea6317697a by Thomas Lübking.
Committed on 09/09/2012 at 14:24.
Pushed by luebking into branch 'KDE/4.9'.

fix desktopgrid window manage on VD amount change
FIXED-IN: 4.9.2
REVIEW: 106391

M  +14   -9    kwin/effects/desktopgrid/desktopgrid.cpp
M  +1    -0    kwin/effects/desktopgrid/desktopgrid.h

http://commits.kde.org/kde-workspace/3e5fdde239056760b2c0b46bf176a8ea6317697a