Fix warnings and compile errors when building with XRender Compositing disabled

ScreenEdgesEffect failed compiling, mouseclick and zoom are yelling
warnings.

Compiling is tested with XRender enabled, for the disabled test I need to
wait for my Jenkins installation ;-)
This commit is contained in:
Martin Gräßlin 2013-02-21 18:21:46 +01:00
parent 0348a14a7d
commit 7e10fe524f
5 changed files with 32 additions and 8 deletions

View file

@ -362,6 +362,11 @@ void MouseClickEffect::drawCircleXr(const QColor& color, float cx, float cy, flo
fill, effects->xrenderBufferPicture(), 0,
0, 0, strip.count(), strip.constData());
#undef DOUBLE_TO_FIXED
#else
Q_UNUSED(color)
Q_UNUSED(cx)
Q_UNUSED(cy)
Q_UNUSED(r)
#endif
}

View file

@ -189,6 +189,10 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR
if (!glow->texture.isNull()) {
glow->texture->setWrapMode(GL_CLAMP_TO_EDGE);
}
if (glow->texture.isNull()) {
delete glow;
return NULL;
}
} else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (border == ElectricTopLeft || border == ElectricTopRight || border == ElectricBottomRight || border == ElectricBottomLeft) {
@ -198,12 +202,12 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR
glow->pictureSize = geometry.size();
glow->picture.reset(createEdgeGlow<XRenderPicture>(border, geometry.size()));
}
#endif
}
if (glow->texture.isNull() && glow->picture.isNull()) {
if (glow->picture.isNull()) {
delete glow;
return NULL;
}
#endif
}
return glow;
}

View file

@ -58,10 +58,12 @@ class Glow
{
public:
QScopedPointer<GLTexture> texture;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
QScopedPointer<XRenderPicture> picture;
QSize pictureSize;
#endif
qreal strength;
QRect geometry;
QSize pictureSize;
ElectricBorder border;
};

View file

@ -64,7 +64,9 @@ ZoomEffect::ZoomEffect()
, mousePointer(MousePointerScale)
, focusDelay(350) // in milliseconds
, texture(0)
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
, xrenderPicture(0)
#endif
, imageWidth(0)
, imageHeight(0)
, isMouseHidden(false)
@ -140,8 +142,10 @@ void ZoomEffect::showCursor()
XFixesShowCursor(display, DefaultRootWindow(display));
delete texture;
texture = 0;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
delete xrenderPicture;
xrenderPicture = 0;
#endif
isMouseHidden = false;
}
}
@ -153,9 +157,16 @@ void ZoomEffect::hideCursor()
if (!isMouseHidden) {
// try to load the cursor-theme into a OpenGL texture and if successful then hide the mouse-pointer
recreateTexture();
if (texture || xrenderPicture) {
Display* display = QX11Info::display();
XFixesHideCursor(display, DefaultRootWindow(display));
bool shouldHide = false;
if (effects->isOpenGLCompositing()) {
shouldHide = (texture != NULL);
} else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
shouldHide = (xrenderPicture != NULL);
#endif
}
if (shouldHide) {
xcb_xfixes_hide_cursor(connection(), rootWindow());
isMouseHidden = true;
}
}

View file

@ -117,7 +117,9 @@ private:
QTime lastMouseEvent;
QTime lastFocusEvent;
GLTexture* texture;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
XRenderPicture* xrenderPicture;
#endif
int imageWidth;
int imageHeight;
bool isMouseHidden;