[Bug 40418] The desktop is scrollable when icons are dragged below
the panel
Andreas Kling
kling at impul.se
Sat Jul 29 10:20:55 UTC 2006
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=40418
kling impul se changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From kling impul se 2006-07-29 12:20 -------
SVN commit 567551 by kling:
If icons are dragged outside the desktop area, jerk them back in.
Fixes the long-hated issue with the desktop becoming scrollable.
BUG: 40418
M +32 -0 kdiconview.cc
--- branches/KDE/3.5/kdebase/kdesktop/kdiconview.cc #567550:567551
@ -1361,6 +1361,38 @
setLastIconPosition( e->pos() );
KonqIconViewWidget::contentsDropEvent( e );
}
+
+ // Check if any items have been moved outside the desktop area.
+ // If we find any, move them right back in there. (#40418)
+ QRect desk = desktopRect();
+ bool adjustedAnyItems = false;
+ for( QIconViewItem *item = firstItem(); item; item = item->nextItem() )
+ {
+ if( !desk.contains( item->rect(), true ))
+ {
+ QRect r = item->rect();
+
+ if( r.top() < 0 )
+ r.moveTop( 0 );
+ if( r.bottom() > rect().bottom() )
+ r.moveBottom( rect().bottom() );
+ if( r.left() < 0 )
+ r.moveLeft( 0 );
+ if( r.right() > rect().right() )
+ r.moveRight( rect().right() );
+
+ item->move( r.x(), r.y() );
+ adjustedAnyItems = true;
+ }
+ }
+ if( adjustedAnyItems )
+ {
+ // Make sure the viewport isn't unnecessarily resized by now,
+ // then schedule a repaint to remove any garbage pixels.
+ resizeContents( width(), height() );
+ viewport()->update();
+ }
+
if (QIconDrag::canDecode(e)) {
emit iconMoved();
if ( !m_autoAlign ) // if autoAlign, positions were saved in lineupIcons
More information about the pkg-kde-bugs-fwd
mailing list