Merge branch 'KDE/4.11'
This commit is contained in:
commit
e0dc576853
3 changed files with 40 additions and 18 deletions
10
cursor.cpp
10
cursor.cpp
|
@ -227,13 +227,15 @@ void X11Cursor::doStopCursorTracking()
|
||||||
|
|
||||||
void X11Cursor::mousePolled()
|
void X11Cursor::mousePolled()
|
||||||
{
|
{
|
||||||
const QPoint last = currentPos();
|
static QPoint lastPos = currentPos();
|
||||||
const uint16_t lastMask = m_buttonMask;
|
static uint16_t lastMask = m_buttonMask;
|
||||||
doGetPos(); // Update if needed
|
doGetPos(); // Update if needed
|
||||||
if (last != currentPos() || lastMask != m_buttonMask) {
|
if (lastPos != currentPos() || lastMask != m_buttonMask) {
|
||||||
emit mouseChanged(currentPos(), last,
|
emit mouseChanged(currentPos(), lastPos,
|
||||||
x11ToQtMouseButtons(m_buttonMask), x11ToQtMouseButtons(lastMask),
|
x11ToQtMouseButtons(m_buttonMask), x11ToQtMouseButtons(lastMask),
|
||||||
x11ToQtKeyboardModifiers(m_buttonMask), x11ToQtKeyboardModifiers(lastMask));
|
x11ToQtKeyboardModifiers(m_buttonMask), x11ToQtKeyboardModifiers(lastMask));
|
||||||
|
lastPos = currentPos();
|
||||||
|
lastMask = m_buttonMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -637,17 +637,14 @@ bool SceneOpenGL2::supported(OpenGLBackend *backend)
|
||||||
SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend)
|
SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend)
|
||||||
: SceneOpenGL(Workspace::self(), backend)
|
: SceneOpenGL(Workspace::self(), backend)
|
||||||
, m_lanczosFilter(NULL)
|
, m_lanczosFilter(NULL)
|
||||||
, m_colorCorrection(new ColorCorrection(this))
|
, m_colorCorrection()
|
||||||
{
|
{
|
||||||
if (!init_ok) {
|
if (!init_ok) {
|
||||||
// base ctor already failed
|
// base ctor already failed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Initialize color correction before the shaders
|
// Initialize color correction before the shaders
|
||||||
kDebug(1212) << "Color correction:" << options->isColorCorrected();
|
slotColorCorrectedChanged(false);
|
||||||
m_colorCorrection->setEnabled(options->isColorCorrected());
|
|
||||||
connect(m_colorCorrection, SIGNAL(changed()), Compositor::self(), SLOT(addRepaintFull()));
|
|
||||||
connect(m_colorCorrection, SIGNAL(errorOccured()), options, SLOT(setColorCorrected()), Qt::QueuedConnection);
|
|
||||||
connect(options, SIGNAL(colorCorrectedChanged()), this, SLOT(slotColorCorrectedChanged()), Qt::QueuedConnection);
|
connect(options, SIGNAL(colorCorrectedChanged()), this, SLOT(slotColorCorrectedChanged()), Qt::QueuedConnection);
|
||||||
|
|
||||||
if (!ShaderManager::instance()->isValid()) {
|
if (!ShaderManager::instance()->isValid()) {
|
||||||
|
@ -721,7 +718,7 @@ SceneOpenGL::Window *SceneOpenGL2::createWindow(Toplevel *t)
|
||||||
|
|
||||||
void SceneOpenGL2::finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data)
|
void SceneOpenGL2::finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data)
|
||||||
{
|
{
|
||||||
if (m_colorCorrection->isEnabled()) {
|
if (!m_colorCorrection.isNull() && m_colorCorrection->isEnabled()) {
|
||||||
// Split the painting for separate screens
|
// Split the painting for separate screens
|
||||||
const int numScreens = screens()->count();
|
const int numScreens = screens()->count();
|
||||||
for (int screen = 0; screen < numScreens; ++ screen) {
|
for (int screen = 0; screen < numScreens; ++ screen) {
|
||||||
|
@ -759,12 +756,29 @@ void SceneOpenGL2::resetLanczosFilter()
|
||||||
|
|
||||||
ColorCorrection *SceneOpenGL2::colorCorrection()
|
ColorCorrection *SceneOpenGL2::colorCorrection()
|
||||||
{
|
{
|
||||||
return m_colorCorrection;
|
return m_colorCorrection.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOpenGL2::slotColorCorrectedChanged()
|
void SceneOpenGL2::slotColorCorrectedChanged(bool recreateShaders)
|
||||||
{
|
{
|
||||||
m_colorCorrection->setEnabled(options->isColorCorrected());
|
kDebug(1212) << "Color correction:" << options->isColorCorrected();
|
||||||
|
if (options->isColorCorrected() && m_colorCorrection.isNull()) {
|
||||||
|
m_colorCorrection.reset(new ColorCorrection(this));
|
||||||
|
if (!m_colorCorrection->setEnabled(true)) {
|
||||||
|
m_colorCorrection.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
connect(m_colorCorrection.data(), SIGNAL(changed()), Compositor::self(), SLOT(addRepaintFull()));
|
||||||
|
connect(m_colorCorrection.data(), SIGNAL(errorOccured()), options, SLOT(setColorCorrected()), Qt::QueuedConnection);
|
||||||
|
if (recreateShaders) {
|
||||||
|
// Reload all shaders
|
||||||
|
ShaderManager::cleanup();
|
||||||
|
ShaderManager::instance();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_colorCorrection.reset();
|
||||||
|
}
|
||||||
|
Compositor::self()->addRepaintFull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1403,7 +1417,9 @@ void SceneOpenGL2Window::performPaint(int mask, QRegion region, WindowPaintData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()->setupForOutput(data.screen());
|
if (ColorCorrection *cc = static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()) {
|
||||||
|
cc->setupForOutput(data.screen());
|
||||||
|
}
|
||||||
|
|
||||||
shader->setUniform(GLShader::WindowTransformation, transformation(mask, data));
|
shader->setUniform(GLShader::WindowTransformation, transformation(mask, data));
|
||||||
shader->setUniform(GLShader::Saturation, data.saturation());
|
shader->setUniform(GLShader::Saturation, data.saturation());
|
||||||
|
@ -1566,7 +1582,9 @@ void SceneOpenGL2Window::prepareStates(TextureType type, qreal opacity, qreal br
|
||||||
shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a));
|
shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a));
|
||||||
shader->setUniform(GLShader::Saturation, saturation);
|
shader->setUniform(GLShader::Saturation, saturation);
|
||||||
|
|
||||||
static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()->setupForOutput(screen);
|
if (ColorCorrection *cc = static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()) {
|
||||||
|
cc->setupForOutput(screen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation)
|
void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation)
|
||||||
|
@ -1579,7 +1597,9 @@ void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal br
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()->setupForOutput(-1);
|
if (ColorCorrection *cc = static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()) {
|
||||||
|
cc->setupForOutput(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************
|
//***************************************
|
||||||
|
|
|
@ -127,7 +127,7 @@ protected:
|
||||||
virtual void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data);
|
virtual void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotColorCorrectedChanged();
|
void slotColorCorrectedChanged(bool recreateShaders = true);
|
||||||
void resetLanczosFilter();
|
void resetLanczosFilter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -135,7 +135,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LanczosFilter *m_lanczosFilter;
|
LanczosFilter *m_lanczosFilter;
|
||||||
ColorCorrection *m_colorCorrection;
|
QScopedPointer<ColorCorrection> m_colorCorrection;
|
||||||
GLuint vao;
|
GLuint vao;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue