[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/desktop/containments/desktop
From:       Giulio Camuffo <giuliocamuffo () gmail ! com>
Date:       2010-07-27 16:21:03
Message-ID: 20100727162103.A6926AC775 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1155578 by camuffo:

adjust the position of the moved applet only, avoiding to move back to its original \
position an applet the user might  be moving
BUG:242172


 M  +6 -4      desktop.cpp  
 M  +3 -1      desktoplayout.cpp  
 M  +3 -1      desktoplayout.h  


--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/desktop/desktop.cpp \
#1155577:1155578 @@ -111,14 +111,16 @@
 
 void DefaultDesktop::onAppletTransformedByUser()
 {
-    m_layout->itemTransformed((Applet *)sender(), DesktopLayout::ItemTransformUser);
-    m_layout->adjustPhysicalPositions();
+    Plasma::Applet *applet = static_cast<Plasma::Applet *>(sender());
+    m_layout->itemTransformed(applet, DesktopLayout::ItemTransformUser);
+    m_layout->adjustPhysicalPositions(applet);
 }
 
 void DefaultDesktop::onAppletTransformedItself()
 {
-    m_layout->itemTransformed((Applet *)sender(), DesktopLayout::ItemTransformSelf);
-    m_layout->adjustPhysicalPositions();
+    Plasma::Applet *applet = static_cast<Plasma::Applet *>(sender());
+    m_layout->itemTransformed(applet, DesktopLayout::ItemTransformUser);
+    m_layout->adjustPhysicalPositions(applet);
 }
 
 void DefaultDesktop::refreshWorkingArea()
--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/desktop/desktoplayout.cpp \
#1155577:1155578 @@ -283,7 +283,7 @@
     return tempItemSpace.m_groups[tempGroup].m_groupItems[tempItem].lastGeometry;
 }
 
-void DesktopLayout::adjustPhysicalPositions()
+void DesktopLayout::adjustPhysicalPositions(QGraphicsWidget *item)
 {
     for (int groupId = 0; groupId < itemSpace.m_groups.size(); groupId++) {
         ItemSpace::ItemGroup &group = itemSpace.m_groups[groupId];
@@ -292,6 +292,7 @@
             ItemSpace::ItemSpaceItem &spaceItem = group.m_groupItems[itemId];
             DesktopLayoutItem &desktopItem = items[spaceItem.user.toInt()];
 
+            if (item == 0 || item == desktopItem.item) {
             // Temporarily place the item if it could not be pushed inside the \
working area.  // Put it back if it fits again.
             if (itemSpace.positionVisibility(spaceItem.lastGeometry) < \
visibilityTolerance) { @@ -335,6 +336,7 @@
         }
     }
 }
+}
 
 void DesktopLayout::itemTransformed(QGraphicsWidget *layoutItem, ItemTransformType \
type)  {
--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/desktop/desktoplayout.h \
#1155577:1155578 @@ -104,8 +104,10 @@
 
     /**
      * Adjusts the items' on-screen positions to match calculations.
+     *
+     * @param the item to be adjusted. If 0 all the items will be checked.
      **/
-    void adjustPhysicalPositions();
+    void adjustPhysicalPositions(QGraphicsWidget *item = 0);
 
     /**
      * Returns the count of items in the layout.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic