Bug 348121 - Maximized window position is wrong after dragging to top of second monitor
Summary: Maximized window position is wrong after dragging to top of second monitor
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: core (other bugs)
Version First Reported In: 5.3.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://git.reviewboard.kde.org/r/123...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-22 23:58 UTC by John Lindgren
Modified: 2015-06-03 20:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:
thomas.luebking: ReviewRequest+


Attachments
Video of the problem (1.98 MB, video/mp4)
2015-05-22 23:59 UTC, John Lindgren
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Lindgren 2015-05-22 23:58:57 UTC
Dragging an xterm window to the top of the primary monitor works as expected: the window is maximized.  However, dragging the same window to the top of the second monitor results in the window being increased in size but placed halfway between the two monitors.

Reproducible: Always

Steps to Reproduce:
1. Connect a second monitor
2. Drag a (non-maximized) window by its titlebar to the top of the second monitor

Actual Results:  
The window is increased in size but placed halfway between the two monitors (see attached video).

Expected Results:  
The window should be maximized on the second monitor.  I think this used to work in Plasma 5.2.

kwin 5.3.0-3
plasma-desktop 5.3.0-3
Comment 1 John Lindgren 2015-05-22 23:59:51 UTC
Created attachment 92787 [details]
Video of the problem
Comment 2 John Lindgren 2015-05-23 02:02:13 UTC
Seems to only happen with xterm windows, others behave as expected.
Comment 3 Martin Flöser 2015-05-26 06:36:19 UTC
please provide output of xprop of the xterm window and the output of xrandr
Comment 4 Thomas Lübking 2015-05-26 08:02:51 UTC
$20 that it doesn't happen when using the maximize button?
Comment 5 Thomas Lübking 2015-05-26 08:04:52 UTC
diff --git a/geometry.cpp b/geometry.cpp
index c5e57d0..ae906a2 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -2319,7 +2319,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
         r.setSize(adjustedSize(r.size(), SizemodeMax));
         if (r.size() != clientArea.size()) { // to avoid off-by-one errors...
             if (isElectricBorderMaximizing() && r.width() < clientArea.width())
-                r.moveLeft(Cursor::pos().x() - r.width()/2);
+                r.moveLeft(qMax(clientArea.left(), Cursor::pos().x() - r.width()/2));
             else
                 r.moveCenter(clientArea.center());
             r.moveTopLeft(rules()->checkPosition(r.topLeft()));
Comment 6 John Lindgren 2015-05-26 23:18:26 UTC
Correct, it only happens when dragging; the maximize button works fine.  Do you still need xprop and xrandr?
Comment 7 Thomas Lübking 2015-06-03 20:35:22 UTC
Git commit 1df2d5979fb25cb83442b5df74c84d4cba6029eb by Thomas Lübking.
Committed on 03/06/2015 at 19:22.
Pushed by luebking into branch 'Plasma/5.3'.

keep quick maximized w/ size restritions in screen

... bounds
REVIEW: 123910

M  +5    -3    geometry.cpp

http://commits.kde.org/kwin/1df2d5979fb25cb83442b5df74c84d4cba6029eb