Bug 303937

Summary: Quick tiling (snap) uses wrong geometry on alternate attempts.
Product: [Plasma] kwin Reporter: Ian Stanistreet <ipstanistreet>
Component: Quick TilingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal Flags: thomas.luebking: ReviewRequest+
Priority: NOR    
Version: 4.8.97   
Target Milestone: 4.9.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Before window grouping.
After window grouping. Receiving window was tiled before.
After grouping. Receiving window was not tiled before grouping.

Description Ian Stanistreet 2012-07-22 22:13:18 UTC
On alternate attempts to tile a window, its geometry is wrong.
For left and right full-height tiling, the size vertical position is correct but the horizontal position is equal to the horizontal position that the window was dragged to on the last successful tiling attempt.
It doesn't happen with every window, but I have observed it in dolphin, kmail, akregator and especially rekonq (possibly because I use tiling with that the most).
This has been happening for a long time but I only just spotted the pattern to it.

Reproducible: Sometimes

Steps to Reproduce:
1. Enable quick tiling in System Settings -> Workspace Behaviour -> Screen Edges.
2. Drag a window to the side of the screen to tile it.
3. Drag the same window to the side of the screen again (the same side or a different one).
4. On the second attempt, sometimes it will tile properly and sometimes the geometry will be wrong.  I don't know what makes it happen.
5. When it fails, tile the window again a few more times.  It fails on alternate attempts.  The position is related to the position that you dragged the window to on the last successful attempt.
Comment 1 Ian Stanistreet 2012-07-22 23:30:43 UTC
Screen capture showing the bug:
http://imageshack.us/clip/my-videos/692/9yz.mp4/
Direct link:
http://img692.imageshack.us/img692/5782/9yz.mp4
Comment 2 Ian Stanistreet 2012-07-22 23:50:42 UTC
A similar thing sometimes happens when manually grouping windows that have been quick-tiled.  Dragging one window title-bar onto another with the middle mouse button causes the resulting grouped window to be positioned where the dragged window was tiled unless the other window was also tiled, in which case the grouped window appears where that one was tiled.
This is accompanied by glitches.  I'll attach some screenshots (for some reason window grouping doesn't work while recording the screen, so no video).
Comment 3 Ian Stanistreet 2012-07-22 23:51:46 UTC
Created attachment 72689 [details]
Before window grouping.
Comment 4 Ian Stanistreet 2012-07-22 23:52:48 UTC
Created attachment 72690 [details]
After window grouping.  Receiving window was tiled before.
Comment 5 Ian Stanistreet 2012-07-22 23:53:43 UTC
Created attachment 72691 [details]
After grouping.  Receiving window was not tiled before grouping.
Comment 6 Thomas Lübking 2012-07-23 07:57:50 UTC
Likely related to initial vertical maximization state for the original bug, pos. same issue but different trigger for the tabbing one.
Comment 7 Thomas Lübking 2012-07-23 20:11:24 UTC
(In reply to comment #6)
> Likely related to initial vertical maximization state for the original bug,
> pos. same issue but different trigger for the tabbing one.

Seems to be.
Comment 8 Thomas Lübking 2012-07-23 20:42:46 UTC
(In reply to comment #2)
I've a fix for the original bug, and there's a great chance that it's the same one (the tiled window must be vertically or horizontally maximized before being tiled) but can You please confirm that either the assumption about the maximization state holds or that this:

> Dragging one window title-bar onto another with the
> middle mouse button causes the resulting grouped window to be positioned
> where the dragged window was tiled unless the other window was also tiled,
> in which case the grouped window appears where that one was tiled.
> This is accompanied by glitches.  I'll attach some screenshots (for some
> reason window grouping doesn't work while recording the screen, so no video).

boils down to
Window A: Q'tiled, not grouped
Window B: Not Q'tiled, not grouped
A -> B: Group is tiled

Window A: as above
Window C: Q'tiled, not grouped
A -> C: Group is tiled in correct position.

https://git.reviewboard.kde.org/r/105699/
Comment 9 Ian Stanistreet 2012-07-23 21:35:49 UTC
(In reply to comment #8)
I'm not sure I completely understand the question but when grouping windows they don't have to be vertically maximised to be affected by this bug.  Neither of the windows in my screenshots are maximised.  In the screenshots, I dragged the window on the right onto the window on the left.

> Window A: Q'tiled, not grouped
> Window B: Not Q'tiled, not grouped
> A -> B: Group is tiled
This is what I did in screenshot 3.

> Window A: as above
> Window C: Q'tiled, not grouped
> A -> C: Group is tiled in correct position.
This is what I did in screenshot 2.  The group is on the correct side of the screen, but not tiled correctly.
Comment 10 Thomas Lübking 2012-07-24 11:46:31 UTC
Sorry, didn't look at the screenshots.
It's actually a completely different issue.
Fix is here:
https://git.reviewboard.kde.org/r/105702/

We might break this bug in two for database reasons, so don't get upset if it's suddenly closed as partial duplicate or so.

Thanks for reporting.
Comment 11 Thomas Lübking 2012-07-25 18:29:41 UTC
Git commit 5d23c2c39b99acf059cb12e6aa7ecf14fd039962 by Thomas Lübking.
Committed on 25/07/2012 at 09:44.
Pushed by luebking into branch 'KDE/4.9'.

un-Q'tile partially max'd clients on startMoveResize
REVIEW: 105699

M  +2    -1    kwin/geometry.cpp

http://commits.kde.org/kde-workspace/5d23c2c39b99acf059cb12e6aa7ecf14fd039962
Comment 12 Thomas Lübking 2012-07-25 18:29:41 UTC
Git commit 734ffd6bc8c30fd23a17536bd313800668edb0b5 by Thomas Lübking.
Committed on 25/07/2012 at 09:42.
Pushed by luebking into branch 'KDE/4.9'.

Align about to be tabbed window before adding it
REVIEW: 105702

M  +20   -4    kwin/tabgroup.cpp

http://commits.kde.org/kde-workspace/734ffd6bc8c30fd23a17536bd313800668edb0b5