Merge lp:~aacid/unity-2d/panel_mm_fixes into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 1109
Merged at revision: 1108
Proposed branch: lp:~aacid/unity-2d/panel_mm_fixes
Merge into: lp:unity-2d
Diff against target: 75 lines (+31/-19)
2 files modified
panel/applets/appname/windowhelper.cpp (+21/-19)
tests/manual-tests/panel.txt (+10/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/panel_mm_fixes
Reviewer Review Type Date Requested Status
Gerry Boland Pending
Review via email: mp+107349@code.launchpad.net

Commit message

[panel] Multimonitor Fixes for panel emulating window decoration. For example prevents panel on screen 1 unmaximising a maximised & active window on screen 2

This ensures if you double click in a panel, it will only unmaximize the currently active window (m_window) if it is in the same screen as the panel. Similarly if you press+move in a panel, it will only drag the currently active window (m_window) if it is in the same screen as the panel

Description of the change

[panel] Multimonitor Fixes

If you double click in a panel, it will only unmaximize the currently active window (m_window) if it is in the same screen as the panel
If you press+move in a panel, it will only drag the currently active window (m_window) if it is in the same screen as the panel

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/applets/appname/windowhelper.cpp'
2--- panel/applets/appname/windowhelper.cpp 2012-05-24 11:18:30 +0000
3+++ panel/applets/appname/windowhelper.cpp 2012-05-25 09:05:42 +0000
4@@ -213,7 +213,7 @@
5 {
6 if (DashClient::instance()->activeInScreen(d->screen())) {
7 dash2dConfiguration().setProperty("fullScreen", QVariant(false));
8- } else {
9+ } else if (isMostlyOnScreen(d->screen())) {
10 wnck_window_unmaximize(d->m_window);
11 }
12 }
13@@ -229,24 +229,26 @@
14
15 void WindowHelper::drag(const QPoint& pos)
16 {
17- // this code IMO should ultimately belong to wnck
18- if (wnck_window_is_maximized(d->m_window)) {
19- XEvent xev;
20- QX11Info info;
21- Atom netMoveResize = XInternAtom(QX11Info::display(), "_NET_WM_MOVERESIZE", false);
22- xev.xclient.type = ClientMessage;
23- xev.xclient.message_type = netMoveResize;
24- xev.xclient.display = QX11Info::display();
25- xev.xclient.window = wnck_window_get_xid(d->m_window);
26- xev.xclient.format = 32;
27- xev.xclient.data.l[0] = pos.x();
28- xev.xclient.data.l[1] = pos.y();
29- xev.xclient.data.l[2] = 8; // _NET_WM_MOVERESIZE_MOVE
30- xev.xclient.data.l[3] = Button1;
31- xev.xclient.data.l[4] = 0;
32- XUngrabPointer(QX11Info::display(), QX11Info::appTime());
33- XSendEvent(QX11Info::display(), QX11Info::appRootWindow(info.screen()), false,
34- SubstructureRedirectMask | SubstructureNotifyMask, &xev);
35+ if (isMostlyOnScreen(d->screen())) {
36+ // this code IMO should ultimately belong to wnck
37+ if (wnck_window_is_maximized(d->m_window)) {
38+ XEvent xev;
39+ QX11Info info;
40+ Atom netMoveResize = XInternAtom(QX11Info::display(), "_NET_WM_MOVERESIZE", false);
41+ xev.xclient.type = ClientMessage;
42+ xev.xclient.message_type = netMoveResize;
43+ xev.xclient.display = QX11Info::display();
44+ xev.xclient.window = wnck_window_get_xid(d->m_window);
45+ xev.xclient.format = 32;
46+ xev.xclient.data.l[0] = pos.x();
47+ xev.xclient.data.l[1] = pos.y();
48+ xev.xclient.data.l[2] = 8; // _NET_WM_MOVERESIZE_MOVE
49+ xev.xclient.data.l[3] = Button1;
50+ xev.xclient.data.l[4] = 0;
51+ XUngrabPointer(QX11Info::display(), QX11Info::appTime());
52+ XSendEvent(QX11Info::display(), QX11Info::appRootWindow(info.screen()), false,
53+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
54+ }
55 }
56 }
57
58
59=== modified file 'tests/manual-tests/panel.txt'
60--- tests/manual-tests/panel.txt 2012-05-21 10:35:22 +0000
61+++ tests/manual-tests/panel.txt 2012-05-25 09:05:42 +0000
62@@ -53,3 +53,13 @@
63 * Go to the panel and double click the middle mouse button
64 * Verify the fullscreen window stays maximized
65 ----
66+ * Have two monitors
67+ * Maximize one window
68+ * Double click the panel in the monitor that does not contain the window
69+ * Verify the window stays maximized
70+----
71+* Have two monitors
72+ * Maximize one window
73+ * Press and drag the mouse in the panel in the monitor that does not contain the window
74+ * Verify the window stays unaffected
75+----

Subscribers

People subscribed via source and target branches