Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/glxbackend.cpp
Show All 32 Lines | |||||
33 | #include "platform.h" | 33 | #include "platform.h" | ||
34 | #include "scene.h" | 34 | #include "scene.h" | ||
35 | #include "screens.h" | 35 | #include "screens.h" | ||
36 | #include "xcbutils.h" | 36 | #include "xcbutils.h" | ||
37 | #include "texture.h" | 37 | #include "texture.h" | ||
38 | // kwin libs | 38 | // kwin libs | ||
39 | #include <kwinglplatform.h> | 39 | #include <kwinglplatform.h> | ||
40 | #include <kwinglutils.h> | 40 | #include <kwinglutils.h> | ||
41 | #include <kwineffectquickview.h> | ||||
41 | #include <kwinxrenderutils.h> | 42 | #include <kwinxrenderutils.h> | ||
42 | // Qt | 43 | // Qt | ||
43 | #include <QDebug> | 44 | #include <QDebug> | ||
44 | #include <QOpenGLContext> | 45 | #include <QOpenGLContext> | ||
45 | #include <QX11Info> | 46 | #include <QX11Info> | ||
47 | #include <QtPlatformHeaders/QGLXNativeContext> | ||||
46 | // system | 48 | // system | ||
47 | #include <unistd.h> | 49 | #include <unistd.h> | ||
48 | 50 | | |||
49 | #include <deque> | 51 | #include <deque> | ||
50 | #include <algorithm> | 52 | #include <algorithm> | ||
51 | #if HAVE_DL_LIBRARY | 53 | #if HAVE_DL_LIBRARY | ||
52 | #include <dlfcn.h> | 54 | #include <dlfcn.h> | ||
53 | #endif | 55 | #endif | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
132 | { | 134 | { | ||
133 | if (isFailed()) { | 135 | if (isFailed()) { | ||
134 | m_overlayWindow->destroy(); | 136 | m_overlayWindow->destroy(); | ||
135 | } | 137 | } | ||
136 | // TODO: cleanup in error case | 138 | // TODO: cleanup in error case | ||
137 | // do cleanup after initBuffer() | 139 | // do cleanup after initBuffer() | ||
138 | cleanupGL(); | 140 | cleanupGL(); | ||
139 | doneCurrent(); | 141 | doneCurrent(); | ||
142 | EffectQuickView::setShareContext(nullptr); | ||||
140 | 143 | | |||
141 | gs_tripleBufferUndetected = true; | 144 | gs_tripleBufferUndetected = true; | ||
142 | gs_tripleBufferNeedsDetection = false; | 145 | gs_tripleBufferNeedsDetection = false; | ||
143 | 146 | | |||
144 | if (ctx) | 147 | if (ctx) | ||
145 | glXDestroyContext(display(), ctx); | 148 | glXDestroyContext(display(), ctx); | ||
146 | 149 | | |||
147 | if (glxWindow) | 150 | if (glxWindow) | ||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Line(s) | 298 | { | |||
354 | 357 | | |||
355 | if (!glXMakeCurrent(display(), glxWindow, ctx)) { | 358 | if (!glXMakeCurrent(display(), glxWindow, ctx)) { | ||
356 | qCDebug(KWIN_X11STANDALONE) << "Failed to make the OpenGL context current."; | 359 | qCDebug(KWIN_X11STANDALONE) << "Failed to make the OpenGL context current."; | ||
357 | glXDestroyContext(display(), ctx); | 360 | glXDestroyContext(display(), ctx); | ||
358 | ctx = nullptr; | 361 | ctx = nullptr; | ||
359 | return false; | 362 | return false; | ||
360 | } | 363 | } | ||
361 | 364 | | |||
365 | auto qtContext = new QOpenGLContext; | ||||
366 | QGLXNativeContext native(ctx, display()); | ||||
367 | qtContext->setNativeHandle(QVariant::fromValue(native)); | ||||
368 | qtContext->create(); | ||||
369 | EffectQuickView::setShareContext(std::unique_ptr<QOpenGLContext>(qtContext)); | ||||
370 | | ||||
362 | return true; | 371 | return true; | ||
363 | } | 372 | } | ||
364 | 373 | | |||
365 | bool GlxBackend::initBuffer() | 374 | bool GlxBackend::initBuffer() | ||
366 | { | 375 | { | ||
367 | if (!initFbConfig()) | 376 | if (!initFbConfig()) | ||
368 | return false; | 377 | return false; | ||
369 | 378 | | |||
▲ Show 20 Lines • Show All 579 Lines • Show Last 20 Lines |