Merge branch 'KDE/4.11'

This commit is contained in:
Thomas Lübking 2013-07-19 21:23:54 +02:00
commit 141e57e725
13 changed files with 78 additions and 56 deletions

View file

@ -223,7 +223,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
dbus.registerObject("/Effects", this);
dbus.registerService("org.kde.kwin.Effects");
// init is important, otherwise causes crashes when quads are build before the first painting pass start
m_currentBuildQuadsIterator = m_activeEffects.end();
m_currentBuildQuadsIterator = m_activeEffects.constEnd();
Workspace *ws = Workspace::self();
VirtualDesktopManager *vds = VirtualDesktopManager::self();
@ -358,7 +358,7 @@ void EffectsHandlerImpl::slotEffectsQueried()
// the idea is that effects call this function again which calls the next one
void EffectsHandlerImpl::prePaintScreen(ScreenPrePaintData& data, int time)
{
if (m_currentPaintScreenIterator != m_activeEffects.end()) {
if (m_currentPaintScreenIterator != m_activeEffects.constEnd()) {
(*m_currentPaintScreenIterator++)->prePaintScreen(data, time);
--m_currentPaintScreenIterator;
}
@ -367,7 +367,7 @@ void EffectsHandlerImpl::prePaintScreen(ScreenPrePaintData& data, int time)
void EffectsHandlerImpl::paintScreen(int mask, QRegion region, ScreenPaintData& data)
{
if (m_currentPaintScreenIterator != m_activeEffects.end()) {
if (m_currentPaintScreenIterator != m_activeEffects.constEnd()) {
(*m_currentPaintScreenIterator++)->paintScreen(mask, region, data);
--m_currentPaintScreenIterator;
} else
@ -382,8 +382,8 @@ void EffectsHandlerImpl::paintDesktop(int desktop, int mask, QRegion region, Scr
m_currentRenderedDesktop = desktop;
m_desktopRendering = true;
// save the paint screen iterator
QList<Effect*>::iterator savedIterator = m_currentPaintScreenIterator;
m_currentPaintScreenIterator = m_activeEffects.begin();
EffectsIterator savedIterator = m_currentPaintScreenIterator;
m_currentPaintScreenIterator = m_activeEffects.constBegin();
effects->paintScreen(mask, region, data);
// restore the saved iterator
m_currentPaintScreenIterator = savedIterator;
@ -392,7 +392,7 @@ void EffectsHandlerImpl::paintDesktop(int desktop, int mask, QRegion region, Scr
void EffectsHandlerImpl::postPaintScreen()
{
if (m_currentPaintScreenIterator != m_activeEffects.end()) {
if (m_currentPaintScreenIterator != m_activeEffects.constEnd()) {
(*m_currentPaintScreenIterator++)->postPaintScreen();
--m_currentPaintScreenIterator;
}
@ -401,7 +401,7 @@ void EffectsHandlerImpl::postPaintScreen()
void EffectsHandlerImpl::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{
if (m_currentPaintWindowIterator != m_activeEffects.end()) {
if (m_currentPaintWindowIterator != m_activeEffects.constEnd()) {
(*m_currentPaintWindowIterator++)->prePaintWindow(w, data, time);
--m_currentPaintWindowIterator;
}
@ -410,7 +410,7 @@ void EffectsHandlerImpl::prePaintWindow(EffectWindow* w, WindowPrePaintData& dat
void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
if (m_currentPaintWindowIterator != m_activeEffects.end()) {
if (m_currentPaintWindowIterator != m_activeEffects.constEnd()) {
(*m_currentPaintWindowIterator++)->paintWindow(w, mask, region, data);
--m_currentPaintWindowIterator;
} else
@ -419,7 +419,7 @@ void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, QRegion region,
void EffectsHandlerImpl::paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity)
{
if (m_currentPaintEffectFrameIterator != m_activeEffects.end()) {
if (m_currentPaintEffectFrameIterator != m_activeEffects.constEnd()) {
(*m_currentPaintEffectFrameIterator++)->paintEffectFrame(frame, region, opacity, frameOpacity);
--m_currentPaintEffectFrameIterator;
} else {
@ -430,7 +430,7 @@ void EffectsHandlerImpl::paintEffectFrame(EffectFrame* frame, QRegion region, do
void EffectsHandlerImpl::postPaintWindow(EffectWindow* w)
{
if (m_currentPaintWindowIterator != m_activeEffects.end()) {
if (m_currentPaintWindowIterator != m_activeEffects.constEnd()) {
(*m_currentPaintWindowIterator++)->postPaintWindow(w);
--m_currentPaintWindowIterator;
}
@ -447,7 +447,7 @@ Effect *EffectsHandlerImpl::provides(Effect::Feature ef)
void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
if (m_currentDrawWindowIterator != m_activeEffects.end()) {
if (m_currentDrawWindowIterator != m_activeEffects.constEnd()) {
(*m_currentDrawWindowIterator++)->drawWindow(w, mask, region, data);
--m_currentDrawWindowIterator;
} else
@ -458,14 +458,14 @@ void EffectsHandlerImpl::buildQuads(EffectWindow* w, WindowQuadList& quadList)
{
static bool initIterator = true;
if (initIterator) {
m_currentBuildQuadsIterator = m_activeEffects.begin();
m_currentBuildQuadsIterator = m_activeEffects.constBegin();
initIterator = false;
}
if (m_currentBuildQuadsIterator != m_activeEffects.end()) {
if (m_currentBuildQuadsIterator != m_activeEffects.constEnd()) {
(*m_currentBuildQuadsIterator++)->buildQuads(w, quadList);
--m_currentBuildQuadsIterator;
}
if (m_currentBuildQuadsIterator == m_activeEffects.begin())
if (m_currentBuildQuadsIterator == m_activeEffects.constBegin())
initIterator = true;
}
@ -488,15 +488,16 @@ bool EffectsHandlerImpl::decorationSupportsBlurBehind() const
void EffectsHandlerImpl::startPaint()
{
m_activeEffects.clear();
for(QVector< KWin::EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it) {
m_activeEffects.reserve(loaded_effects.count());
for(QVector< KWin::EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if (it->second->isActive()) {
m_activeEffects << it->second;
}
}
m_currentDrawWindowIterator = m_activeEffects.begin();
m_currentPaintWindowIterator = m_activeEffects.begin();
m_currentPaintScreenIterator = m_activeEffects.begin();
m_currentPaintEffectFrameIterator = m_activeEffects.begin();
m_currentDrawWindowIterator = m_activeEffects.constBegin();
m_currentPaintWindowIterator = m_activeEffects.constBegin();
m_currentPaintScreenIterator = m_activeEffects.constBegin();
m_currentPaintEffectFrameIterator = m_activeEffects.constBegin();
}
void EffectsHandlerImpl::slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode)
@ -752,7 +753,7 @@ void* EffectsHandlerImpl::getProxy(QString name)
// All effects start with "kwin4_effect_", prepend it to the name
name.prepend("kwin4_effect_");
for (QVector< EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it)
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it)
if ((*it).first == name)
return (*it).second->proxy();
@ -1512,7 +1513,7 @@ void EffectsHandlerImpl::unloadEffect(const QString& name)
void EffectsHandlerImpl::reconfigureEffect(const QString& name)
{
for (QVector< EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it)
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it)
if ((*it).first == name) {
(*it).second->reconfigure(Effect::ReconfigureAll);
return;
@ -1531,7 +1532,7 @@ bool EffectsHandlerImpl::isEffectLoaded(const QString& name) const
void EffectsHandlerImpl::reloadEffect(Effect *effect)
{
QString effectName;
for (QVector< EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it) {
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if ((*it).second == effect) {
effectName = (*it).first;
break;
@ -1552,6 +1553,7 @@ void EffectsHandlerImpl::effectsChanged()
// kDebug(1212) << effect.first;
loaded_effects.append(effect);
}
m_activeEffects.reserve(loaded_effects.count());
}
QStringList EffectsHandlerImpl::activeEffects() const

View file

@ -253,12 +253,14 @@ private Q_SLOTS:
void slotEffectsQueried();
private:
QList< Effect* > m_activeEffects;
QList< Effect* >::iterator m_currentDrawWindowIterator;
QList< Effect* >::iterator m_currentPaintWindowIterator;
QList< Effect* >::iterator m_currentPaintEffectFrameIterator;
QList< Effect* >::iterator m_currentPaintScreenIterator;
QList< Effect* >::iterator m_currentBuildQuadsIterator;
typedef QVector< Effect*> EffectsList;
typedef EffectsList::const_iterator EffectsIterator;
EffectsList m_activeEffects;
EffectsIterator m_currentDrawWindowIterator;
EffectsIterator m_currentPaintWindowIterator;
EffectsIterator m_currentPaintEffectFrameIterator;
EffectsIterator m_currentPaintScreenIterator;
EffectsIterator m_currentBuildQuadsIterator;
typedef QHash< QByteArray, QList< Effect*> > PropertyEffectMap;
PropertyEffectMap m_propertiesForEffects;
QHash<QByteArray, qulonglong> m_managedProperties;

View file

@ -24,7 +24,6 @@ Item {
Plasma.Button {
id: closeButton
objectName: "closeButton"
enabled: armed
width: 32
height: 32
iconSource: "window-close"

View file

@ -1968,8 +1968,6 @@ CloseWindowView::CloseWindowView(QWidget *parent)
kdeclarative.initialize();
kdeclarative.setupBindings();
rootContext()->setContextProperty("armed", QVariant(false));
setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/presentwindows/main.qml"))));
if (QObject *item = rootObject()->findChild<QObject*>("closeButton")) {
connect(item, SIGNAL(clicked()), SIGNAL(close()));
@ -1978,15 +1976,14 @@ CloseWindowView::CloseWindowView(QWidget *parent)
// setup the timer - attempt to prevent accidental clicks
m_armTimer->setSingleShot(true);
m_armTimer->setInterval(350); // 50ms until the window is elevated (seen!) and 300ms more to be "realized" by the user.
connect(m_armTimer, SIGNAL(timeout()), SLOT(arm()));
}
void CloseWindowView::windowInputMouseEvent(QMouseEvent *e)
{
if (m_armTimer->isActive())
return;
if (e->type() == QEvent::MouseMove) {
mouseMoveEvent(e);
} else if (m_armTimer->isActive()) {
return;
} else if (e->type() == QEvent::MouseButtonPress) {
mousePressEvent(e);
} else if (e->type() == QEvent::MouseButtonDblClick) {
@ -1996,17 +1993,19 @@ void CloseWindowView::windowInputMouseEvent(QMouseEvent *e)
}
}
void CloseWindowView::arm()
{
rootContext()->setContextProperty("armed", QVariant(true));
}
void CloseWindowView::disarm()
{
rootContext()->setContextProperty("armed", QVariant(false));
m_armTimer->start();
}
void CloseWindowView::hideEvent(QHideEvent *event)
{
const QPoint globalPos = mapToGlobal(QPoint(-1,-1));
QMouseEvent me(QEvent::MouseMove, QPoint(-1,-1), globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
mouseMoveEvent(&me);
QDeclarativeView::hideEvent(event);
}
} // namespace
#include "presentwindows.moc"

View file

@ -39,12 +39,13 @@ public:
explicit CloseWindowView(QWidget *parent = 0);
void windowInputMouseEvent(QMouseEvent* e);
void disarm();
public slots:
void arm();
Q_SIGNALS:
void close();
protected:
void hideEvent(QHideEvent *event);
private:
QTimer* m_armTimer;
};

View file

@ -53,6 +53,8 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
addConfig(ZoomConfig::self(), m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
// Shortcut config. The shortcut belongs to the component "kwin"!
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
actionCollection->setConfigGroup("Zoom");

View file

@ -72,6 +72,8 @@ void EglOnXBackend::init()
}
GLPlatform *glPlatform = GLPlatform::instance();
glPlatform->detect(EglPlatformInterface);
if (GLPlatform::instance()->driver() == Driver_Intel)
options->setUnredirectFullscreen(false); // bug #252817
glPlatform->printResults();
initGL(EglPlatformInterface);
if (!hasGLExtension("GL_OES_EGL_image")) {

View file

@ -1201,10 +1201,10 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot)
QuickTileMode mode = QuickTileNone;
for (int i=0; i<screens()->count(); ++i) {
const QRect &area = screens()->geometry(i);
if (!area.contains(QPoint(xroot, yroot)))
if (!screens()->geometry(i).contains(QPoint(xroot, yroot)))
continue;
QRect area = workspace()->clientArea(MaximizeArea, QPoint(xroot, yroot), desktop());
if (options->electricBorderTiling()) {
if (xroot <= area.x() + 20)
mode |= QuickTileLeft;

View file

@ -56,6 +56,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
static inline int sign(int v) {
return (v > 0) - (v < 0);
}
//********************************************
// Workspace
//********************************************
@ -2874,6 +2878,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
// we are trying to resize in from the side?
bool breakLoop = false;
switch(mode) {
case PositionBottomLeft:
case PositionTopLeft:
case PositionLeft:
if (previousMoveResizeGeom.x() >= moveResizeGeom.x()) {
@ -2882,6 +2887,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
}
moveResizeGeom.setLeft(moveResizeGeom.x() - 1);
break;
case PositionBottomRight:
case PositionTopRight:
case PositionRight:
if (previousMoveResizeGeom.right() <= moveResizeGeom.right()) {
@ -3007,13 +3013,16 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
}
}
// Move it (Favour vertically)
if (previousMoveResizeGeom.y() != moveResizeGeom.y())
moveResizeGeom.translate(0,
previousMoveResizeGeom.y() > moveResizeGeom.y() ? 1 : -1);
else
moveResizeGeom.translate(previousMoveResizeGeom.x() > moveResizeGeom.x() ? 1 : -1,
0);
int dx = sign(previousMoveResizeGeom.x() - moveResizeGeom.x()),
dy = sign(previousMoveResizeGeom.y() - moveResizeGeom.y());
if (visiblePixels && dx) // means there's no full width cap -> favor horizontally
dy = 0;
else if (dy)
dx = 0;
// Move it back
moveResizeGeom.translate(dx, dy);
if (moveResizeGeom == previousMoveResizeGeom) {
break; // Prevent lockup
}

View file

@ -95,6 +95,8 @@ void GlxBackend::init()
// Initialize OpenGL
GLPlatform *glPlatform = GLPlatform::instance();
glPlatform->detect(GlxPlatformInterface);
if (GLPlatform::instance()->driver() == Driver_Intel)
options->setUnredirectFullscreen(false); // bug #252817
glPlatform->printResults();
initGL(GlxPlatformInterface);
// Check whether certain features are supported

View file

@ -56,7 +56,7 @@
<item row="1" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">

View file

@ -651,6 +651,8 @@ void Options::setHiddenPreviews(int hiddenPreviews)
void Options::setUnredirectFullscreen(bool unredirectFullscreen)
{
if (GLPlatform::instance()->driver() == Driver_Intel)
unredirectFullscreen = false; // bug #252817
if (m_unredirectFullscreen == unredirectFullscreen) {
return;
}

View file

@ -47,8 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin {
// Reset timeout
static const int TRESHOLD_RESET = 250;
// Mouse should not move more than this many pixels
static const int DISTANCE_RESET = 30;
@ -133,7 +131,7 @@ void Edge::check(const QPoint &cursorPos, const QDateTime &triggerTime, bool for
bool directActivate = forceNoPushBack || edges()->cursorPushBackDistance().isNull();
if (directActivate || canActivate(cursorPos, triggerTime)) {
m_lastTrigger = triggerTime;
m_lastReset = triggerTime;
m_lastReset = QDateTime(); // invalidate
handle(cursorPos);
} else {
pushCursorBack(cursorPos);
@ -143,7 +141,11 @@ void Edge::check(const QPoint &cursorPos, const QDateTime &triggerTime, bool for
bool Edge::canActivate(const QPoint &cursorPos, const QDateTime &triggerTime)
{
if (m_lastReset.msecsTo(triggerTime) > TRESHOLD_RESET) {
// we check whether either the timer has explicitly been invalidated (successfull trigger) or is
// bigger than the reactivation threshold (activation "aborted", usually due to moving away the cursor
// from the corner after successfull activation)
// either condition means that "this is the first event in a new attempt"
if (!m_lastReset.isValid() || m_lastReset.msecsTo(triggerTime) > edges()->reActivationThreshold()) {
m_lastReset = triggerTime;
return false;
}