Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwincompositing/compositing.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 38 | Compositing::Compositing(QObject *parent) | |||
---|---|---|---|---|---|
43 | , m_xrScaleFilter(false) | 43 | , m_xrScaleFilter(false) | ||
44 | , m_glSwapStrategy(0) | 44 | , m_glSwapStrategy(0) | ||
45 | , m_glColorCorrection(false) | 45 | , m_glColorCorrection(false) | ||
46 | , m_compositingType(0) | 46 | , m_compositingType(0) | ||
47 | , m_compositingEnabled(true) | 47 | , m_compositingEnabled(true) | ||
48 | , m_changed(false) | 48 | , m_changed(false) | ||
49 | , m_openGLPlatformInterfaceModel(new OpenGLPlatformInterfaceModel(this)) | 49 | , m_openGLPlatformInterfaceModel(new OpenGLPlatformInterfaceModel(this)) | ||
50 | , m_openGLPlatformInterface(0) | 50 | , m_openGLPlatformInterface(0) | ||
51 | , m_windowsBlockingCompositing(true) | ||||
51 | { | 52 | { | ||
52 | reset(); | 53 | reset(); | ||
53 | connect(this, &Compositing::animationSpeedChanged, this, &Compositing::changed); | 54 | connect(this, &Compositing::animationSpeedChanged, this, &Compositing::changed); | ||
54 | connect(this, &Compositing::windowThumbnailChanged, this, &Compositing::changed); | 55 | connect(this, &Compositing::windowThumbnailChanged, this, &Compositing::changed); | ||
55 | connect(this, &Compositing::glScaleFilterChanged, this, &Compositing::changed); | 56 | connect(this, &Compositing::glScaleFilterChanged, this, &Compositing::changed); | ||
56 | connect(this, &Compositing::xrScaleFilterChanged, this, &Compositing::changed); | 57 | connect(this, &Compositing::xrScaleFilterChanged, this, &Compositing::changed); | ||
57 | connect(this, &Compositing::glSwapStrategyChanged, this, &Compositing::changed); | 58 | connect(this, &Compositing::glSwapStrategyChanged, this, &Compositing::changed); | ||
58 | connect(this, &Compositing::glColorCorrectionChanged, this, &Compositing::changed); | 59 | connect(this, &Compositing::glColorCorrectionChanged, this, &Compositing::changed); | ||
59 | connect(this, &Compositing::compositingTypeChanged, this, &Compositing::changed); | 60 | connect(this, &Compositing::compositingTypeChanged, this, &Compositing::changed); | ||
60 | connect(this, &Compositing::compositingEnabledChanged, this, &Compositing::changed); | 61 | connect(this, &Compositing::compositingEnabledChanged, this, &Compositing::changed); | ||
61 | connect(this, &Compositing::openGLPlatformInterfaceChanged, this, &Compositing::changed); | 62 | connect(this, &Compositing::openGLPlatformInterfaceChanged, this, &Compositing::changed); | ||
63 | connect(this, &Compositing::windowsBlockingCompositingChanged, this, &Compositing::changed); | ||||
62 | 64 | | |||
63 | connect(this, &Compositing::changed, [this]{ | 65 | connect(this, &Compositing::changed, [this]{ | ||
64 | m_changed = true; | 66 | m_changed = true; | ||
65 | }); | 67 | }); | ||
66 | } | 68 | } | ||
67 | 69 | | |||
68 | void Compositing::reset() | 70 | void Compositing::reset() | ||
69 | { | 71 | { | ||
Show All 37 Lines | 108 | } else { | |||
107 | return CompositingType::XRENDER_INDEX; | 109 | return CompositingType::XRENDER_INDEX; | ||
108 | } | 110 | } | ||
109 | }; | 111 | }; | ||
110 | setCompositingType(type()); | 112 | setCompositingType(type()); | ||
111 | 113 | | |||
112 | const QModelIndex index = m_openGLPlatformInterfaceModel->indexForKey(kwinConfig.readEntry("GLPlatformInterface", "glx")); | 114 | const QModelIndex index = m_openGLPlatformInterfaceModel->indexForKey(kwinConfig.readEntry("GLPlatformInterface", "glx")); | ||
113 | setOpenGLPlatformInterface(index.isValid() ? index.row() : 0); | 115 | setOpenGLPlatformInterface(index.isValid() ? index.row() : 0); | ||
114 | 116 | | |||
117 | setWindowsBlockingCompositing(kwinConfig.readEntry("WindowsBlockingCompositing", true)); | ||||
118 | | ||||
115 | m_changed = false; | 119 | m_changed = false; | ||
116 | } | 120 | } | ||
117 | 121 | | |||
118 | void Compositing::defaults() | 122 | void Compositing::defaults() | ||
119 | { | 123 | { | ||
120 | setAnimationSpeed(3); | 124 | setAnimationSpeed(3); | ||
121 | setWindowThumbnail(1); | 125 | setWindowThumbnail(1); | ||
122 | setGlScaleFilter(2); | 126 | setGlScaleFilter(2); | ||
123 | setXrScaleFilter(false); | 127 | setXrScaleFilter(false); | ||
124 | setGlSwapStrategy(1); | 128 | setGlSwapStrategy(1); | ||
125 | setGlColorCorrection(false); | 129 | setGlColorCorrection(false); | ||
126 | setCompositingType(CompositingType::OPENGL20_INDEX); | 130 | setCompositingType(CompositingType::OPENGL20_INDEX); | ||
127 | const QModelIndex index = m_openGLPlatformInterfaceModel->indexForKey(QStringLiteral("glx")); | 131 | const QModelIndex index = m_openGLPlatformInterfaceModel->indexForKey(QStringLiteral("glx")); | ||
128 | setOpenGLPlatformInterface(index.isValid() ? index.row() : 0); | 132 | setOpenGLPlatformInterface(index.isValid() ? index.row() : 0); | ||
133 | setWindowsBlockingCompositing(true); | ||||
129 | m_changed = true; | 134 | m_changed = true; | ||
130 | } | 135 | } | ||
131 | 136 | | |||
132 | bool Compositing::OpenGLIsUnsafe() const | 137 | bool Compositing::OpenGLIsUnsafe() const | ||
133 | { | 138 | { | ||
134 | KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing"); | 139 | KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing"); | ||
135 | return kwinConfig.readEntry("OpenGLIsUnsafe", true); | 140 | return kwinConfig.readEntry("OpenGLIsUnsafe", true); | ||
136 | } | 141 | } | ||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | 321 | case CompositingType::XRENDER_INDEX: | |||
319 | break; | 324 | break; | ||
320 | } | 325 | } | ||
321 | kwinConfig.writeEntry("Backend", backend); | 326 | kwinConfig.writeEntry("Backend", backend); | ||
322 | kwinConfig.writeEntry("GLCore", glCore); | 327 | kwinConfig.writeEntry("GLCore", glCore); | ||
323 | const QModelIndex glIndex = m_openGLPlatformInterfaceModel->index(m_openGLPlatformInterface); | 328 | const QModelIndex glIndex = m_openGLPlatformInterfaceModel->index(m_openGLPlatformInterface); | ||
324 | if (glIndex.isValid()) { | 329 | if (glIndex.isValid()) { | ||
325 | kwinConfig.writeEntry("GLPlatformInterface", glIndex.data(Qt::UserRole).toString()); | 330 | kwinConfig.writeEntry("GLPlatformInterface", glIndex.data(Qt::UserRole).toString()); | ||
326 | } | 331 | } | ||
332 | kwinConfig.writeEntry("WindowsBlockingCompositing", isWindowsBlockingCompositing()); | ||||
327 | kwinConfig.sync(); | 333 | kwinConfig.sync(); | ||
328 | 334 | | |||
329 | if (m_changed) { | 335 | if (m_changed) { | ||
330 | // Send signal to all kwin instances | 336 | // Send signal to all kwin instances | ||
331 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/Compositor"), | 337 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/Compositor"), | ||
332 | QStringLiteral("org.kde.kwin.Compositing"), | 338 | QStringLiteral("org.kde.kwin.Compositing"), | ||
333 | QStringLiteral("reinit")); | 339 | QStringLiteral("reinit")); | ||
334 | QDBusConnection::sessionBus().send(message); | 340 | QDBusConnection::sessionBus().send(message); | ||
Show All 15 Lines | |||||
350 | { | 356 | { | ||
351 | if (m_openGLPlatformInterface == interface) { | 357 | if (m_openGLPlatformInterface == interface) { | ||
352 | return; | 358 | return; | ||
353 | } | 359 | } | ||
354 | m_openGLPlatformInterface = interface; | 360 | m_openGLPlatformInterface = interface; | ||
355 | emit openGLPlatformInterfaceChanged(interface); | 361 | emit openGLPlatformInterfaceChanged(interface); | ||
356 | } | 362 | } | ||
357 | 363 | | |||
364 | bool Compositing::isWindowsBlockingCompositing() const | ||||
365 | { | ||||
366 | return m_windowsBlockingCompositing; | ||||
367 | } | ||||
368 | | ||||
369 | void Compositing::setWindowsBlockingCompositing(bool set) | ||||
370 | { | ||||
371 | if (m_windowsBlockingCompositing == set) { | ||||
372 | return; | ||||
373 | } | ||||
374 | m_windowsBlockingCompositing = set; | ||||
375 | emit windowsBlockingCompositingChanged(set); | ||||
376 | } | ||||
377 | | ||||
358 | CompositingType::CompositingType(QObject *parent) | 378 | CompositingType::CompositingType(QObject *parent) | ||
359 | : QAbstractItemModel(parent) { | 379 | : QAbstractItemModel(parent) { | ||
360 | 380 | | |||
361 | generateCompositing(); | 381 | generateCompositing(); | ||
362 | } | 382 | } | ||
363 | 383 | | |||
364 | void CompositingType::generateCompositing() | 384 | void CompositingType::generateCompositing() | ||
365 | { | 385 | { | ||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |