45
46
#include "privatescreen.h"
46
47
#include "privatestackdebugger.h"
49
#include "configurerequestbuffer-impl.h"
48
51
#include <boost/scoped_array.hpp>
53
namespace crb = compiz::window::configure_buffers;
54
namespace cw = compiz::window;
50
56
template class WrapableInterface<CompWindow, WindowInterface>;
52
58
PluginClassStorage::Indices windowPluginClassIndices (0);
3028
3034
return pc->matchRequest (xwc, valueMask);
3038
PrivateWindow::queryAttributes (XWindowAttributes &attrib)
3040
return configureBuffer->queryAttributes (attrib);
3044
PrivateWindow::queryFrameAttributes (XWindowAttributes &attrib)
3046
return configureBuffer->queryFrameAttributes (attrib);
3050
PrivateWindow::queryShapeRectangles (int kind, int *count, int *ordering)
3052
return configureBuffer->queryShapeRectangles (kind, count, ordering);
3056
PrivateWindow::requestConfigureOnClient (const XWindowChanges &xwc,
3057
unsigned int valueMask)
3059
return XConfigureWindow (screen->dpy (),
3062
const_cast <XWindowChanges *> (&xwc));
3066
PrivateWindow::requestConfigureOnWrapper (const XWindowChanges &xwc,
3067
unsigned int valueMask)
3069
return XConfigureWindow (screen->dpy (),
3072
const_cast <XWindowChanges *> (&xwc));
3076
PrivateWindow::requestConfigureOnFrame (const XWindowChanges &xwc,
3077
unsigned int frameValueMask)
3079
XWindowChanges wc = xwc;
3081
wc.x = serverFrameGeometry.x ();
3082
wc.y = serverFrameGeometry.y ();
3083
wc.width = serverFrameGeometry.width ();
3084
wc.height = serverFrameGeometry.height ();
3086
compiz::X11::PendingEvent::Ptr pc (
3087
new compiz::X11::PendingConfigureEvent (
3090
frameValueMask, &wc));
3092
pendingConfigures.add (pc);
3094
return XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc);
3098
PrivateWindow::sendSyntheticConfigureNotify ()
3100
window->sendConfigureNotify ();
3104
PrivateWindow::hasCustomShape () const
3032
3110
PrivateWindow::reconfigureXWindow (unsigned int valueMask,
3033
3111
XWindowChanges *xwc)
3240
3318
if (serverFrame)
3242
3320
if (frameValueMask)
3244
XWindowChanges wc = *xwc;
3246
wc.x = serverFrameGeometry.x ();
3247
wc.y = serverFrameGeometry.y ();
3248
wc.width = serverFrameGeometry.width ();
3249
wc.height = serverFrameGeometry.height ();
3251
compiz::X11::PendingEvent::Ptr pc =
3252
boost::shared_static_cast<compiz::X11::PendingEvent> (compiz::X11::PendingConfigureEvent::Ptr (
3253
new compiz::X11::PendingConfigureEvent (
3254
screen->dpy (), priv->serverFrame, frameValueMask, &wc)));
3256
pendingConfigures.add (pc);
3258
XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc);
3261
valueMask &= ~(CWSibling | CWStackMode);
3321
priv->configureBuffer->pushFrameRequest (*xwc, frameValueMask);
3323
valueMask = frameValueMask & (CWWidth | CWHeight);
3263
3325
/* If the frame has changed position (eg, serverInput.top
3264
3326
* or serverInput.left have changed) then we also need to
3265
3327
* update the client and wrapper position */
3266
if (!(valueMask & CWX))
3267
valueMask |= frameValueMask & CWX;
3268
if (!(valueMask & CWY))
3269
valueMask |= frameValueMask & CWY;
3328
if (lastServerInput.left != serverInput.left)
3330
if (lastServerInput.top != serverInput.top)
3333
if (lastServerInput.right - lastServerInput.left !=
3334
serverInput.right - serverInput.left)
3335
valueMask |= CWWidth;
3336
if (lastServerInput.bottom - lastServerInput.top !=
3337
serverInput.bottom - serverInput.top)
3338
valueMask |= CWHeight;
3273
3342
xwc->x = serverInput.left;
3274
3343
xwc->y = serverInput.top;
3275
XConfigureWindow (screen->dpy (), wrapper, valueMask, xwc);
3345
priv->configureBuffer->pushWrapperRequest (*xwc, valueMask);
3349
/* Client is reparented, the only things that can change
3350
* are the width, height and border width */
3352
valueMask &= (CWWidth | CWHeight | CWBorderWidth);
3283
XConfigureWindow (screen->dpy (), id, valueMask, xwc);
3355
priv->configureBuffer->pushClientRequest (*xwc, valueMask);
3285
3357
/* Send the synthetic configure notify
3286
3358
* after the real configure notify arrives
4163
4235
using ::compiz::private_screen::WindowManager;
4165
4237
CompWindow *focus = NULL;
4166
WindowManager::reverse_iterator it = windowManager.rbegin ();
4238
WindowManager::reverse_iterator it = windowManager.rserverBegin ();
4168
for (; it != windowManager.rend (); ++it)
4240
for (; it != windowManager.rserverEnd (); ++it)
4170
4242
CompWindow *w = *it;
5811
5883
return priv->struts;
5887
CompWindow::queryAttributes (XWindowAttributes &attrib)
5889
return priv->queryAttributes (attrib);
5893
CompWindow::queryFrameAttributes (XWindowAttributes &attrib)
5895
return priv->queryFrameAttributes (attrib);
5898
crb::Releasable::Ptr
5899
CompWindow::obtainLockOnConfigureRequests ()
5901
return priv->configureBuffer->obtainLock ();
5815
5905
CompWindow::saveMask () const
6442
X11SyncServerWindow::X11SyncServerWindow (Display *dpy,
6444
const Window *frame) :
6452
X11SyncServerWindow::queryAttributes (XWindowAttributes &attrib)
6454
if (XGetWindowAttributes (mDpy, *mWindow, &attrib))
6461
X11SyncServerWindow::queryFrameAttributes (XWindowAttributes &attrib)
6463
Window w = *mFrame ? *mFrame : *mWindow;
6465
if (XGetWindowAttributes (mDpy, w, &attrib))
6472
X11SyncServerWindow::queryShapeRectangles (int kind,
6476
return XShapeGetRectangles (mDpy, *mWindow,
6484
crb::BufferLock::Ptr
6485
createConfigureBufferLock (crb::CountedFreeze *cf)
6487
return boost::make_shared <crb::ConfigureBufferLock> (cf);
6352
6491
PrivateWindow::PrivateWindow () :
6421
6560
syncWait (false),
6422
6561
closeRequests (false),
6423
lastCloseRequestTime (0)
6562
lastCloseRequestTime (0),
6564
syncServerWindow (screen->dpy (),
6568
crb::ConfigureRequestBuffer::Create (
6571
boost::bind (createConfigureBufferLock, _1)))
6425
6573
input.left = 0;
6426
6574
input.right = 0;
6428
6576
input.bottom = 0;
6430
serverInput.left = 0;
6431
serverInput.right = 0;
6432
serverInput.top = 0;
6433
serverInput.bottom = 0;
6578
/* Zero initialize */
6579
serverInput = input;
6580
lastServerInput = input;
6445
6584
syncWaitTimer.setTimes (1000, 1200);
6446
6585
syncWaitTimer.setCallback (boost::bind (&PrivateWindow::handleSyncAlarm,
6648
6787
* whenever the frame extents update
6649
6788
* so that plugins can re-position appropriately */
6650
6789
moveNotify (0, 0, true);
6791
/* Once we have updated everything, re-set lastServerInput */
6792
priv->lastServerInput = priv->serverInput;
6653
6795
/* Use b for _NET_WM_FRAME_EXTENTS here because
6710
6852
XSync (dpy, false);
6711
6853
XGrabServer (dpy);
6713
if (!XGetWindowAttributes (dpy, id, &wa))
6855
/* We need to flush all queued up requests */
6856
foreach (CompWindow *w, screen->windows ())
6857
w->priv->configureBuffer->forceRelease ();
6859
if (!window->priv->queryAttributes (wa))
6715
6861
XUngrabServer (dpy);
6716
6862
XSync (dpy, false);
6997
7143
* a DestroyNotify for it yet, it is possible that restacking
6998
7144
* operations could occurr relative to it so we need to hold it
6999
7145
* in the stack for now. Ensure that it is marked override redirect */
7000
XGetWindowAttributes (screen->dpy (), serverFrame, &attrib);
7146
window->priv->queryFrameAttributes (attrib);
7002
7148
/* Put the frame window "above" the client window
7003
7149
* in the stack */