86
CompositeWindow::setNewPixmapReadyCallback (const NewPixmapReadyCallback &cb)
88
priv->newPixmapReadyCallback = cb;
86
PrivateCompositeWindow::setNewPixmapReadyCallback (const PixmapBinding::NewPixmapReadyCallback &cb)
88
mPixmapBinding.setNewPixmapReadyCallback (cb);
92
CompositeWindow::setNewPixmapReadyCallback (const PixmapBinding::NewPixmapReadyCallback &cb)
94
priv->setNewPixmapReadyCallback (cb);
98
PrivateCompositeWindow::allowFurtherRebindAttempts ()
100
mPixmapBinding.allowFurtherRebindAttempts ();
91
103
PrivateCompositeWindow::PrivateCompositeWindow (CompWindow *w,
95
107
cScreen (CompositeScreen::get (screen)),
98
newPixmapReadyCallback (),
108
mPixmapBinding (boost::function <void ()> (),
111
screen->serverGrabInterface ()),
101
114
redirected (cScreen->compositingActive ()),
102
115
overlayWindow (false),
104
116
opacity (OPAQUE),
105
117
brightness (BRIGHT),
106
118
saturation (COLOR),
128
if (priv->needsRebind)
130
XWindowAttributes attr;
132
/* don't try to bind window again if it failed previously */
133
if (priv->bindFailed)
136
/* We have to grab the server here to make sure that window
137
is mapped when getting the window pixmap */
138
XGrabServer (screen->dpy ());
140
/* Flush changes to the server and wait for it to process them */
141
XSync (screen->dpy (), false);
142
XGetWindowAttributes (screen->dpy (),
143
ROOTPARENT (priv->window), &attr);
144
if (attr.map_state != IsViewable)
146
XUngrabServer (screen->dpy ());
147
XSync (screen->dpy (), false);
148
priv->bindFailed = true;
152
Pixmap newPixmap = XCompositeNameWindowPixmap
153
(screen->dpy (), ROOTPARENT (priv->window));
154
CompSize newSize = CompSize (attr.border_width * 2 + attr.width,
155
attr.border_width * 2 + attr.height);
156
XUngrabServer (screen->dpy ());
157
XSync (screen->dpy (), false);
159
if (newPixmap && newSize.width () && newSize.height ())
161
/* Notify renderer that a new pixmap is about to
163
if (priv->newPixmapReadyCallback)
164
priv->newPixmapReadyCallback ();
166
/* Release old pixmap */
168
XFreePixmap (screen->dpy (), priv->pixmap);
170
/* Assign new pixmap */
171
priv->pixmap = newPixmap;
172
priv->size = newSize;
174
priv->needsRebind = false;
178
priv->bindFailed = true;
179
priv->needsRebind = false;
148
return priv->bind ();
152
PrivateCompositeWindow::release ()
154
mPixmapBinding.release ();
187
158
CompositeWindow::release ()
189
priv->needsRebind = true;
160
return priv->release ();
164
PrivateCompositeWindow::pixmap () const
166
return mPixmapBinding.pixmap ();
169
WindowPixmapInterface::Ptr
170
PrivateCompositeWindow::getPixmap ()
172
Pixmap pixmap = XCompositeNameWindowPixmap (screen->dpy (), ROOTPARENT (window));
173
WindowPixmapInterface::Ptr p (new X11WindowPixmap (screen->dpy (), pixmap));
178
PrivateCompositeWindow::getAttributes (XWindowAttributes &attr)
180
if (XGetWindowAttributes (screen->dpy (),
181
ROOTPARENT (window), &attr))
193
188
CompositeWindow::pixmap ()
195
static Pixmap nPixmap = None;
197
if (priv->needsRebind)
190
return priv->pixmap ();
194
PrivateCompositeWindow::size () const
196
return mPixmapBinding.size ();
204
200
CompositeWindow::size ()
202
return priv->size ();