~ubuntu-branches/ubuntu/oneiric/compiz/oneiric-proposed

« back to all changes in this revision

Viewing changes to src/screen.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-07-19 08:00:29 UTC
  • mfrom: (0.168.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20110719080029-zn4l32f34modz570
Tags: 1:0.9.5.0-0ubuntu1
* New upstream release:
  - unity window decorator needs to support different metacity frame types
    (LP: #795048)
  - firefox window mapped fullscreen gets mapped under gnome-panel
    (LP: #800592)
* Switch to dpkg-source 3.0 (quilt) format
* remove all debian/patches/*:
  - upstream now directly deliver with our patches
* debian/control:
  - replace kdebase-workspace-dev build-dep by kde-workspace-dev
  - build on libdecoration0-dev to build the unity window decorator
  - make compiz-dev dep on gtk-3
* debian/compiz-plugins-default.install:
  - grid is now in -main
* debian/libdecoration0.symbols:
  - add new symbols
* debian/patches/01_don_t_init_a11y.patch:
  - don't initialize the GAIL and AT bridges when comipz initialize
    (LP: #810045)

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
    priv->ctx = Glib::MainContext::get_default ();
119
119
    priv->mainloop = Glib::MainLoop::create (priv->ctx, false);
120
120
    priv->source = CompEventSource::create ();
121
 
    priv->timeout = CompTimeoutSource::create ();
 
121
    priv->timeout = CompTimeoutSource::create (priv->ctx);
122
122
 
123
123
    priv->source->attach (priv->ctx);
124
124
 
179
179
    return priv->fileWatch;
180
180
}
181
181
 
182
 
void
183
 
PrivateScreen::addTimer (CompTimer *timer)
184
 
{
185
 
    std::list<CompTimer *>::iterator it;
186
 
 
187
 
    it = std::find (timers.begin (), timers.end (), timer);
188
 
 
189
 
    if (it != timers.end ())
190
 
        return;
191
 
 
192
 
    for (it = timers.begin (); it != timers.end (); it++)
193
 
    {
194
 
        if ((int) timer->mMinTime < (*it)->mMinLeft)
195
 
            break;
196
 
    }
197
 
 
198
 
    timer->mMinLeft = timer->mMinTime;
199
 
    timer->mMaxLeft = timer->mMaxTime;
200
 
 
201
 
    timers.insert (it, timer);
202
 
}
203
 
 
204
 
void
205
 
PrivateScreen::removeTimer (CompTimer *timer)
206
 
{
207
 
    std::list<CompTimer *>::iterator it;
208
 
 
209
 
    it = std::find (timers.begin (), timers.end (), timer);
210
 
 
211
 
    if (it == timers.end ())
212
 
        return;
213
 
 
214
 
    timers.erase (it);
215
 
}
216
 
 
217
182
CompWatchFd::CompWatchFd (int               fd,
218
183
                          Glib::IOCondition events,
219
184
                          FdWatchCallBack   callback) :
302
267
void
303
268
CompScreen::storeValue (CompString key, CompPrivate value)
304
269
{
305
 
    std::map<CompString,CompPrivate>::iterator it;
306
 
 
307
 
    it = priv->valueMap.find (key);
308
 
 
309
 
    if (it != priv->valueMap.end ())
310
 
    {
311
 
        it->second = value;
312
 
    }
313
 
    else
314
 
    {
315
 
        priv->valueMap.insert (std::pair<CompString,CompPrivate> (key, value));
316
 
    }
 
270
    ValueHolder::Default ()->storeValue (key, value);
317
271
}
318
272
 
319
273
bool
320
274
CompScreen::hasValue (CompString key)
321
275
{
322
 
    return (priv->valueMap.find (key) != priv->valueMap.end ());
 
276
    return ValueHolder::Default ()->hasValue (key);
323
277
}
324
278
 
325
279
CompPrivate
326
280
CompScreen::getValue (CompString key)
327
281
{
328
 
    CompPrivate p;
329
 
 
330
 
    std::map<CompString,CompPrivate>::iterator it;
331
 
    it = priv->valueMap.find (key);
332
 
 
333
 
    if (it != priv->valueMap.end ())
334
 
    {
335
 
        return it->second;
336
 
    }
337
 
    else
338
 
    {
339
 
        p.uval = 0;
340
 
        return p;
341
 
    }
 
282
    return ValueHolder::Default ()->getValue (key);
342
283
}
343
284
 
344
285
bool
377
318
void
378
319
CompScreen::eraseValue (CompString key)
379
320
{
380
 
    std::map<CompString,CompPrivate>::iterator it;
381
 
    it = priv->valueMap.find (key);
382
 
 
383
 
    if (it != priv->valueMap.end ())
384
 
    {
385
 
        priv->valueMap.erase (key);
386
 
    }
 
321
    ValueHolder::Default ()->eraseValue (key);
387
322
}
388
323
 
389
324
void
1165
1100
    return false;
1166
1101
}
1167
1102
 
1168
 
const char *
1169
 
logLevelToString (CompLogLevel level)
1170
 
{
1171
 
    switch (level) {
1172
 
    case CompLogLevelFatal:
1173
 
        return "Fatal";
1174
 
    case CompLogLevelError:
1175
 
        return "Error";
1176
 
    case CompLogLevelWarn:
1177
 
        return "Warn";
1178
 
    case CompLogLevelInfo:
1179
 
        return "Info";
1180
 
    case CompLogLevelDebug:
1181
 
        return "Debug";
1182
 
    default:
1183
 
        break;
1184
 
    }
1185
 
 
1186
 
    return "Unknown";
1187
 
}
1188
 
 
1189
 
static void
1190
 
logMessage (const char   *componentName,
1191
 
            CompLogLevel level,
1192
 
            const char   *message)
1193
 
{
1194
 
    if (!debugOutput && level >= CompLogLevelDebug)
1195
 
        return;
1196
 
 
1197
 
    fprintf (stderr, "%s (%s) - %s: %s\n",
1198
 
             programName, componentName,
1199
 
             logLevelToString (level), message);
1200
 
}
1201
 
 
1202
1103
void
1203
1104
CompScreen::logMessage (const char   *componentName,
1204
1105
                        CompLogLevel level,
1208
1109
    ::logMessage (componentName, level, message);
1209
1110
}
1210
1111
 
1211
 
void
1212
 
compLogMessage (const char   *componentName,
1213
 
                CompLogLevel level,
1214
 
                const char   *format,
1215
 
                ...)
1216
 
{
1217
 
    va_list args;
1218
 
    char    message[2048];
1219
 
 
1220
 
    va_start (args, format);
1221
 
 
1222
 
    vsnprintf (message, 2048, format, args);
1223
 
 
1224
 
    if (screen)
1225
 
        screen->logMessage (componentName, level, message);
1226
 
    else
1227
 
        logMessage (componentName, level, message);
1228
 
 
1229
 
    va_end (args);
1230
 
}
1231
 
 
1232
1112
int
1233
1113
PrivateScreen::getWmState (Window id)
1234
1114
{
2154
2034
    {
2155
2035
        priv->attrib.width  = ce->width;
2156
2036
        priv->attrib.height = ce->height;
 
2037
    }
2157
2038
 
2158
2039
        priv->reshape (ce->width, ce->height);
2159
2040
 
2160
2041
        priv->detectOutputDevices ();
2161
 
    }
2162
2042
}
2163
2043
 
2164
2044
void
4447
4327
                        "already running on screen: %d", DefaultScreen (dpy));
4448
4328
 
4449
4329
        XUngrabServer (dpy);
4450
 
        XSync (dpy, false);
4451
4330
        return false;
4452
4331
    }
4453
4332
 
4559
4438
                         XA_ATOM, 32, PropModeReplace,
4560
4439
                         (unsigned char *) &xdndVersion, 1);
4561
4440
 
 
4441
        /* CompWindow::CompWindow will select for
 
4442
         * crossing events when it gets called on
 
4443
         * CreateNotify of this window, so no need
 
4444
         * to select for them here */
4562
4445
        XSelectInput (dpy, priv->screenEdge[i].id,
4563
 
                      EnterWindowMask   |
4564
 
                      LeaveWindowMask   |
4565
4446
                      ButtonPressMask   |
4566
4447
                      ButtonReleaseMask |
4567
4448
                      PointerMotionMask);
4579
4460
    XDefineCursor (dpy, priv->root, priv->normalCursor);
4580
4461
 
4581
4462
    XUngrabServer (dpy);
4582
 
    XSync (dpy, false);
 
4463
    XSync (dpy, FALSE);
4583
4464
 
4584
4465
    priv->setAudibleBell (priv->optionGetAudibleBell ());
4585
4466
 
4633
4514
        if (!XGetWindowAttributes (screen->dpy (), children[i], &attrib))
4634
4515
            priv->setDefaultWindowAttributes (&attrib);
4635
4516
 
4636
 
        fprintf (stderr, "Window created on XQueryTree, map state isViewable? %i\n", attrib.map_state == IsViewable);
4637
 
 
4638
 
        CoreWindow *cw = new CoreWindow (children[i]);
 
4517
        CoreWindow *cw = new CoreWindow (children[i]);
4639
4518
        cw->manage (i ? children[i - 1] : 0, attrib);
4640
4519
 
4641
4520
        priv->createdWindows.remove (cw);
4774
4653
    xdndWindow (None),
4775
4654
    initialized (false)
4776
4655
{
4777
 
    gettimeofday (&lastTimeout, 0);
 
4656
    TimeoutHandler *dTimeoutHandler = new TimeoutHandler ();
 
4657
    ValueHolder::SetDefault (static_cast<ValueHolder *> (this));
4778
4658
 
4779
4659
    pingTimer.setCallback (
4780
4660
        boost::bind (&PrivateScreen::handlePingTimeout, this));
4815
4695
        CompScreen::toggleWinMaximizedVertically);
4816
4696
 
4817
4697
    optionSetToggleWindowShadedKeyInitiate (CompScreen::shadeWin);
 
4698
 
 
4699
    TimeoutHandler::SetDefault (dTimeoutHandler);
4818
4700
}
4819
4701
 
4820
4702
PrivateScreen::~PrivateScreen ()