Merge lp:~compiz-team/compiz-core/compiz-core.fix_863328 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2859
Proposed branch: lp:~compiz-team/compiz-core/compiz-core.fix_863328
Merge into: lp:compiz-core/0.9.5
Diff against target: 667 lines (+327/-96)
5 files modified
plugins/scale/src/privates.h (+1/-0)
plugins/scale/src/scale.cpp (+15/-0)
src/privatescreen.h (+65/-0)
src/privatewindow.h (+1/-1)
src/window.cpp (+245/-95)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/compiz-core.fix_863328
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Review via email: mp+78293@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Robert Carr (robertcarr) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/scale/src/privates.h'
--- plugins/scale/src/privates.h 2010-12-07 10:14:32 +0000
+++ plugins/scale/src/privates.h 2011-10-05 17:44:25 +0000
@@ -176,6 +176,7 @@
176176
177 GLfloat xVelocity, yVelocity, scaleVelocity;177 GLfloat xVelocity, yVelocity, scaleVelocity;
178 GLfloat scale;178 GLfloat scale;
179 GLfloat lastTargetScale;
179 GLfloat tx, ty;180 GLfloat tx, ty;
180 float delta;181 float delta;
181 bool adjust;182 bool adjust;
182183
=== modified file 'plugins/scale/src/scale.cpp'
--- plugins/scale/src/scale.cpp 2011-09-19 13:00:51 +0000
+++ plugins/scale/src/scale.cpp 2011-10-05 17:44:25 +0000
@@ -261,6 +261,17 @@
261261
262 bool drawScaled = false;262 bool drawScaled = false;
263263
264 /* Windows that wouldn't be visible before and after entering
265 * scale mode (because some plugin modified CompWindow::focus)
266 * should be faded in and out */
267 if (window->state () & CompWindowStateHiddenMask)
268 {
269 if (priv->slot)
270 attrib.opacity *= (1.0f - priv->scale) / (1.0f - priv->slot->scale);
271 else
272 attrib.opacity *= (1.0f - priv->scale) / (1.0f - priv->lastTargetScale);
273 }
274
264 if (priv->adjust || priv->slot)275 if (priv->adjust || priv->slot)
265 {276 {
266 if (priv->window->id () != priv->spScreen->selectedWindow &&277 if (priv->window->id () != priv->spScreen->selectedWindow &&
@@ -940,9 +951,12 @@
940951
941 if (sw->priv->slot)952 if (sw->priv->slot)
942 {953 {
954 sw->priv->lastTargetScale = sw->priv->slot->scale;
943 sw->priv->slot = NULL;955 sw->priv->slot = NULL;
944 sw->priv->adjust = true;956 sw->priv->adjust = true;
945 }957 }
958 else
959 sw->priv->lastTargetScale = 1.0f;
946 }960 }
947961
948 if (state & CompAction::StateCancel)962 if (state & CompAction::StateCancel)
@@ -1759,6 +1773,7 @@
1759 yVelocity (0.0),1773 yVelocity (0.0),
1760 scaleVelocity (0.0),1774 scaleVelocity (0.0),
1761 scale (1.0),1775 scale (1.0),
1776 lastTargetScale (1.0f),
1762 tx (0.0),1777 tx (0.0),
1763 ty (0.0),1778 ty (0.0),
1764 delta (1.0),1779 delta (1.0),
17651780
=== modified file 'src/privatescreen.h'
--- src/privatescreen.h 2011-09-19 12:54:22 +0000
+++ src/privatescreen.h 2011-10-05 17:44:25 +0000
@@ -35,6 +35,7 @@
35#include <core/timer.h>35#include <core/timer.h>
36#include <core/plugin.h>36#include <core/plugin.h>
37#include <time.h>37#include <time.h>
38#include <boost/shared_ptr.hpp>
3839
39#include <glibmm/main.h>40#include <glibmm/main.h>
4041
@@ -100,6 +101,70 @@
100 unsigned int viewportY;101 unsigned int viewportY;
101};102};
102103
104namespace compiz
105{
106namespace X11
107{
108class PendingEvent {
109public:
110 PendingEvent (Display *, Window);
111 virtual ~PendingEvent ();
112
113 virtual bool match (XEvent *);
114
115 typedef boost::shared_ptr<PendingEvent> Ptr;
116
117protected:
118
119 virtual Window getEventWindow (XEvent *);
120
121 unsigned int mSerial;
122 Window mWindow;
123};
124
125class PendingConfigureEvent :
126 public PendingEvent
127{
128public:
129 PendingConfigureEvent (Display *, Window, unsigned int, XWindowChanges *);
130 virtual ~PendingConfigureEvent ();
131
132 virtual bool match (XEvent *);
133 bool matchVM (unsigned int valueMask);
134
135 typedef boost::shared_ptr<PendingConfigureEvent> Ptr;
136
137protected:
138
139 virtual Window getEventWindow (XEvent *);
140
141private:
142 unsigned int mValueMask;
143 XWindowChanges mXwc;
144};
145
146class PendingEventQueue
147{
148public:
149
150 PendingEventQueue (Display *);
151 virtual ~PendingEventQueue ();
152
153 void add (PendingEvent::Ptr p);
154 bool match (XEvent *);
155 bool pending ();
156 bool forEachIf (boost::function <bool (compiz::X11::PendingEvent::Ptr)>);
157
158protected:
159 bool removeIfMatching (const PendingEvent::Ptr &p, XEvent *);
160
161private:
162 std::list <PendingEvent::Ptr> mEvents;
163};
164
165}
166}
167
103class PrivateScreen :168class PrivateScreen :
104 public ValueHolder,169 public ValueHolder,
105 public CoreOptions170 public CoreOptions
106171
=== modified file 'src/privatewindow.h'
--- src/privatewindow.h 2011-09-29 03:29:41 +0000
+++ src/privatewindow.h 2011-10-05 17:44:25 +0000
@@ -292,7 +292,7 @@
292292
293 typedef std::pair <XWindowChanges, unsigned int> XWCValueMask;293 typedef std::pair <XWindowChanges, unsigned int> XWCValueMask;
294294
295 std::list <XWCValueMask> pendingConfigures;295 compiz::X11::PendingEventQueue pendingConfigures;
296 bool pendingPositionUpdates;296 bool pendingPositionUpdates;
297297
298 char *startupId;298 char *startupId;
299299
=== modified file 'src/window.cpp'
--- src/window.cpp 2011-10-03 12:58:36 +0000
+++ src/window.cpp 2011-10-05 17:44:25 +0000
@@ -841,9 +841,6 @@
841 else841 else
842 serverFrameGeometry.setHeight (xwc.height);842 serverFrameGeometry.setHeight (xwc.height);
843843
844 addPendingConfigure (xwc, valueMask);
845
846
847 /* Geometry is the same, so we're not going to get a ConfigureNotify844 /* Geometry is the same, so we're not going to get a ConfigureNotify
848 * event when the window is configured, which means that other plugins845 * event when the window is configured, which means that other plugins
849 * won't know that the client, frame and wrapper windows got shifted846 * won't know that the client, frame and wrapper windows got shifted
@@ -900,6 +897,14 @@
900897
901 }898 }
902899
900 gettimeofday (&lastConfigureRequest, NULL);
901 compiz::X11::PendingEvent::Ptr pc =
902 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
903 new compiz::X11::PendingConfigureEvent (
904 screen->dpy (), serverFrame, valueMask, &xwc)));
905
906 pendingConfigures.add (pc);
907
903 XSendEvent (screen->dpy (), screen->root (), false,908 XSendEvent (screen->dpy (), screen->root (), false,
904 SubstructureNotifyMask, (XEvent *) &xev);909 SubstructureNotifyMask, (XEvent *) &xev);
905910
@@ -907,7 +912,16 @@
907 XSync (screen->dpy (), false);912 XSync (screen->dpy (), false);
908 }913 }
909 else914 else
915 {
916 gettimeofday (&lastConfigureRequest, NULL);
917 compiz::X11::PendingEvent::Ptr pc =
918 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
919 new compiz::X11::PendingConfigureEvent (
920 screen->dpy (), serverFrame, valueMask, &xwc)));
921
922 pendingConfigures.add (pc);
910 XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc);923 XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc);
924 }
911925
912 if (shaded)926 if (shaded)
913 {927 {
@@ -962,9 +976,6 @@
962 else976 else
963 serverFrameGeometry.setHeight (xwc.height);977 serverFrameGeometry.setHeight (xwc.height);
964978
965 addPendingConfigure (xwc, valueMask);
966
967
968 /* Geometry is the same, so we're not going to get a ConfigureNotify979 /* Geometry is the same, so we're not going to get a ConfigureNotify
969 * event when the window is configured, which means that other plugins980 * event when the window is configured, which means that other plugins
970 * won't know that the client, frame and wrapper windows got shifted981 * won't know that the client, frame and wrapper windows got shifted
@@ -1021,6 +1032,14 @@
10211032
1022 }1033 }
10231034
1035 gettimeofday (&lastConfigureRequest, NULL);
1036 compiz::X11::PendingEvent::Ptr pc =
1037 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
1038 new compiz::X11::PendingConfigureEvent (
1039 screen->dpy (), serverFrame, valueMask, &xwc)));
1040
1041 pendingConfigures.add (pc);
1042
1024 XSendEvent (screen->dpy (), screen->root (), false,1043 XSendEvent (screen->dpy (), screen->root (), false,
1025 SubstructureNotifyMask, (XEvent *) &xev);1044 SubstructureNotifyMask, (XEvent *) &xev);
10261045
@@ -1028,7 +1047,17 @@
1028 XSync (screen->dpy (), false);1047 XSync (screen->dpy (), false);
1029 }1048 }
1030 else1049 else
1050 {
1051 gettimeofday (&lastConfigureRequest, NULL);
1052 compiz::X11::PendingEvent::Ptr pc =
1053 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
1054 new compiz::X11::PendingConfigureEvent (
1055 screen->dpy (), serverFrame, valueMask, &xwc)));
1056
1057 pendingConfigures.add (pc);
1058
1031 XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc);1059 XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc);
1060 }
10321061
1033 if (shaded)1062 if (shaded)
1034 {1063 {
@@ -2020,7 +2049,6 @@
2020 int x, y, width, height;2049 int x, y, width, height;
2021 CompWindow *above;2050 CompWindow *above;
2022 unsigned int valueMask = 0;2051 unsigned int valueMask = 0;
2023 bool handled = false;
20242052
2025 if (!priv->frame)2053 if (!priv->frame)
2026 return;2054 return;
@@ -2052,61 +2080,15 @@
2052 valueMask |= CWSibling | CWStackMode;2080 valueMask |= CWSibling | CWStackMode;
2053 }2081 }
20542082
2055 for (std::list <XWCValueMask>::iterator it = pendingConfigures.begin ();2083 if (!pendingConfigures.match ((XEvent *) ce))
2056 it != pendingConfigures.end (); it++)
2057 {
2058 XWCValueMask &xwcvm = (*it);
2059
2060
2061 if (xwcvm.second != valueMask)
2062 {
2063 /* For stacking cases, if a client wants to raise or lower a window
2064 * then they don't need to specify CWSibling, so allow that to be
2065 * excluded in those cases */
2066
2067 if (ce->above == ROOTPARENT (screen->windows ().back ()) ||
2068 ce->above == 0)
2069 {
2070 if ((xwcvm.second & ~(CWSibling) != valueMask))
2071 continue;
2072 }
2073 else
2074 continue;
2075 }
2076
2077 if (xwcvm.second & CWX && xwcvm.first.x != ce->x)
2078 continue;
2079
2080 if (xwcvm.second & CWY && xwcvm.first.y != ce->y)
2081 continue;
2082
2083 if (xwcvm.second & CWWidth && xwcvm.first.width != ce->width)
2084 continue;
2085
2086 if (xwcvm.second & CWHeight && xwcvm.first.height != ce->height)
2087 continue;
2088
2089 if (xwcvm.second & (CWStackMode | CWSibling) && xwcvm.first.sibling != ce->above)
2090 continue;
2091
2092 /* Matched ConfigureWindow request to ConfigureNotify event
2093 * remove it from the list */
2094
2095 handled = true;
2096
2097 pendingConfigures.erase (it);
2098 break;
2099 }
2100
2101 if (!handled)
2102 {2084 {
2103 compLogMessage ("core", CompLogLevelWarn, "unhandled ConfigureNotify on 0x%x!", serverFrame);2085 compLogMessage ("core", CompLogLevelWarn, "unhandled ConfigureNotify on 0x%x!", serverFrame);
2104 compLogMessage ("core", CompLogLevelWarn, "this should never happen. you should"\2086 compLogMessage ("core", CompLogLevelWarn, "this should never happen. you should "\
2105 "probably file a bug about this.");2087 "probably file a bug about this.");
2106#ifdef DEBUG2088#ifdef DEBUG
2107 abort ();2089 abort ();
2108#else2090#else
2109 pendingConfigures.clear ();2091 pendingConfigures = compiz::X11::PendingEventQueue (screen->dpy ());
2110#endif2092#endif
2111 }2093 }
21122094
@@ -2145,7 +2127,7 @@
2145 if (above)2127 if (above)
2146 above->priv->updatePassiveButtonGrabs ();2128 above->priv->updatePassiveButtonGrabs ();
21472129
2148 if (pendingConfigures.empty ())2130 if (!pendingConfigures.pending ())
2149 {2131 {
2150 /* Tell plugins its ok to start doing stupid things again but2132 /* Tell plugins its ok to start doing stupid things again but
2151 * obviously FIXME */2133 * obviously FIXME */
@@ -2195,7 +2177,7 @@
2195 * and a FIXME in any case, however, until we can break the API2177 * and a FIXME in any case, however, until we can break the API
2196 * and remove CompWindow::move, this will need to be the case */2178 * and remove CompWindow::move, this will need to be the case */
21972179
2198 if (!priv->pendingConfigures.size ())2180 if (!priv->pendingConfigures.pending ())
2199 {2181 {
2200 priv->geometry.setX (priv->geometry.x () + dx);2182 priv->geometry.setX (priv->geometry.x () + dx);
2201 priv->geometry.setY (priv->geometry.y () + dy);2183 priv->geometry.setY (priv->geometry.y () + dy);
@@ -2237,34 +2219,194 @@
2237 {2219 {
2238 compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event from request at %i (now: %i)\n",2220 compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event from request at %i (now: %i)\n",
2239 priv->lastConfigureRequest.tv_usec, tv.tv_usec);2221 priv->lastConfigureRequest.tv_usec, tv.tv_usec);
2240 priv->pendingConfigures.clear ();2222 priv->pendingConfigures = compiz::X11::PendingEventQueue (screen->dpy ());
2241 }2223 }
2242 }2224 }
2243 }2225 }
2244}2226}
22452227
2228bool
2229compiz::X11::PendingEventQueue::pending ()
2230{
2231 return !mEvents.empty ();
2232}
2233
2246void2234void
2247PrivateWindow::addPendingConfigure (XWindowChanges &xwc, unsigned int valueMask)2235compiz::X11::PendingEventQueue::add (PendingEvent::Ptr p)
2236{
2237 mEvents.push_back (p);
2238}
2239
2240bool
2241compiz::X11::PendingEventQueue::removeIfMatching (const PendingEvent::Ptr &p, XEvent *event)
2242{
2243 return p->match (event);
2244}
2245
2246bool
2247compiz::X11::PendingEventQueue::match (XEvent *event)
2248{
2249 unsigned int lastSize = mEvents.size ();
2250
2251 mEvents.erase (std::remove_if (mEvents.begin (), mEvents.end (),
2252 boost::bind (&compiz::X11::PendingEventQueue::removeIfMatching, this, _1, event)), mEvents.end ());
2253
2254 return lastSize != mEvents.size ();
2255}
2256
2257bool
2258compiz::X11::PendingEventQueue::forEachIf (boost::function<bool (compiz::X11::PendingEvent::Ptr)> f)
2259{
2260 foreach (compiz::X11::PendingEvent::Ptr p, mEvents)
2261 {
2262 if (f (p))
2263 return true;
2264 }
2265
2266 return false;
2267}
2268
2269compiz::X11::PendingEventQueue::PendingEventQueue (Display *d)
2270{
2271}
2272
2273compiz::X11::PendingEventQueue::~PendingEventQueue ()
2274{
2275}
2276
2277Window
2278compiz::X11::PendingEvent::getEventWindow (XEvent *event)
2279{
2280 return event->xany.window;
2281}
2282
2283bool
2284compiz::X11::PendingEvent::match (XEvent *event)
2285{
2286 if (event->xany.serial != mSerial)
2287 return false;
2288 if (getEventWindow (event)!= mWindow)
2289 return false;
2290
2291 return true;
2292}
2293
2294compiz::X11::PendingEvent::PendingEvent (Display *d, Window w) :
2295 mSerial (XNextRequest (d)),
2296 mWindow (w)
2297{
2298}
2299
2300compiz::X11::PendingEvent::~PendingEvent ()
2301{
2302}
2303
2304Window
2305compiz::X11::PendingConfigureEvent::getEventWindow (XEvent *event)
2306{
2307 return event->xconfigure.window;
2308}
2309
2310bool
2311compiz::X11::PendingConfigureEvent::matchVM (unsigned int valueMask)
2312{
2313 return valueMask & mValueMask;
2314}
2315
2316bool
2317compiz::X11::PendingConfigureEvent::match (XEvent *event)
2318{
2319 XConfigureEvent *ce = (XConfigureEvent *) event;
2320 bool matched = true;
2321
2322 if (!compiz::X11::PendingEvent::match (event))
2323 return false;
2324
2325 if (mValueMask & CWX)
2326 if (ce->x != mXwc.x)
2327 matched = false;
2328
2329 if (mValueMask & CWY)
2330 if (ce->y != mXwc.y)
2331 matched = false;
2332
2333 if (mValueMask & CWWidth)
2334 if (ce->width != mXwc.width)
2335 matched = false;
2336
2337 if (mValueMask & CWHeight)
2338 if (ce->height != mXwc.height)
2339 matched = false;
2340
2341 if (mValueMask & CWBorderWidth)
2342 if (ce->border_width != mXwc.border_width)
2343 matched = false;
2344
2345 if (mValueMask & (CWStackMode | CWSibling))
2346 if (ce->above != mXwc.sibling)
2347 matched = false;
2348
2349 /* Remove events from the queue
2350 * even if they didn't match what
2351 * we expected them to be, but still
2352 * complain about it */
2353 if (!matched)
2354 {
2355 compLogMessage ("core", CompLogLevelWarn, "no exact match for ConfigureNotify on 0x%x!", mWindow);
2356 compLogMessage ("core", CompLogLevelWarn, "expected the following changes:");
2357 if (mValueMask & CWX)
2358 compLogMessage ("core", CompLogLevelWarn, "x: %i", mXwc.x);
2359 if (mValueMask & CWY)
2360 compLogMessage ("core", CompLogLevelWarn, "y: %i", mXwc.y);
2361 if (mValueMask & CWWidth)
2362 compLogMessage ("core", CompLogLevelWarn, "width: %i", mXwc.width);
2363 if (mValueMask & CWHeight)
2364 compLogMessage ("core", CompLogLevelWarn, "height: %i", mXwc.height);
2365 if (mValueMask & CWBorderWidth)
2366 compLogMessage ("core", CompLogLevelWarn, "border: %i", mXwc.border_width);
2367 if (mValueMask & (CWStackMode | CWSibling))
2368 compLogMessage ("core", CompLogLevelWarn, "sibling: 0x%x", mXwc.sibling);
2369
2370 compLogMessage ("core", CompLogLevelWarn, "instead got:");
2371 compLogMessage ("core", CompLogLevelWarn, "x: %i", ce->x);
2372 compLogMessage ("core", CompLogLevelWarn, "y: %i", ce->y);
2373 compLogMessage ("core", CompLogLevelWarn, "width: %i", ce->width);
2374 compLogMessage ("core", CompLogLevelWarn, "height: %i", ce->height);
2375 compLogMessage ("core", CompLogLevelWarn, "above: %i", ce->above);
2376 compLogMessage ("core", CompLogLevelWarn, "this should never happen. you should "\
2377 "probably file a bug about this.");
2378 }
2379
2380 return true;
2381}
2382
2383compiz::X11::PendingConfigureEvent::PendingConfigureEvent (Display *d,
2384 Window w,
2385 unsigned int valueMask,
2386 XWindowChanges *xwc) :
2387 compiz::X11::PendingEvent::PendingEvent (d, w),
2388 mValueMask (valueMask),
2389 mXwc (*xwc)
2248{2390{
2249 CompOption::Vector options;2391 CompOption::Vector options;
2250 CompOption::Value v;2392 CompOption::Value v;
22512393
2252 options.push_back (CompOption ("window", CompOption::TypeInt));2394 options.push_back (CompOption ("window", CompOption::TypeInt));
2253 v.set ((int) id);2395 v.set ((int) w);
2254 options.back ().set (v);2396 options.back ().set (v);
2255 options.push_back (CompOption ("active", CompOption::TypeInt));2397 options.push_back (CompOption ("active", CompOption::TypeInt));
2256 v.set ((int) 1);2398 v.set ((int) 1);
2257 options.back ().set (v);2399 options.back ().set (v);
22582400
2259 gettimeofday (&lastConfigureRequest, NULL);
2260
2261 /* Notify other plugins that it is unsafe to change geometry or serverGeometry2401 /* Notify other plugins that it is unsafe to change geometry or serverGeometry
2262 * FIXME: That API should not be accessible to plugins, this is a hack to avoid2402 * FIXME: That API should not be accessible to plugins, this is a hack to avoid
2263 * breaking ABI */2403 * breaking ABI */
22642404
2265 screen->handleCompizEvent ("core", "lock_position", options);2405 screen->handleCompizEvent ("core", "lock_position", options);
2406}
22662407
2267 priv->pendingConfigures.push_back (XWCValueMask (xwc, valueMask));2408compiz::X11::PendingConfigureEvent::~PendingConfigureEvent ()
2409{
2268}2410}
22692411
2270void2412void
@@ -2275,7 +2417,7 @@
2275 unsigned int valueMask = CWX | CWY;2417 unsigned int valueMask = CWX | CWY;
2276 XWindowChanges xwc;2418 XWindowChanges xwc;
22772419
2278 if (priv->pendingPositionUpdates && priv->pendingConfigures.empty ())2420 if (priv->pendingPositionUpdates && !priv->pendingConfigures.pending ())
2279 {2421 {
2280 if (priv->serverFrameGeometry.x () == priv->frameGeometry.x ())2422 if (priv->serverFrameGeometry.x () == priv->frameGeometry.x ())
2281 valueMask &= ~(CWX);2423 valueMask &= ~(CWX);
@@ -2290,8 +2432,6 @@
2290 * larger changes to the window movement system. */2432 * larger changes to the window movement system. */
2291 if (valueMask)2433 if (valueMask)
2292 {2434 {
2293 priv->addPendingConfigure (xwc, 0);
2294
2295 priv->serverGeometry.setX (priv->geometry.x ());2435 priv->serverGeometry.setX (priv->geometry.x ());
2296 priv->serverGeometry.setY (priv->geometry.y ());2436 priv->serverGeometry.setY (priv->geometry.y ());
2297 priv->serverFrameGeometry.setX (priv->frameGeometry.x ());2437 priv->serverFrameGeometry.setX (priv->frameGeometry.x ());
@@ -2300,6 +2440,14 @@
2300 xwc.x = priv->serverFrameGeometry.x ();2440 xwc.x = priv->serverFrameGeometry.x ();
2301 xwc.y = priv->serverFrameGeometry.y ();2441 xwc.y = priv->serverFrameGeometry.y ();
23022442
2443 gettimeofday (&priv->lastConfigureRequest, NULL);
2444 compiz::X11::PendingEvent::Ptr pc =
2445 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
2446 new compiz::X11::PendingConfigureEvent (
2447 screen->dpy (), priv->serverFrame, 0, &xwc)));
2448
2449 priv->pendingConfigures.add (pc);
2450
2303 XConfigureWindow (screen->dpy (), ROOTPARENT (this), valueMask, &xwc);2451 XConfigureWindow (screen->dpy (), ROOTPARENT (this), valueMask, &xwc);
23042452
2305 if (priv->serverFrame)2453 if (priv->serverFrame)
@@ -3103,6 +3251,13 @@
3103 return m;3251 return m;
3104}3252}
31053253
3254static bool isPendingRestack (compiz::X11::PendingEvent::Ptr p)
3255{
3256 compiz::X11::PendingConfigureEvent::Ptr pc = boost::shared_static_cast <compiz::X11::PendingConfigureEvent> (p);
3257
3258 return pc->matchVM (CWStackMode | CWSibling);
3259}
3260
3106void3261void
3107PrivateWindow::reconfigureXWindow (unsigned int valueMask,3262PrivateWindow::reconfigureXWindow (unsigned int valueMask,
3108 XWindowChanges *xwc)3263 XWindowChanges *xwc)
@@ -3137,18 +3292,7 @@
3137 /* check if the sibling is also pending a restack,3292 /* check if the sibling is also pending a restack,
3138 * if not, then setting this bit is useless */3293 * if not, then setting this bit is useless */
31393294
3140 bool pendingRestack = false;3295 if (window->serverPrev->priv->pendingConfigures.forEachIf (boost::bind (isPendingRestack, _1)))
3141
3142 foreach (XWCValueMask &xwcvm, window->serverPrev->priv->pendingConfigures)
3143 {
3144 if (xwcvm.second & (CWSibling | CWStackMode))
3145 {
3146 pendingRestack = true;
3147 break;
3148 }
3149 }
3150
3151 if (!pendingRestack)
3152 valueMask &= ~(CWSibling | CWStackMode);3296 valueMask &= ~(CWSibling | CWStackMode);
3153 }3297 }
31543298
@@ -3252,7 +3396,14 @@
3252 wc.width = serverFrameGeometry.width ();3396 wc.width = serverFrameGeometry.width ();
3253 wc.height = serverFrameGeometry.height ();3397 wc.height = serverFrameGeometry.height ();
32543398
3255 addPendingConfigure (wc, frameValueMask);3399 gettimeofday (&lastConfigureRequest, NULL);
3400
3401 compiz::X11::PendingEvent::Ptr pc =
3402 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
3403 new compiz::X11::PendingConfigureEvent (
3404 screen->dpy (), priv->serverFrame, frameValueMask, &wc)));
3405
3406 pendingConfigures.add (pc);
32563407
3257 XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc);3408 XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc);
3258 }3409 }
@@ -4041,31 +4192,29 @@
40414192
4042 lxwc.stack_mode = Below;4193 lxwc.stack_mode = Below;
40434194
4195 if (serverFrame)
4196 {
4197 gettimeofday (&lastConfigureRequest, NULL);
4198 compiz::X11::PendingEvent::Ptr pc =
4199 boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
4200 new compiz::X11::PendingConfigureEvent (
4201 screen->dpy (), serverFrame, valueMask, &lxwc)));
4202
4203 pendingConfigures.add (pc);
4204 }
4205
4044 /* Below with no sibling puts the window at the bottom4206 /* Below with no sibling puts the window at the bottom
4045 * of the stack */4207 * of the stack */
4046 XConfigureWindow (screen->dpy (), ROOTPARENT (window), valueMask, &lxwc);4208 XConfigureWindow (screen->dpy (), ROOTPARENT (window), valueMask, &lxwc);
40474209
4048 if (serverFrame)
4049 priv->addPendingConfigure (lxwc, CWStackMode);
4050
4051 /* Update the list of windows last sent to the server */4210 /* Update the list of windows last sent to the server */
4052 screen->unhookServerWindow (window);4211 screen->unhookServerWindow (window);
4053 screen->insertServerWindow (window, 0);4212 screen->insertServerWindow (window, 0);
4054 }4213 }
4055 else if (sibling)4214 else if (sibling)
4056 {4215 {
4057 bool pendingRestacks = false;4216 if (sibling->priv->id != window->serverPrev->priv->id ||
40584217 window->serverPrev->priv->pendingConfigures.forEachIf (boost::bind (isPendingRestack, _1)))
4059 foreach (XWCValueMask &xwcvm, sibling->priv->pendingConfigures)
4060 {
4061 if (xwcvm.second & (CWSibling | CWStackMode))
4062 {
4063 pendingRestacks = true;
4064 break;
4065 }
4066 }
4067
4068 if (sibling->priv->id != window->serverPrev->priv->id || pendingRestacks)
4069 {4218 {
4070 mask |= CWSibling | CWStackMode;4219 mask |= CWSibling | CWStackMode;
40714220
@@ -6447,6 +6596,7 @@
64476596
6448 pendingUnmaps (0),6597 pendingUnmaps (0),
6449 pendingMaps (0),6598 pendingMaps (0),
6599 pendingConfigures (screen->dpy ()),
6450 pendingPositionUpdates (false),6600 pendingPositionUpdates (false),
64516601
6452 startupId (0),6602 startupId (0),

Subscribers

People subscribed via source and target branches