From 20f1a79d0464884e969b558bda6b3b1dc608e5f3 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Mon, 5 Oct 2009 09:47:13 +0000 Subject: [PATCH] Less warnings please. svn path=/trunk/KDE/kdebase/workspace/; revision=1031490 --- composite.cpp | 15 +++++++++------ desktoplayout.cpp | 2 ++ effects.cpp | 4 ++-- effects/boxswitch/boxswitch.cpp | 2 ++ effects/coverswitch/coverswitch.cpp | 1 + effects/cube/cube.cpp | 1 + effects/cube/cube_config.cpp | 4 ++-- effects/desktopgrid/desktopgrid.cpp | 2 +- effects/logout/logout.cpp | 1 + effects/presentwindows/presentwindows.cpp | 1 + effects/shadow/shadow.cpp | 5 +++++ effects/taskbarthumbnail/taskbarthumbnail.cpp | 1 + geometry.cpp | 2 +- kcmkwin/kwinscreenedges/monitor.cpp | 6 ++++-- 14 files changed, 33 insertions(+), 14 deletions(-) diff --git a/composite.cpp b/composite.cpp index f75787ef2b..7193d990b2 100644 --- a/composite.cpp +++ b/composite.cpp @@ -757,6 +757,10 @@ Pixmap Toplevel::createWindowPixmap() } #ifdef HAVE_XDAMAGE +// We must specify that the two events are a union so the compiler doesn't +// complain about strict aliasing rules. +typedef union { XEvent e; XDamageNotifyEvent de; } EventUnion; + void Toplevel::damageNotifyEvent( XDamageNotifyEvent* e ) { QRegion damage( e->area.x, e->area.y, e->area.width, e->area.height ); @@ -764,11 +768,11 @@ void Toplevel::damageNotifyEvent( XDamageNotifyEvent* e ) int cnt = 1; while( XPending( display())) { - XEvent e2; - if( XPeekEvent( display(), &e2 ) && e2.type == Extensions::damageNotifyEvent() - && e2.xany.window == frameId()) + EventUnion e2; + if( XPeekEvent( display(), &e2.e ) && e2.e.type == Extensions::damageNotifyEvent() + && e2.e.xany.window == frameId()) { - XNextEvent( display(), &e2 ); + XNextEvent( display(), &e2.e ); if( cnt > 200 ) { // If there are way too many damage events in the queue, just discard them @@ -778,8 +782,7 @@ void Toplevel::damageNotifyEvent( XDamageNotifyEvent* e ) damage = rect(); continue; } - XDamageNotifyEvent* e = reinterpret_cast< XDamageNotifyEvent* >( &e2 ); - QRect r( e->area.x, e->area.y, e->area.width, e->area.height ); + QRect r( e2.de.area.x, e2.de.area.y, e2.de.area.width, e2.de.area.height ); ++cnt; // If there are too many damaged rectangles, increase them // to be multiples of 100x100 px grid, since QRegion get quite diff --git a/desktoplayout.cpp b/desktoplayout.cpp index 02070a9140..89f70aa142 100644 --- a/desktoplayout.cpp +++ b/desktoplayout.cpp @@ -176,11 +176,13 @@ int Workspace::desktopToLeft( int id, bool wrap ) const int Workspace::addDesktop( QPoint coords ) { // TODO + Q_UNUSED( coords ); return 0; } void Workspace::deleteDesktop( int id ) { // TODO + Q_UNUSED( id ); } } // namespace diff --git a/effects.cpp b/effects.cpp index 8da7a69845..e3e9081ee9 100644 --- a/effects.cpp +++ b/effects.cpp @@ -32,7 +32,7 @@ along with this program. If not, see . #include #include "kdebug.h" -#include "klibloader.h" +#include "klibrary.h" #include "kdesktopfile.h" #include "kconfiggroup.h" #include "kstandarddirs.h" @@ -840,7 +840,7 @@ unsigned long EffectsHandlerImpl::xrenderBufferPicture() KLibrary* EffectsHandlerImpl::findEffectLibrary( KService* service ) { QString libname = service->library(); - KLibrary* library = KLibLoader::self()->library(libname); + KLibrary* library = new KLibrary(libname); if( !library ) { kError( 1212 ) << "couldn't open library for effect '" << diff --git a/effects/boxswitch/boxswitch.cpp b/effects/boxswitch/boxswitch.cpp index a417dabfa4..8013291edc 100644 --- a/effects/boxswitch/boxswitch.cpp +++ b/effects/boxswitch/boxswitch.cpp @@ -232,6 +232,7 @@ void BoxSwitchEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi void BoxSwitchEffect::windowInputMouseEvent( Window w, QEvent* e ) { assert( w == mInput ); + Q_UNUSED( w ); if( e->type() != QEvent::MouseButtonPress ) return; QPoint pos = static_cast< QMouseEvent* >( e )->pos(); @@ -272,6 +273,7 @@ void BoxSwitchEffect::windowInputMouseEvent( Window w, QEvent* e ) void BoxSwitchEffect::windowDamaged( EffectWindow* w, const QRect& damage ) { + Q_UNUSED( damage ); if( mActivated ) { if( mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode ) diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index fd9fb02287..5f8988102c 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -1354,6 +1354,7 @@ void CoverSwitchEffect::paintWindowIcon( EffectWindow* w ) void CoverSwitchEffect::windowInputMouseEvent( Window w, QEvent* e ) { assert( w == input ); + Q_UNUSED( w ); if( e->type() != QEvent::MouseButtonPress ) return; // we don't want click events during animations diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 52965aaa87..9a8b62287e 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -2118,6 +2118,7 @@ void CubeEffect::mouseChanged( const QPoint& pos, const QPoint& oldpos, Qt::Mous void CubeEffect::windowInputMouseEvent( Window w, QEvent* e ) { assert( w == input ); + Q_UNUSED( w ); QMouseEvent *mouse = dynamic_cast< QMouseEvent* >( e ); if( mouse && mouse->type() == QEvent::MouseButtonRelease ) { diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index 59121edb70..4ee2e4886e 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_config.cpp @@ -114,7 +114,7 @@ void CubeEffectConfig::load() bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); bool walkThroughDesktop = conf.readEntry( "TabBox", false ); m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 100 ) ); - m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) ); + m_ui->wallpaperRequester->setUrl( KUrl( conf.readEntry( "Wallpaper", "" ) )); bool invertKeys = conf.readEntry( "InvertKeys", false ); bool invertMouse = conf.readEntry( "InvertMouse", false ); m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) ); @@ -226,7 +226,7 @@ void CubeEffectConfig::defaults() m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); m_ui->capsImageBox->setCheckState( Qt::Checked ); m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); - m_ui->wallpaperRequester->setPath( "" ); + m_ui->wallpaperRequester->setUrl( KUrl( "" )); m_ui->zPositionSlider->setValue( 100 ); m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); m_ui->invertKeysBox->setChecked( false ); diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index d86e8efbcb..efa0f7b3e6 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -369,7 +369,7 @@ void DesktopGridEffect::windowInputMouseEvent( Window, QEvent* e ) isDesktop = w->isDesktop(); if ( isDesktop ) XDefineCursor( display(), input, QCursor( Qt::ClosedHandCursor ).handle() ); - else if( w != NULL && w->isMovable() || w->isMovableAcrossScreens() ) + else if( w != NULL && ( w->isMovable() || w->isMovableAcrossScreens() )) { // Prepare it for moving XDefineCursor( display(), input, QCursor( Qt::ClosedHandCursor ).handle() ); windowMoveDiff = w->pos() - unscalePos( me->pos(), NULL ); diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index 3ee582bbe3..dafb26e0c8 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -188,6 +188,7 @@ void LogoutEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data { GLRenderTarget* target = effects->popRenderTarget(); assert( target == blurTarget ); + Q_UNUSED( target ); // Render the blurred scene blurTexture->bind(); diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 356b7ea4d2..928ec0d2a7 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -412,6 +412,7 @@ bool PresentWindowsEffect::borderActivated( ElectricBorder border ) void PresentWindowsEffect::windowInputMouseEvent( Window w, QEvent *e ) { assert( w == m_input ); + Q_UNUSED( w ); // Which window are we hovering over? Always trigger as we don't always get move events before clicking // We cannot use m_motionManager.windowAtPoint() as the window might not be visible diff --git a/effects/shadow/shadow.cpp b/effects/shadow/shadow.cpp index b8597d2584..edef20e999 100644 --- a/effects/shadow/shadow.cpp +++ b/effects/shadow/shadow.cpp @@ -155,6 +155,7 @@ void ShadowEffect::updateShadowColor() QRect ShadowEffect::shadowRectangle( EffectWindow* w, const QRect& windowRectangle ) const { + Q_UNUSED( w ); int shadowGrow = shadowFuzzyness + shadowSize; return windowRectangle.adjusted( shadowXOffset - shadowGrow, shadowYOffset - shadowGrow, shadowXOffset + shadowGrow, shadowYOffset + shadowGrow); @@ -422,6 +423,8 @@ void ShadowEffect::drawQueuedShadows( EffectWindow* behindWindow ) // Modified version of SceneOpenGL::Window::prepareRenderStates() from scene_opengl.cpp void ShadowEffect::prepareRenderStates( GLTexture *texture, double opacity, double brightness, double saturation ) { + Q_UNUSED( texture ); + Q_UNUSED( saturation ); #ifdef KWIN_HAVE_OPENGL_COMPOSITING // setup blending of transparent windows glPushAttrib( GL_ENABLE_BIT ); @@ -508,6 +511,7 @@ void ShadowEffect::prepareRenderStates( GLTexture *texture, double opacity, doub // Modified version of SceneOpenGL::Window::restoreRenderStates() from scene_opengl.cpp void ShadowEffect::restoreRenderStates( GLTexture *texture, double opacity, double brightness, double saturation ) { + Q_UNUSED( texture ); #ifdef KWIN_HAVE_OPENGL_COMPOSITING if( opacity != 1.0 || saturation != 1.0 || brightness != 1.0 ) { @@ -558,6 +562,7 @@ void ShadowEffect::drawShadowQuadOpenGL( GLTexture *texture, QVector vert void ShadowEffect::drawShadowQuadXRender( XRenderPicture *picture, QRect rect, float xScale, float yScale, QColor color, float opacity, float brightness, float saturation ) { + Q_UNUSED( saturation ); #ifdef KWIN_HAVE_XRENDER_COMPOSITING XRenderPicture fill; if( color.isValid() ) diff --git a/effects/taskbarthumbnail/taskbarthumbnail.cpp b/effects/taskbarthumbnail/taskbarthumbnail.cpp index 1d1dd8f2e9..33e6ab5bd9 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -111,6 +111,7 @@ void TaskbarThumbnailEffect::paintWindow( EffectWindow* w, int mask, QRegion reg void TaskbarThumbnailEffect::windowDamaged( EffectWindow* w, const QRect& damage ) { + Q_UNUSED( damage ); // Update the thumbnail if the window was damaged foreach( EffectWindow* window, thumbnails.keys() ) foreach( const Data &thumb, thumbnails.values( window )) diff --git a/geometry.cpp b/geometry.cpp index c08781d27e..b2ae3e0584 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1225,7 +1225,7 @@ void Client::checkWorkspacePosition() newGeom.x() != leftMax ) { // Left was touching before but isn't anymore // If the other side was touching make sure it still is afterwards - if( newGeom.y() == newGeom.x() + newGeom.width() == oldRightMax ) + if( newGeom.x() + newGeom.width() == oldRightMax ) newGeom.setLeft( qMax( leftMax, screenArea.x() )); else newGeom.moveLeft( qMax( leftMax, screenArea.x() )); diff --git a/kcmkwin/kwinscreenedges/monitor.cpp b/kcmkwin/kwinscreenedges/monitor.cpp index 4dcdf82b3c..2e6228f1e1 100644 --- a/kcmkwin/kwinscreenedges/monitor.cpp +++ b/kcmkwin/kwinscreenedges/monitor.cpp @@ -87,8 +87,8 @@ void Monitor::resizeEvent( QResizeEvent* e ) void Monitor::checkSize() { QRect contentsRect = previewRect(); - int w = 151; - int h = 115; + //int w = 151; + //int h = 115; view->setGeometry(contentsRect); scene->setSceneRect(QRect(QPoint(0,0), contentsRect.size())); int x2 = ( contentsRect.width() - 20 ) / 2; @@ -275,12 +275,14 @@ void Monitor::Corner::paint( QPainter* painter, const QStyleOptionGraphicsItem* void Monitor::Corner::hoverEnterEvent( QGraphicsSceneHoverEvent * e) { + Q_UNUSED( e ); m_hover = true; update(); } void Monitor::Corner::hoverLeaveEvent( QGraphicsSceneHoverEvent * e) { + Q_UNUSED( e ); m_hover = false; update(); }