Bug 82800 - Regression: Icons are moving down/left after each login
Summary: Regression: Icons are moving down/left after each login
Status: CLOSED FIXED
Alias: None
Product: kdesktop
Classification: Miscellaneous
Component: icons (show other bugs)
Version: CVS
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Benoit Walter
URL:
Keywords:
: 87673 123829 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-03 22:12 UTC by András Manţia
Modified: 2009-01-02 20:28 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch (1.37 KB, patch)
2004-09-15 00:09 UTC, Ingo Klöcker
Details
patch (1.49 KB, patch)
2004-10-18 22:22 UTC, Waldo Bastian
Details
kdesktop_icons.patch (2.19 KB, patch)
2004-10-20 16:09 UTC, Waldo Bastian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description András Manţia 2004-06-03 22:12:40 UTC
I have Kicker at the top and a child panel at the bottom. After each login the 
icons are moving down. This means 
that if I put the Trash icon to the top, just below the kicker, after some time 
it goes down and disappears behind 
the child panel (and after some more login/logout appears again at the top). 
Not so user friendly. ;-) 
 
PS: I'm not sure if the bug belongs to general or icons, but I selected icons.
Comment 1 Dave Griffiths 2004-08-29 20:01:09 UTC
I also have the same problem, however, I have kicker at the bottom of the screen and my trash can moves upwards from the bottom right corner of the screen with each login. Also, other icons switch position on login as well, from left hand side to top middle. I have tried starting with an empty session as well as using session management, but it makes no difference.
Comment 2 Michael Nottebrock 2004-08-30 19:17:17 UTC
Same here. This seems to be related to bug:87673 , bug:47627. It is also a regression from KDE 3.2.
Comment 3 Ingo Klöcker 2004-08-31 17:40:29 UTC
*** Bug 87673 has been marked as a duplicate of this bug. ***
Comment 4 Ingo Klöcker 2004-08-31 17:42:08 UTC
Bug 87673 describes the same problem in the case that the panel is on the left. This bug is extremly annoying.
Comment 5 Pawel Kraszewski 2004-09-14 10:02:28 UTC
I have the same layout (except kicker is at the bottom and child at the top) as Manthia (KDE 3.3 on Gentoo).

Same thing happening here, very annoying. So it seems it's not moving away from Kicker (which would make my icons move upwards) but away from top of the screen.
Comment 6 Ingo Klöcker 2004-09-15 00:09:16 UTC
Created attachment 7529 [details]
Proposed patch

This patch fixes the problem for me. The reason for this bug is that the
absolute coordinates (relative to the upper left corner of the virtual screen)
of the icons are saved. After restarting the icons are drawn on the empty
desktop at those coordinates. Then something (Kicker or some extension)
partially hides the desktop. This changes the icon area and therefore kdesktop
moves the icons.

The patch makes sure that not the absolute coordinates but the relative
coordinates (relative to the upper left corner of the icon area) are saved.
This fixes the problem.

Applying this fix reveals another bug: If kdesktop is started after kicker then
the icon area is not initialized correctly. Therefore the icons won't be drawn
at the correct positions if kdesktop is started after kicker.

Anyway, my fix for the original problem (which affects all users which have
kicker or some extension on the left or upper side of the screen) doesn't
create this second bug (which probably will never affect normal users because
normal users won't manually start kdesktop after kicker). So I think my fix
should be applied in any case.
Comment 7 Pawel Kraszewski 2004-09-16 00:27:17 UTC
Oh, yes - one more thing. At work I use MDK 10.0 Pro with KDE 3.2 BRANCH (the standard of MDK). I use dual kicker there, too, but icons don't move during re-logins... I must inspect the SRPM...
Comment 8 ieure 2004-09-18 00:44:50 UTC
Basically the same here; child panel on top, kicker and a second (autohiding) child on bottom. Icons creep up the screen on every login.

KDE 3.3.0, Debian sid packages.

Extremely irritating.
Comment 9 Lubos Lunak 2004-09-20 17:00:28 UTC
CVS commit by lunakl: 

Save the icon positions relatively to the workarea, not to the screen,
otherwise workarea adjusting during login after kicker shows up moves
them out of their right place.

However, do this only for left and top edge, as they are handled
differently from the right and bottom edge. Benoit, why adding a panel
at the left edge moves all icons to the right, while adding it
at the right edge does nothing, not even with icons near the right edge?
The saving/loading code actually tries to keep icons on the right side
relatively to the right side too.

CCMAIL: 82800-done@bugs.kde.org
CCMAIL: b.walter@free.fr


  M +10 -6     kdiconview.cc   1.132


--- kdebase/kdesktop/kdiconview.cc  #1.131:1.132
@@ -59,7 +59,9 @@
 extern int kdesktop_screen_number;
 
-#define saveIconPosition(config, _x, _y) \
+#define saveIconPosition(config, _x, _y, iconArea) \
 do { \
     int x = _x; int y = _y; \
+    x -= iconArea.x(); \
+    y -= iconArea.y(); \
     if (x > ((desk.width()*3) / 4)) x -= desk.width(); \
     if (y > ((desk.height()*3) / 4)) y -= desk.height(); \
@@ -68,5 +70,5 @@ do { \
 } while(false)
 
-#define readIconPosition(config, x, y) \
+#define readIconPosition(config, x, y, iconArea) \
 do { \
     x = (config)->readNumEntry( X_w, -9999 ); \
@@ -76,4 +78,6 @@ do { \
     if ( y == -9999 ) y = (config)->readNumEntry( "Y" ); \
     if (y < 0) y += desk.height(); \
+    x += iconArea.x(); \
+    y += iconArea.y(); \
 } while(false)
 
@@ -194,5 +198,5 @@ void KDIconView::initDotDirectories()
                  {
                     int x,y;
-                    readIconPosition(&dotDir, x, y);
+                    readIconPosition(&dotDir, x, y, iconArea());
                     m_dotDirectory->writeEntry( X_w, x );
                     m_dotDirectory->writeEntry( Y_h, y ); // Not persistant!
@@ -933,5 +937,5 @@ void KDIconView::slotNewItems( const KFi
         m_hasExistingPos = true;
         int x,y;
-        readIconPosition(m_dotDirectory, x, y);
+        readIconPosition(m_dotDirectory, x, y, area);
 
         kdDebug(1214)<<"slotNewItems() x: "<<x<<" y: "<<y<<endl;
@@ -1222,5 +1226,5 @@ void KDIconView::slotAboutToCreate(const
         {
            m_dotDirectory->setGroup( iconPositionGroupPrefix() + (*it).uDest.fileName() );
-           saveIconPosition(m_dotDirectory, m_lastDropPos.x(), m_lastDropPos.y());
+           saveIconPosition(m_dotDirectory, m_lastDropPos.x(), m_lastDropPos.y(), iconArea());
            int dX = m_lastDropPos.x() - m_dropPos.x();
            int dY = m_lastDropPos.y() - m_dropPos.y();
@@ -1500,5 +1504,5 @@ void KDIconView::saveIconPositions()
     m_dotDirectory->setGroup( prefix + item->url().fileName() );
     kdDebug(1214) << "KDIconView::saveIconPositions " << item->url().fileName() << " " << it->x() << " " << it->y() << endl;
-    saveIconPosition(m_dotDirectory, it->x(), it->y());
+    saveIconPosition(m_dotDirectory, it->x(), it->y(), iconArea());
     m_dotDirectory->writeEntry( "Exists", true );
 


Comment 10 Waldo Bastian 2004-09-20 17:42:15 UTC
On Monday 20 September 2004 17:00, Luboš Luňák wrote:
> CVS commit by lunakl:
>
> Save the icon positions relatively to the workarea, not to the screen,
> otherwise workarea adjusting during login after kicker shows up moves
> them out of their right place.
[Snip]
> -#define saveIconPosition(config, _x, _y) \
> +#define saveIconPosition(config, _x, _y, iconArea) \
>  do { \
>      int x = _x; int y = _y; \
> +    x -= iconArea.x(); \
> +    y -= iconArea.y(); \
>      if (x > ((desk.width()*3) / 4)) x -= desk.width(); \
>      if (y > ((desk.height()*3) / 4)) y -= desk.height(); \

I think you should replace desk with iconArea as well then

Cheers,
Waldo
Comment 11 Lubos Lunak 2004-09-20 17:51:16 UTC
On Monday 20 of September 2004 17:50, Waldo Bastian wrote:
> On Monday 20 September 2004 17:00, Luboš Luňák wrote:
> > CVS commit by lunakl:
> >
> > Save the icon positions relatively to the workarea, not to the screen,
> > otherwise workarea adjusting during login after kicker shows up moves
> > them out of their right place.
>
> [Snip]
>
> > -#define saveIconPosition(config, _x, _y) \
> > +#define saveIconPosition(config, _x, _y, iconArea) \
> >  do { \
> >      int x = _x; int y = _y; \
> > +    x -= iconArea.x(); \
> > +    y -= iconArea.y(); \
> >      if (x > ((desk.width()*3) / 4)) x -= desk.width(); \
> >      if (y > ((desk.height()*3) / 4)) y -= desk.height(); \
>
> I think you should replace desk with iconArea as well then

 I would, but that'd actually break the right and bottom edges. That's why the 
commit had the paragraph starting with 'However' and Benoit in CC.

Comment 12 Waldo Bastian 2004-10-18 22:12:04 UTC
SUSE BR46012:
If you put the kicker at the top of the screen, then create a
new desktop icon with auto-align on, all the icons slide up so
that the top ones are up under the kicker.  Turning auto-align
off and then on afterward aligns normally.
Comment 13 Waldo Bastian 2004-10-18 22:21:33 UTC
The above SUSE BR46012 let me to KDIconView::slotNewItems,
there the icon-area is invalidated (see r1.122, somewhat surprisingly indeed needed to get desktop icons at all, as the comment says)

However, the call to KDIconView::lineupIcons() should be made with a proper icon-area because otherwise KonqIconView::lineupIcons() is called with an invalid icon-area, which results in KonqIconViewWidget::gridValues using the viewport instead of the actual icon area, resulting in SUSE BR46012

But also, KDIconView::lineupIcons() calls KDIconView::saveIconPositions() and that one will also use the incorrect icon-area which I think may explain the
problem that Lubos encountered when replacing desk.width() with area.width().

Attached patch makes sure that lineupIcons() is called with proper work area and replaces desk.width() with area.width(). Lubos can you check?
Comment 14 Waldo Bastian 2004-10-18 22:22:56 UTC
Created attachment 7944 [details]
patch
Comment 15 Lubos Lunak 2004-10-19 14:06:45 UTC
The patch looks ok to me, but I think it should be rather checked by Benoit. The problem with different handling of left+top vs right+bottom edges still stays.
Comment 16 Waldo Bastian 2004-10-19 16:00:42 UTC
Oh, I see now, I had "align to grid" enabled and then it works ok, but with that disabled the icons do indeed stay the under the panel when you move the panel to the right side.
Comment 17 Waldo Bastian 2004-10-20 16:08:53 UTC
The different handling seems to be done in KDIconView::updateWorkArea
In particular visibleHeight() and visibileWidth() should be replaced with
wr.bottom() and wr.right() I think. New patch attached.
Comment 18 Waldo Bastian 2004-10-20 16:09:43 UTC
Created attachment 7968 [details]
kdesktop_icons.patch
Comment 19 Michał Kosmulski 2004-10-24 22:30:56 UTC
I'm not sure if I should open a separate bug report for my problem, but it's so similar to this one, I'll just add a comment here.
I'm running KDE 3.3.1 now (slackware packages).
I have kicker (100% width) at the bottom and a child panel at the top (centered, about 70% width, hide policy: when mouse touches upper screen edge, windows can overlap this panel). "Snap icons to grid" is enabled. There is a vertical column with the standard icons: Home, Trash etc. at the left edge of the screen. The 70% width of the top panel makes it possible to have an icon in the upper left corner, like this (call this setup A):
+-----+-----------------
| XXX |
| XXX +-----------------
|
| YYY
| YYY
|
| ZZZ
| ZZZ
|
The problem is, it seems that when I just log in, icons are first arranged this way, but then they are moved down, as if the top panel was 100% wide (setup B):

+-----+-----------------
|     |
|     +-----------------
| XXX
| XXX
|
| YYY
| YYY
|
| ZZZ
| ZZZ
|
This alone would not be a problem if the icons stayed there (actually, if we want to snap icons to the grid all over the screen area, this makes more sense than setup A).
The trouble is that in some situations, icons are again shifted to the previous position. This includes the situation when the desktop is redrawn after a fullscreen game has been run. Again, when icons get put in position A some way, in certain circumstances the desktop is refreshed and they are shifted down. Sometimes all icons are shifted, even those which are aligned near the bottom kicker, so they end up being shifted under the kicker panel. All this is somewhat disturbing but quite similar to previous reporters' observations. It just seems that two different ways of positioning the icons are used in different placed (one relative to the whole desktop area, the other one relative to 'desktop-panels'). I don't really care which one is used (both have their pros and cons), but I guess the same method should be used always if we want to preserve a consistent icon layout.
Comment 20 Michał Kosmulski 2004-10-25 11:34:49 UTC
I also noticed that icons move between positions A and B when an icon is copied from the K menu via drag and drop.
Comment 21 Michael Nottebrock 2004-10-30 11:34:31 UTC
I noticed this problem in 3.3.0 as well, seems fixed for me in 3.3.1 (at least the icons are not moved down by my autohidden kicker anymore, both with and without align to grid enabled).
Comment 22 Martin Koller 2004-12-29 19:52:27 UTC
Waldos patches are already included, I have also made some changes for bug:91575, and I can not reproduce the behaviour mentioned with 3.4 CVS.
I'll close it therefore.
Comment 23 Miguel De Anda 2005-12-08 23:36:38 UTC
I'm running kde 3.5 (slackware contrib packages) and I'm getting this problem. I have kick on the bottom (auto hide) and a child panel on top (not autohide). If you need a kicker config just let me know how to get it (I remember reading a complaint on Aaron's blog about configs)

I even tried setting the "Lock in Place" bit in hopes of keeping them from moving down. The funny thing is that icons stack up on the bottom instead of wrapping or going below the bottom edge, that's thoughtful :)
Comment 24 Allan Canush 2006-01-19 23:50:45 UTC
Is there any easy way to apply a patch? The attachment thingys are just text files, and I don't know what to do. Details:

KDE 3.4.3
Kicker 3.4.3 (no auto-hide) on bottom
Icons slide up every login
No other panels
4 virtual desktops

I think those are all the details anyone needs, but if you need more, ask for more.
Comment 25 Tommi Tervo 2006-03-18 20:16:35 UTC
*** Bug 123829 has been marked as a duplicate of this bug. ***
Comment 26 FiNeX 2009-01-02 20:28:28 UTC
Bug closed. Kdesktop is no more mantained.