Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | |||||
116 | }; | 116 | }; | ||
117 | 117 | | |||
118 | static inline qint64 milliToNano(int milli) { return qint64(milli) * 1000 * 1000; } | 118 | static inline qint64 milliToNano(int milli) { return qint64(milli) * 1000 * 1000; } | ||
119 | static inline qint64 nanoToMilli(int nano) { return nano / (1000*1000); } | 119 | static inline qint64 nanoToMilli(int nano) { return nano / (1000*1000); } | ||
120 | 120 | | |||
121 | Compositor::Compositor(QObject* workspace) | 121 | Compositor::Compositor(QObject* workspace) | ||
122 | : QObject(workspace) | 122 | : QObject(workspace) | ||
123 | , m_state(State::Off) | 123 | , m_state(State::Off) | ||
124 | , m_selectionOwner(NULL) | 124 | , m_selectionOwner(nullptr) | ||
125 | , vBlankInterval(0) | 125 | , vBlankInterval(0) | ||
126 | , fpsInterval(0) | 126 | , fpsInterval(0) | ||
127 | , m_timeSinceLastVBlank(0) | 127 | , m_timeSinceLastVBlank(0) | ||
128 | , m_scene(NULL) | 128 | , m_scene(nullptr) | ||
129 | , m_bufferSwapPending(false) | 129 | , m_bufferSwapPending(false) | ||
130 | , m_composeAtSwapCompletion(false) | 130 | , m_composeAtSwapCompletion(false) | ||
131 | { | 131 | { | ||
132 | connect(options, &Options::configChanged, this, &Compositor::configChanged); | 132 | connect(options, &Options::configChanged, this, &Compositor::configChanged); | ||
133 | 133 | | |||
134 | m_monotonicClock.start(); | 134 | m_monotonicClock.start(); | ||
135 | 135 | | |||
136 | // 2 sec which should be enough to restart the compositor. | 136 | // 2 sec which should be enough to restart the compositor. | ||
Show All 34 Lines | |||||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | Compositor::~Compositor() | 173 | Compositor::~Compositor() | ||
174 | { | 174 | { | ||
175 | emit aboutToDestroy(); | 175 | emit aboutToDestroy(); | ||
176 | stop(); | 176 | stop(); | ||
177 | deleteUnusedSupportProperties(); | 177 | deleteUnusedSupportProperties(); | ||
178 | destroyCompositorSelection(); | 178 | destroyCompositorSelection(); | ||
179 | s_compositor = NULL; | 179 | s_compositor = nullptr; | ||
180 | } | 180 | } | ||
181 | 181 | | |||
182 | bool Compositor::setupStart() | 182 | bool Compositor::setupStart() | ||
183 | { | 183 | { | ||
184 | if (kwinApp()->isTerminating()) { | 184 | if (kwinApp()->isTerminating()) { | ||
185 | // Don't start while KWin is terminating. An event to restart might be lingering | 185 | // Don't start while KWin is terminating. An event to restart might be lingering | ||
186 | // in the event queue due to graphics reset. | 186 | // in the event queue due to graphics reset. | ||
187 | return false; | 187 | return false; | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 244 | } else { | |||
245 | delete m_scene; | 245 | delete m_scene; | ||
246 | m_scene = nullptr; | 246 | m_scene = nullptr; | ||
247 | } | 247 | } | ||
248 | } | 248 | } | ||
249 | } | 249 | } | ||
250 | } | 250 | } | ||
251 | } | 251 | } | ||
252 | 252 | | |||
253 | if (m_scene == NULL || m_scene->initFailed()) { | 253 | if (m_scene == nullptr || m_scene->initFailed()) { | ||
254 | qCCritical(KWIN_CORE) << "Failed to initialize compositing, compositing disabled"; | 254 | qCCritical(KWIN_CORE) << "Failed to initialize compositing, compositing disabled"; | ||
255 | m_state = State::Off; | 255 | m_state = State::Off; | ||
256 | 256 | | |||
257 | delete m_scene; | 257 | delete m_scene; | ||
258 | m_scene = NULL; | 258 | m_scene = nullptr; | ||
259 | 259 | | |||
260 | if (m_selectionOwner) { | 260 | if (m_selectionOwner) { | ||
261 | m_selectionOwner->setOwning(false); | 261 | m_selectionOwner->setOwning(false); | ||
262 | m_selectionOwner->release(); | 262 | m_selectionOwner->release(); | ||
263 | } | 263 | } | ||
264 | if (!supportedCompositors.contains(NoCompositing)) { | 264 | if (!supportedCompositors.contains(NoCompositing)) { | ||
265 | qCCritical(KWIN_CORE) << "The used windowing system requires compositing"; | 265 | qCCritical(KWIN_CORE) << "The used windowing system requires compositing"; | ||
266 | qCCritical(KWIN_CORE) << "We are going to quit KWin now as it is broken"; | 266 | qCCritical(KWIN_CORE) << "We are going to quit KWin now as it is broken"; | ||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Line(s) | 443 | for (ShellClient *c : waylandServer()->clients()) { | |||
444 | c->finishCompositing(); | 444 | c->finishCompositing(); | ||
445 | } | 445 | } | ||
446 | for (ShellClient *c : waylandServer()->internalClients()) { | 446 | for (ShellClient *c : waylandServer()->internalClients()) { | ||
447 | c->finishCompositing(); | 447 | c->finishCompositing(); | ||
448 | } | 448 | } | ||
449 | } | 449 | } | ||
450 | 450 | | |||
451 | delete m_scene; | 451 | delete m_scene; | ||
452 | m_scene = NULL; | 452 | m_scene = nullptr; | ||
453 | compositeTimer.stop(); | 453 | compositeTimer.stop(); | ||
454 | repaints_region = QRegion(); | 454 | repaints_region = QRegion(); | ||
455 | 455 | | |||
456 | m_state = State::Off; | 456 | m_state = State::Off; | ||
457 | emit compositingToggled(false); | 457 | emit compositingToggled(false); | ||
458 | } | 458 | } | ||
459 | 459 | | |||
460 | void Compositor::destroyCompositorSelection() | 460 | void Compositor::destroyCompositorSelection() | ||
▲ Show 20 Lines • Show All 588 Lines • Show Last 20 Lines |