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.
icc-effect-5.14.5
Fredrik Höglund 2013-03-13 16:21:15 +01:00
parent f06990a7e7
commit b0cc22acbb
2 changed files with 21 additions and 0 deletions

View File

@ -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()));

View File

@ -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;