summaryrefslogtreecommitdiff
path: root/src/screen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.cpp')
-rw-r--r--src/screen.cpp202
1 files changed, 2 insertions, 200 deletions
diff --git a/src/screen.cpp b/src/screen.cpp
index fb76b61..09ae503 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -110,72 +110,6 @@ CompScreen::freePluginClassIndex (unsigned int index)
screen->pluginClasses.resize (screenPluginClassIndices.size ());
}
-Glib::RefPtr <CompEventSource>
-CompEventSource::create ()
-{
- return Glib::RefPtr <CompEventSource> (new CompEventSource ());
-}
-
-sigc::connection
-CompEventSource::connect (const sigc::slot <bool> &slot)
-{
- return connect_generic (slot);
-}
-
-CompEventSource::CompEventSource () :
- Glib::Source (),
- mDpy (screen->dpy ()),
- mConnectionFD (ConnectionNumber (screen->dpy ()))
-{
- mPollFD.set_fd (mConnectionFD);
- mPollFD.set_events (Glib::IO_IN);
-
- set_priority (G_PRIORITY_DEFAULT);
- add_poll (mPollFD);
- set_can_recurse (true);
-
- connect (sigc::mem_fun <bool, CompEventSource> (this, &CompEventSource::callback));
-}
-
-CompEventSource::~CompEventSource ()
-{
-}
-
-bool
-CompEventSource::callback ()
-{
- if (restartSignal || shutDown)
- {
- screen->priv->mainloop->quit ();
- return false;
- }
- else
- screen->priv->processEvents ();
- return true;
-}
-
-bool
-CompEventSource::prepare (int &timeout)
-{
- timeout = -1;
- return XPending (mDpy);
-}
-
-bool
-CompEventSource::check ()
-{
- if (mPollFD.get_revents () & Glib::IO_IN)
- return XPending (mDpy);
-
- return false;
-}
-
-bool
-CompEventSource::dispatch (sigc::slot_base *slot)
-{
- return (*static_cast <sigc::slot <bool> *> (slot)) ();
-}
-
void
CompScreen::eventLoop ()
{
@@ -191,6 +125,7 @@ CompScreen::eventLoop ()
priv->mainloop->run ();
}
+
CompFileWatchHandle
CompScreen::addFileWatch (const char *path,
int mask,
@@ -242,136 +177,6 @@ CompScreen::getFileWatches () const
return priv->fileWatch;
}
-CompTimeoutSource::CompTimeoutSource () :
- Glib::Source ()
-{
- struct timespec ts;
-
- clock_gettime (CLOCK_MONOTONIC, &ts);
-
- mLastTimeout = ts;
-
- set_priority (G_PRIORITY_HIGH);
- attach (screen->priv->ctx);
- connect (sigc::mem_fun <bool, CompTimeoutSource> (this, &CompTimeoutSource::callback));
-}
-
-CompTimeoutSource::~CompTimeoutSource ()
-{
-}
-
-sigc::connection
-CompTimeoutSource::connect (const sigc::slot <bool> &slot)
-{
- return connect_generic (slot);
-}
-
-Glib::RefPtr <CompTimeoutSource>
-CompTimeoutSource::create ()
-{
- return Glib::RefPtr <CompTimeoutSource> (new CompTimeoutSource ());
-}
-
-#define COMPIZ_TIMEOUT_WAIT 15
-
-bool
-CompTimeoutSource::prepare (int &timeout)
-{
- struct timespec ts;
-
- clock_gettime (CLOCK_MONOTONIC, &ts);
-
- /* Determine time to wait */
-
- if (screen->priv->timers.empty ())
- {
- /* This kind of sucks, but we have to do it, considering
- * that glib provides us no safe way to remove the source -
- * thankfully we shouldn't ever be hitting this case since
- * we create the source after we start pingTimer
- * and that doesn't stop until compiz does
- */
-
- timeout = COMPIZ_TIMEOUT_WAIT;
- return true;
- }
-
- if (screen->priv->timers.front ()->mMinLeft > 0)
- {
- std::list<CompTimer *>::iterator it = screen->priv->timers.begin ();
-
- CompTimer *t = (*it);
- timeout = t->mMaxLeft;
- while (it != screen->priv->timers.end ())
- {
- t = (*it);
- if (t->mMinLeft >= timeout)
- break;
- if (t->mMaxLeft < timeout)
- timeout = t->mMaxLeft;
- it++;
- }
-
- mLastTimeout = ts;
- return false;
- }
- else
- {
- mLastTimeout = ts;
- timeout = 0;
- return true;
- }
-}
-
-bool
-CompTimeoutSource::check ()
-{
- struct timespec ts;
- int timeDiff;
-
- clock_gettime (CLOCK_MONOTONIC, &ts);
- timeDiff = TIMESPECDIFF (&ts, &mLastTimeout);
-
- if (timeDiff < 0)
- timeDiff = 0;
-
- foreach (CompTimer *t, screen->priv->timers)
- {
- t->mMinLeft -= timeDiff;
- t->mMaxLeft -= timeDiff;
- }
-
- return screen->priv->timers.front ()->mMinLeft <= 0;
-}
-
-bool
-CompTimeoutSource::dispatch (sigc::slot_base *slot)
-{
- (*static_cast <sigc::slot <bool> *> (slot)) ();
-
- return true;
-}
-
-bool
-CompTimeoutSource::callback ()
-{
- while (screen->priv->timers.begin () != screen->priv->timers.end () &&
- screen->priv->timers.front ()->mMinLeft <= 0)
- {
- CompTimer *t = screen->priv->timers.front ();
- screen->priv->timers.pop_front ();
-
- t->mActive = false;
- if (t->mCallBack ())
- {
- screen->priv->addTimer (t);
- t->mActive = true;
- }
- }
-
- return !screen->priv->timers.empty ();
-}
-
void
PrivateScreen::addTimer (CompTimer *timer)
{
@@ -565,10 +370,7 @@ CompWatchFd::internalCallback (Glib::IOCondition events)
}
return true;
-}
-
-
-
+}
void
CompScreen::eraseValue (CompString key)