[graphics/krita] libs/ui/opengl: Implement switching canvas widget to use native surface
Dmitry Kazakov
null at kde.org
Mon May 26 12:20:12 BST 2025
Git commit 127ae36b5badf230e0270cee67bcf21a22b65c2b by Dmitry Kazakov.
Committed on 26/05/2025 at 11:19.
Pushed by dkazakov into branch 'master'.
Implement switching canvas widget to use native surface
When using Wayland (and the newest Win11 ACM) we need to create
a separate native window for our canvas. Currently, this causes severe
issues on all the platforms, so the switch is done using the environment
variable `KRITA_USE_NATIVE_CANVAS_SURFACE`.
To test Krita in a native surface mode, do the following:
1) Run with an enviroment variables set:
T_LOGGING_RULES=krita.opengl=true KRITA_USE_NATIVE_CANVAS_SURFACE=1 QT_QPA_PLATFORM=wayland krita
2) Verify that Krita dumps a line about the usage of the native surface:
"krita.opengl: Using native surface for the canvas widget"
CC:kimageshop at kde.org
M +6 -0 libs/ui/opengl/kis_opengl_canvas2.cpp
https://invent.kde.org/graphics/krita/-/commit/127ae36b5badf230e0270cee67bcf21a22b65c2b
diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp
index 279c5be7be7..bcde8edef5d 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.cpp
+++ b/libs/ui/opengl/kis_opengl_canvas2.cpp
@@ -97,6 +97,12 @@ KisOpenGLCanvas2::KisOpenGLCanvas2(KisCanvas2 *canvas,
#endif
setAttribute(Qt::WA_InputMethodEnabled, true);
setAttribute(Qt::WA_DontCreateNativeAncestors, true);
+
+ if (qEnvironmentVariableIsSet("KRITA_USE_NATIVE_CANVAS_SURFACE")) {
+ infoOpenGL << "Using native surface for the canvas widget";
+ setAttribute(Qt::WA_NativeWindow, true);
+ }
+
setUpdateBehavior(PartialUpdate);
// we should make sure the texture doesn't have alpha channel,
More information about the kimageshop
mailing list