Remove strict binding from compositing prefs

Strict binding follows the driver (GLPlattform) unless
the user has a config value specified in the kwinrc.

For this a new property is added to Options to indicate
whether strict binding is user defined or follows the
driver. In case of driver the strict binding option is
set when OpenGL compositor starts up.
icc-effect-5.14.5
Martin Gräßlin 2012-04-28 10:53:55 +02:00
parent 21c5264efe
commit d6540c8392
5 changed files with 34 additions and 7 deletions

View File

@ -41,7 +41,6 @@ CompositingPrefs::CompositingPrefs()
: mRecommendCompositing(false)
, mEnableVSync(true)
, mEnableDirectRendering(true)
, mStrictBinding(true)
{
}
@ -389,7 +388,6 @@ void CompositingPrefs::applyDriverSpecificOptions()
mRecommendCompositing = true;
GLPlatform *gl = GLPlatform::instance();
mStrictBinding = !gl->supports(LooseBinding);
if (gl->driver() == Driver_Intel)
mEnableVSync = false;
}

View File

@ -57,9 +57,6 @@ public:
bool enableDirectRendering() const {
return mEnableDirectRendering;
}
bool strictBinding() const {
return mStrictBinding;
}
void detect();
@ -78,7 +75,6 @@ private:
bool mRecommendCompositing;
bool mEnableVSync;
bool mEnableDirectRendering;
bool mStrictBinding;
#ifdef KWIN_HAVE_OPENGLES
EGLDisplay mEGLDisplay;

View File

@ -156,6 +156,7 @@ Options::Options(QObject *parent)
, m_refreshRate(Options::defaultRefreshRate())
, m_glDirect(Options::defaultGlDirect())
, m_glStrictBinding(Options::defaultGlStrictBinding())
, m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver())
, OpTitlebarDblClick(Options::defaultOperationTitlebarDblClick())
, CmdActiveTitlebar1(Options::defaultCommandActiveTitlebar1())
, CmdActiveTitlebar2(Options::defaultCommandActiveTitlebar2())
@ -771,6 +772,15 @@ void Options::setGlStrictBinding(bool glStrictBinding)
emit glStrictBindingChanged();
}
void Options::setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver)
{
if (m_glStrictBindingFollowsDriver == glStrictBindingFollowsDriver) {
return;
}
m_glStrictBindingFollowsDriver = glStrictBindingFollowsDriver;
emit glStrictBindingFollowsDriverChanged();
}
void Options::setElectricBorders(int borders)
{
if (electric_borders == borders) {
@ -994,7 +1004,10 @@ void Options::reloadCompositingSettings(bool force)
setGlDirect(prefs.enableDirectRendering());
setGlVSync(config.readEntry("GLVSync", prefs.enableVSync()));
setGlSmoothScale(qBound(-1, config.readEntry("GLTextureFilter", Options::defaultGlSmoothScale()), 2));
setGlStrictBinding(config.readEntry("GLStrictBinding", prefs.strictBinding()));
setGlStrictBindingFollowsDriver(!config.hasKey("GLStrictBinding"));
if (!isGlStrictBindingFollowsDriver()) {
setGlStrictBinding(config.readEntry("GLStrictBinding", Options::defaultGlStrictBinding()));
}
m_xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false);

View File

@ -194,6 +194,12 @@ class Options : public QObject, public KDecorationOptions
Q_PROPERTY(uint refreshRate READ refreshRate WRITE setRefreshRate NOTIFY refreshRateChanged)
Q_PROPERTY(bool glDirect READ isGlDirect WRITE setGlDirect NOTIFY glDirectChanged)
Q_PROPERTY(bool glStrictBinding READ isGlStrictBinding WRITE setGlStrictBinding NOTIFY glStrictBindingChanged)
/**
* Whether strict binding follows the driver or has been overwritten by a user defined config value.
* If @c true @link glStrictBinding is set by the OpenGL Scene during initialization.
* If @c false @link glStrictBinding is set from a config value and not updated during scene initialization.
**/
Q_PROPERTY(bool glStrictBindingFollowsDriver READ isGlStrictBindingFollowsDriver WRITE setGlStrictBindingFollowsDriver NOTIFY glStrictBindingFollowsDriverChanged)
public:
Options(QObject *parent = NULL);
@ -583,6 +589,9 @@ public:
bool isGlStrictBinding() const {
return m_glStrictBinding;
}
bool isGlStrictBindingFollowsDriver() const {
return m_glStrictBindingFollowsDriver;
}
// setters
void setFocusPolicy(FocusPolicy focusPolicy);
@ -646,6 +655,7 @@ public:
void setRefreshRate(uint refreshRate);
void setGlDirect(bool glDirect);
void setGlStrictBinding(bool glStrictBinding);
void setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver);
// default values
static FocusPolicy defaultFocusPolicy() {
@ -868,6 +878,9 @@ public:
static bool defaultGlStrictBinding() {
return true;
}
static bool defaultGlStrictBindingFollowsDriver() {
return true;
}
static int defaultAnimationSpeed() {
return 3;
}
@ -949,6 +962,7 @@ Q_SIGNALS:
void refreshRateChanged();
void glDirectChanged();
void glStrictBindingChanged();
void glStrictBindingFollowsDriverChanged();
private:
void setElectricBorders(int borders);
@ -993,6 +1007,7 @@ private:
uint m_refreshRate;
bool m_glDirect;
bool m_glStrictBinding;
bool m_glStrictBindingFollowsDriver;
WindowOperation OpTitlebarDblClick;

View File

@ -106,6 +106,11 @@ SceneOpenGL::SceneOpenGL(Workspace* ws)
kError(1212) << "OpenGL compositing setup failed";
return; // error
}
// set strict binding
if (options->isGlStrictBindingFollowsDriver()) {
options->setGlStrictBinding(!glPlatform->supports(LooseBinding));
}
kDebug(1212) << "DB:" << db << ", Direct:" << bool(glXIsDirect(display(), ctxbuffer)) << endl;
init_ok = true;
}