From b0cc22acbbddc72a0232bccf1d6bc22fca80734e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 13 Mar 2013 16:21:15 +0100 Subject: [PATCH] kwin: Add a glCoreProfile property in Options This property enables creation of an OpenGL 3.1 core context when set to true. The default value is false. --- options.cpp | 11 +++++++++++ options.h | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/options.cpp b/options.cpp index fd7b9216e1..50259474f8 100644 --- a/options.cpp +++ b/options.cpp @@ -157,6 +157,7 @@ Options::Options(QObject *parent) , m_glStrictBinding(Options::defaultGlStrictBinding()) , m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver()) , m_glLegacy(Options::defaultGlLegacy()) + , m_glCoreProfile(Options::defaultGLCoreProfile()) , m_glPreferBufferSwap(Options::defaultGlPreferBufferSwap()) , OpTitlebarDblClick(Options::defaultOperationTitlebarDblClick()) , CmdActiveTitlebar1(Options::defaultCommandActiveTitlebar1()) @@ -747,6 +748,15 @@ void Options::setGlLegacy(bool glLegacy) emit glLegacyChanged(); } +void Options::setGLCoreProfile(bool value) +{ + if (m_glCoreProfile == value) { + return; + } + m_glCoreProfile = value; + emit glCoreProfileChanged(); +} + void Options::setGlPreferBufferSwap(char glPreferBufferSwap) { if (glPreferBufferSwap == 'a') { @@ -951,6 +961,7 @@ void Options::reloadCompositingSettings(bool force) setGlStrictBinding(config.readEntry("GLStrictBinding", Options::defaultGlStrictBinding())); } setGlLegacy(config.readEntry("GLLegacy", Options::defaultGlLegacy())); + setGLCoreProfile(config.readEntry("GLCore", Options::defaultGLCoreProfile())); char c = 0; const QString s = config.readEntry("GLPreferBufferSwap", QString(Options::defaultGlPreferBufferSwap())); diff --git a/options.h b/options.h index 1851874f00..18dfa81811 100644 --- a/options.h +++ b/options.h @@ -183,6 +183,7 @@ class Options : public QObject, public KDecorationOptions * Whether legacy OpenGL should be used or OpenGL (ES) 2 **/ Q_PROPERTY(bool glLegacy READ isGlLegacy WRITE setGlLegacy NOTIFY glLegacyChanged) + Q_PROPERTY(bool glCoreProfile READ glCoreProfile WRITE setGLCoreProfile NOTIFY glCoreProfileChanged) Q_PROPERTY(char glPreferBufferSwap READ glPreferBufferSwap WRITE setGlPreferBufferSwap NOTIFY glPreferBufferSwapChanged) public: @@ -538,6 +539,9 @@ public: bool isGlLegacy() const { return m_glLegacy; } + bool glCoreProfile() const { + return m_glCoreProfile; + } enum GlSwapStrategy { NoSwapEncourage = 0, CopyFrontBuffer = 'c', PaintFullScreen = 'p', ExtendDamage = 'e', AutoSwapStrategy = 'a' }; GlSwapStrategy glPreferBufferSwap() const { @@ -603,6 +607,7 @@ public: void setGlStrictBinding(bool glStrictBinding); void setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver); void setGlLegacy(bool glLegacy); + void setGLCoreProfile(bool glCoreProfile); void setGlPreferBufferSwap(char glPreferBufferSwap); // default values @@ -708,6 +713,9 @@ public: static bool defaultGlLegacy() { return false; } + static bool defaultGLCoreProfile() { + return false; + } static GlSwapStrategy defaultGlPreferBufferSwap() { return AutoSwapStrategy; } @@ -789,6 +797,7 @@ Q_SIGNALS: void glStrictBindingChanged(); void glStrictBindingFollowsDriverChanged(); void glLegacyChanged(); + void glCoreProfileChanged(); void glPreferBufferSwapChanged(); public Q_SLOTS: @@ -838,6 +847,7 @@ private: bool m_glStrictBinding; bool m_glStrictBindingFollowsDriver; bool m_glLegacy; + bool m_glCoreProfile; GlSwapStrategy m_glPreferBufferSwap; WindowOperation OpTitlebarDblClick;