Merge lp:~compiz-team/compiz-grid-plugin/compiz-grid-plugin.fix_860257 into lp:compiz-grid-plugin

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz-grid-plugin/compiz-grid-plugin.fix_860257
Merge into: lp:compiz-grid-plugin
Diff against target: 112 lines (+34/-7)
2 files modified
src/grid.cpp (+31/-7)
src/grid.h (+3/-0)
To merge this branch: bzr merge lp:~compiz-team/compiz-grid-plugin/compiz-grid-plugin.fix_860257
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+77093@code.launchpad.net

This proposal has been superseded by a proposal from 2011-09-29.

Description of the change

Fixes Bug 860257

With the new core changes attempting to move a window that is maximizing will result in a race condition resulting in a deadlock.

To post a comment you must log in.
99. By Sam Spilsbury

Move the window back to the desired size, explicitly moving it back by whatever we moved
it to will end up with us fighting ourselves in case core was configuring that window
while it was being moved, because we will get the moveNotify a little while after
we moved the window.

100. By Sam Spilsbury

Detect viewport changes and don't move windows back then.

101. By Sam Spilsbury

Merge trunk

Revision history for this message
Jason Smith (jassmith) :
review: Approve

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/grid.cpp'
2--- src/grid.cpp 2011-09-24 06:59:55 +0000
3+++ src/grid.cpp 2011-09-27 16:03:25 +0000
4@@ -43,6 +43,23 @@
5 {0,0, 1,1},
6 };
7
8+void
9+GridScreen::handleCompizEvent(const char* plugin,
10+ const char* event,
11+ CompOption::Vector& o)
12+{
13+ if (strcmp(event, "start_viewport_switch") == 0)
14+ {
15+ mSwitchingVp = true;
16+ }
17+ else if (strcmp(event, "end_viewport_switch") == 0)
18+ {
19+ mSwitchingVp = false;
20+ }
21+
22+ screen->handleCompizEvent(plugin, event, o);
23+}
24+
25 CompRect
26 GridScreen::slotToRect (CompWindow *w,
27 const CompRect& slot)
28@@ -328,6 +345,7 @@
29 for (unsigned int i = 0; i < animations.size (); i++)
30 animations.at (i).fadingOut = true;
31 gw->lastTarget = where;
32+ gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height);
33 }
34
35 /* This centers a window if it could not be resized to the desired
36@@ -695,17 +713,20 @@
37 {
38 window->moveNotify (dx, dy, immediate);
39
40- if (isGridResized)
41+ if (isGridResized && !isGridMaximized && !GridScreen::get (screen)->mSwitchingVp)
42 {
43- pointerBufDx += dx;
44- pointerBufDy += dy;
45+ if (window->grabbed ())
46+ {
47+ pointerBufDx += dx;
48+ pointerBufDy += dy;
49+ }
50
51 /* Do not allow the window to be moved while it
52 * is resized */
53+ dx = currentSize.x () - window->geometry ().x ();
54+ dy = currentSize.y () - window->geometry ().y ();
55
56- window->moveNotifySetEnabled (this, false);
57- window->move (-dx, -dy);
58- window->moveNotifySetEnabled (this, true);
59+ window->move (dx, dy);
60 }
61 }
62
63@@ -755,6 +776,7 @@
64 xwc.width = gw->originalSize.width ();
65 xwc.height = gw->originalSize.height ();
66 cw->maximize (0);
67+ gw->currentSize = CompRect ();
68 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
69 gw->pointerBufDx = 0;
70 gw->pointerBufDy = 0;
71@@ -860,11 +882,13 @@
72 glScreen (GLScreen::get (screen)),
73 centerCheck (false),
74 mGrabWindow (NULL),
75- animating (false)
76+ animating (false),
77+ mSwitchingVp (false)
78 {
79 o.push_back (CompOption ("window", CompOption::TypeInt));
80
81 ScreenInterface::setHandler (screen, false);
82+ screen->handleCompizEventSetEnabled (this, true);
83 CompositeScreenInterface::setHandler (cScreen, false);
84 GLScreenInterface::setHandler (glScreen, false);
85
86
87=== modified file 'src/grid.h'
88--- src/grid.h 2011-09-24 06:59:55 +0000
89+++ src/grid.h 2011-09-27 16:03:25 +0000
90@@ -106,6 +106,7 @@
91 bool centerCheck;
92 CompWindow *mGrabWindow;
93 bool animating;
94+ bool mSwitchingVp;
95
96 void getPaintRectangle (CompRect&);
97 void setCurrentRect (Animation&);
98@@ -128,6 +129,7 @@
99 GridType edgeToGridType ();
100
101 void handleEvent (XEvent *event);
102+ void handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options);
103
104 bool restoreWindow (CompAction*,
105 CompAction::State,
106@@ -161,6 +163,7 @@
107 int pointerBufDx;
108 int pointerBufDy;
109 int resizeCount;
110+ CompRect currentSize;
111 CompRect originalSize;
112 GridType lastTarget;
113

Subscribers

People subscribed via source and target branches

to all changes: