~ubuntu-branches/ubuntu/trusty/compiz/trusty

« back to all changes in this revision

Viewing changes to tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-08-22 06:58:07 UTC
  • mto: This revision was merged to the branch mainline in revision 3352.
  • Revision ID: package-import@ubuntu.com-20130822065807-17nlzez0d30y09so
Tags: upstream-0.9.10+13.10.20130822
ImportĀ upstreamĀ versionĀ 0.9.10+13.10.20130822

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
void
142
142
TestHelperWindow::setFrameExtentsAndReport (long *data)
143
143
{
144
 
    CompWindowExtents input;
145
 
 
146
 
    input.left = data[0];
147
 
    input.right = data[1];
148
 
    input.top = data[2];
149
 
    input.bottom = data[3];
150
 
 
151
 
    window->setWindowFrameExtents (&input, &input);
 
144
    /* Only change the frame input and not the border */
 
145
    CompWindowExtents input (data[0], data[1], data[2], data[3]);
 
146
    CompWindowExtents border (0, 0, 0, 0);
 
147
 
 
148
    window->setWindowFrameExtents (&border, &input);
152
149
 
153
150
    std::vector <long> response;
154
151
 
181
178
    }
182
179
}
183
180
 
 
181
void
 
182
TestHelperWindow::setDestroyOnReparent (long *)
 
183
{
 
184
    destroyOnReparent = true;
 
185
}
 
186
 
 
187
void
 
188
TestHelperWindow::restackAtLeastAbove (long *data)
 
189
{
 
190
    ServerLock lock (screen->serverGrabInterface ());
 
191
 
 
192
    Window            above = data[0];
 
193
    XWindowAttributes attrib;
 
194
 
 
195
    if (!XGetWindowAttributes (screen->dpy (), above, &attrib))
 
196
        return;
 
197
 
 
198
    CompWindow *w = screen->findTopLevelWindow (above, true);
 
199
    for (; w; w = w->next)
 
200
        if (!w->overrideRedirect ())
 
201
            break;
 
202
 
 
203
    if (!w)
 
204
        return;
 
205
 
 
206
    XWindowChanges xwc;
 
207
 
 
208
    xwc.stack_mode = Above;
 
209
    xwc.sibling = w->frame () ? w->frame () : w->id ();
 
210
 
 
211
    window->restackAndConfigureXWindow (CWStackMode | CWSibling,
 
212
                                        &xwc,
 
213
                                        lock);
 
214
}
 
215
 
 
216
void
 
217
TestHelperWindow::windowNotify (CompWindowNotify n)
 
218
{
 
219
    switch (n)
 
220
    {
 
221
        case CompWindowNotifyReparent:
 
222
            if (destroyOnReparent)
 
223
            {
 
224
                Window id = window->id ();
 
225
                window->destroy ();
 
226
                XDestroyWindow (screen->dpy (), id);
 
227
            }
 
228
            break;
 
229
        default:
 
230
            break;
 
231
    }
 
232
 
 
233
    window->windowNotify (n);
 
234
}
 
235
 
184
236
TestHelperWindow::TestHelperWindow (CompWindow *w) :
185
237
    PluginClassHandler <TestHelperWindow, CompWindow> (w),
186
238
    window (w),
187
 
    configureLock ()
 
239
    configureLock (),
 
240
    destroyOnReparent (false)
188
241
{
189
242
    WindowInterface::setHandler (w);
190
243
 
214
267
                     &TestHelperWindow::setFrameExtentsAndReport);
215
268
    watchForMessage (fetchAtom (ctm::TEST_HELPER_LOCK_CONFIGURE_REQUESTS),
216
269
                     &TestHelperWindow::setConfigureLock);
 
270
    watchForMessage (fetchAtom (ctm::TEST_HELPER_DESTROY_ON_REPARENT),
 
271
                     &TestHelperWindow::setDestroyOnReparent);
 
272
    watchForMessage (fetchAtom (ctm::TEST_HELPER_RESTACK_ATLEAST_ABOVE),
 
273
                     &TestHelperWindow::restackAtLeastAbove);
217
274
 
218
275
    ct::SendClientMessage (s->dpy (),
219
276
                           mAtomStore.FetchForString (ctm::TEST_HELPER_READY_MSG),
225
282
bool
226
283
TestHelperPluginVTable::init ()
227
284
{
228
 
    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
229
 
        return false;
 
285
    if (CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
 
286
        return true;
230
287
 
231
 
    return true;
 
288
    return false;
232
289
}