diff --git a/cursor.cpp b/cursor.cpp
index 8ec8511e2e..5e35a209e7 100644
--- a/cursor.cpp
+++ b/cursor.cpp
@@ -166,7 +166,7 @@ X11Cursor::X11Cursor(QObject *parent)
m_resetTimeStampTimer->setSingleShot(true);
connect(m_resetTimeStampTimer, SIGNAL(timeout()), SLOT(resetTimeStamp()));
// TODO: How often do we really need to poll?
- m_mousePollingTimer->setInterval(100);
+ m_mousePollingTimer->setInterval(50);
connect(m_mousePollingTimer, SIGNAL(timeout()), SLOT(mousePolled()));
}
diff --git a/effects/resize/resize.cpp b/effects/resize/resize.cpp
index b5c6a65287..a24e1241f7 100644
--- a/effects/resize/resize.cpp
+++ b/effects/resize/resize.cpp
@@ -37,7 +37,8 @@ namespace KWin
KWIN_EFFECT(resize, ResizeEffect)
ResizeEffect::ResizeEffect()
- : m_active(false)
+ : AnimationEffect()
+ , m_active(false)
, m_resizeWindow(0)
{
reconfigure(ReconfigureAll);
@@ -55,14 +56,14 @@ void ResizeEffect::prePaintScreen(ScreenPrePaintData& data, int time)
if (m_active) {
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
}
- effects->prePaintScreen(data, time);
+ AnimationEffect::prePaintScreen(data, time);
}
void ResizeEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{
if (m_active && w == m_resizeWindow)
data.mask |= PAINT_WINDOW_TRANSFORMED;
- effects->prePaintWindow(w, data, time);
+ AnimationEffect::prePaintWindow(w, data, time);
}
void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
@@ -118,8 +119,9 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
}
#endif
}
- } else
- effects->paintWindow(w, mask, region, data);
+ } else {
+ AnimationEffect::paintWindow(w, mask, region, data);
+ }
}
void ResizeEffect::reconfigure(ReconfigureFlags)
@@ -148,6 +150,8 @@ void ResizeEffect::slotWindowFinishUserMovedResized(EffectWindow *w)
if (m_active && w == m_resizeWindow) {
m_active = false;
m_resizeWindow = NULL;
+ if (m_features & TextureScale)
+ animate(w, CrossFadePrevious, 0, 150, FPx2(1.0));
effects->addRepaintFull();
}
}
diff --git a/effects/resize/resize.h b/effects/resize/resize.h
index d900ea6adf..5b1610fe06 100644
--- a/effects/resize/resize.h
+++ b/effects/resize/resize.h
@@ -21,13 +21,13 @@ along with this program. If not, see .
#ifndef KWIN_RESIZE_H
#define KWIN_RESIZE_H
-#include
+#include
namespace KWin
{
class ResizeEffect
- : public Effect
+ : public AnimationEffect
{
Q_OBJECT
Q_PROPERTY(bool textureScale READ isTextureScale)
@@ -38,7 +38,7 @@ public:
virtual inline bool provides(Effect::Feature ef) {
return ef == Effect::Resize;
}
- inline bool isActive() const { return m_active; }
+ inline bool isActive() const { return m_active || AnimationEffect::isActive(); }
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
diff --git a/killwindow.cpp b/killwindow.cpp
index 92481a7db8..f12cab9c92 100644
--- a/killwindow.cpp
+++ b/killwindow.cpp
@@ -52,7 +52,6 @@ void KillWindow::start()
if (m_active) {
return;
}
- m_active = true;
xcb_connection_t *c = connection();
ScopedCPointer grabPointer(xcb_grab_pointer_reply(c, xcb_grab_pointer_unchecked(c, false, rootWindow(),
@@ -64,7 +63,11 @@ void KillWindow::start()
if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) {
return;
}
- grabXKeyboard();
+ m_active = grabXKeyboard();
+ if (!m_active) {
+ xcb_ungrab_pointer(connection(), XCB_TIME_CURRENT_TIME);
+ return;
+ }
grabXServer();
}
diff --git a/paintredirector.cpp b/paintredirector.cpp
index c021549c74..982ab6f58b 100644
--- a/paintredirector.cpp
+++ b/paintredirector.cpp
@@ -348,6 +348,13 @@ void OpenGLPaintRedirector::resizePixmaps(const QRect *rects)
size[TopBottom] = QSize(align(qMax(rects[TopPixmap].width(), rects[BottomPixmap].width()), 128),
rects[TopPixmap].height() + rects[BottomPixmap].height());
+ if (!GLTexture::NPOTTextureSupported()) {
+ for (int i = 0; i < 2; i++) {
+ size[i].rwidth() = nearestPowerOfTwo(size[i].width());
+ size[i].rheight() = nearestPowerOfTwo(size[i].height());
+ }
+ }
+
bool fbo_bound = false;
for (int i = 0; i < 2; i++) {
diff --git a/scene_xrender.cpp b/scene_xrender.cpp
index b5c217228c..8d38a2e2ea 100644
--- a/scene_xrender.cpp
+++ b/scene_xrender.cpp
@@ -48,6 +48,10 @@ namespace KWin
xcb_render_picture_t SceneXrender::buffer = XCB_RENDER_PICTURE_NONE;
ScreenPaintData SceneXrender::screen_paint;
+#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
+#define FIXED_TO_DOUBLE(f) ((double) ((f) / 65536.0))
+
+
static xcb_render_pictformat_t findFormatForVisual(xcb_visualid_t visual)
{
static QHash s_cache;
@@ -445,7 +449,6 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
if (toplevel->hasShadow())
transformed_shape |= toplevel->shadow()->shadowRegion();
-#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
xcb_render_transform_t xform = {
DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0),
@@ -479,7 +482,6 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
}
transformed_shape.setRects(rects.constData(), rects.count());
}
-#undef DOUBLE_TO_FIXED
transformed_shape.translate(mapToScreen(mask, data, QPoint(0, 0)));
PaintClipper pcreg(region); // clip by the region to paint
@@ -495,7 +497,8 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
// the window has border
// This solves a number of glitches and on top of this
// it optimizes painting quite a bit
- const bool blitInTempPixmap = xRenderOffscreen() || (scaled && (wantShadow || (client && !client->noBorder()) || (deleted && !deleted->noBorder())));
+ const bool blitInTempPixmap = xRenderOffscreen() || (data.crossFadeProgress() < 1.0 && !opaque) ||
+ (scaled && (wantShadow || (client && !client->noBorder()) || (deleted && !deleted->noBorder())));
xcb_render_picture_t renderTarget = buffer;
if (blitInTempPixmap) {
@@ -630,7 +633,38 @@ xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, m_xrenderShadow->pic
if (!opaque) {
clientAlpha = xRenderBlendPicture(data.opacity());
}
- xcb_render_composite(connection(), clientRenderOp, pic, clientAlpha, renderTarget, cr.x(), cr.y(), 0, 0, dr.x(), dr.y(), dr.width(), dr.height());
+ xcb_render_composite(connection(), clientRenderOp, pic, clientAlpha, renderTarget,
+ cr.x(), cr.y(), 0, 0, dr.x(), dr.y(), dr.width(), dr.height());
+ if (data.crossFadeProgress() < 1.0 && data.crossFadeProgress() > 0.0) {
+ XRenderWindowPixmap *previous = previousWindowPixmap();
+ if (previous && previous != pixmap) {
+ static XRenderPicture cFadeAlpha(XCB_RENDER_PICTURE_NONE);
+ static xcb_render_color_t cFadeColor = {0, 0, 0, 0};
+ cFadeColor.alpha = uint16_t((1.0 - data.crossFadeProgress()) * 0xffff);
+ if (cFadeAlpha == XCB_RENDER_PICTURE_NONE) {
+ cFadeAlpha = xRenderFill(cFadeColor);
+ } else {
+ xcb_rectangle_t rect = {0, 0, 1, 1};
+ xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, cFadeAlpha, cFadeColor , 1, &rect);
+ }
+ if (previous->size() != pixmap->size()) {
+ xcb_render_transform_t xform2 = {
+ DOUBLE_TO_FIXED(FIXED_TO_DOUBLE(xform.matrix11) * previous->size().width() / pixmap->size().width()), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
+ DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(FIXED_TO_DOUBLE(xform.matrix22) * previous->size().height() / pixmap->size().height()), DOUBLE_TO_FIXED(0),
+ DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)
+ };
+ xcb_render_set_picture_transform(connection(), previous->picture(), xform2);
+ }
+
+ xcb_render_composite(connection(), opaque ? XCB_RENDER_PICT_OP_OVER : XCB_RENDER_PICT_OP_ATOP,
+ previous->picture(), cFadeAlpha, renderTarget,
+ cr.x(), cr.y(), 0, 0, dr.x(), dr.y(), dr.width(), dr.height());
+
+ if (previous->size() != pixmap->size()) {
+ xcb_render_set_picture_transform(connection(), previous->picture(), identity);
+ }
+ }
+ }
if (!opaque)
transformed_shape = QRegion();
}
@@ -926,7 +960,7 @@ void SceneXrender::EffectFrame::renderUnstyled(xcb_render_picture_t pict, const
qreal x = roundness;//we start at angle = 0
qreal y = 0;
- #define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
+
QVector points;
xcb_render_pointfix_t point;
point.x = DOUBLE_TO_FIXED(roundness);
@@ -944,7 +978,6 @@ void SceneXrender::EffectFrame::renderUnstyled(xcb_render_picture_t pict, const
XRenderPicture fill = xRenderFill(Qt::black);
xcb_render_tri_fan(connection(), XCB_RENDER_PICT_OP_OVER, fill, *s_effectFrameCircle,
0, 0, 0, points.count(), points.constData());
- #undef DOUBLE_TO_FIXED
}
// TODO: merge alpha mask with SceneXrender::Window::alphaMask
// alpha mask
@@ -1096,5 +1129,8 @@ xcb_render_picture_t SceneXRenderShadow::picture(Shadow::ShadowElements element)
return *m_pictures[element];
}
+#undef DOUBLE_TO_FIXED
+#undef FIXED_TO_DOUBLE
+
} // namespace
#endif