Bug 117618 - kate: windows are on wrong desktops in restored session
Summary: kate: windows are on wrong desktops in restored session
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 131046 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-03 20:57 UTC by missive
Modified: 2008-09-23 12:44 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description missive 2005-12-03 20:57:36 UTC
Version:           2.5.0 (using KDE 3.5.0, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.14-gentoo-r3

Back when 3.4 came out, I had this trouble, but it was fixed in subsequent release. Now I see it again in 3.5.0.

I usually have about 10 kate windows open on various desktops. When my session is restored they should go back to the desktops where they were when the session was saved.

Right now, all kate windows are appearing on the first desktop, but I have also seen them appear on other wrong desktops and also sometimes on the correct desktop.
Comment 1 missive 2005-12-03 21:52:06 UTC
This is even stranger than I thought...

I just restarted my session again to test.

First, I arranged everything the way I want it, then I clicked the "Save Session" button. Then I logged out and back in.

I have desktops set up with the Taskbar set to show only windows that are on the current desktop.

I have one Kate window that was restored to the correct desktop, but when I am on that desktop, the window does not show up in the taskbar. It does show up in the taskbar of another desktop (the one immediately to the right). When I switch to that other desktop, and click on the errant Kate entry in the taskbar, I am switched back to the desktop where the window is.
Comment 2 gsasha 2006-01-11 14:19:15 UTC
Same happens to me (i.e., the trouble with restoring the different Kate windows on appropriate desktops).

My system is detected as: 2.5.0 (KDE 3.5.0, Kubuntu Package 4:3.5.0-0ubuntu0breezy1 breezy)
Comment 3 Marijn Schouten 2006-02-01 11:48:15 UTC
Actually I get this with kate 2.5.0, but also with kpdf 0.5 on kde 3.5.0, so maybe this is a kicker issue.
Comment 4 Claus Wilke 2006-02-15 05:06:04 UTC
Same here with KDE 3.5.1 on Kubuntu.
Comment 5 Anders Lund 2006-02-15 08:57:13 UTC
I believe this is related to the problem that Kate windows are not minimized when restored by the session manager, even if they were when the session was saved. I think something goes wrong so that the the window manager can't match the windows correctly.

I haven't been able to spot why this is so, but kate mainwindows does do things different from other mainwindows.
Comment 6 Maxilys 2006-02-22 15:12:51 UTC
Same problem with KDE 3.5.1 on SuSE 10. 

Kate's minimized windows are restored on the desktop instead of only in the taskbar. Besides, all Kate's windows always re-appear on the active desktop with no respect for the desktop on which they were at KDE shutdown.
Comment 7 Dimitar Zhekov 2006-03-17 11:59:07 UTC
Same on Slackware-10.2, kate-2.5.1, kde-3.5.1 contrib binaries from kde.org: all kate windows are restored on the current desktop, any minimized windows are de-minimized.
Comment 8 Marijn Schouten 2006-04-28 14:13:58 UTC
on kde 3.5.2 kate windows still pop up on wrong desktops. 
Comment 9 Adrian Dziubek 2006-05-24 02:45:40 UTC
The same on Debian 2.6.16-1-k7 4:3.5.2-2+b1
Comment 10 gsasha 2006-10-30 10:20:04 UTC
Problem still there on KDE 3.5.4. Aargh.
Comment 11 Marijn Schouten 2006-10-30 10:45:51 UTC
Yeah and 3.5.5 too.
Comment 12 BORGULYA Gábor 2007-01-01 16:33:41 UTC
Same with KDE 3.5.5, Gentoo.
Comment 13 Marijn Schouten 2007-03-18 19:18:03 UTC
Still there in 3.5.6
Comment 14 carl 2007-03-22 11:59:00 UTC
same with me (SuSe 9.3, 3.5.6 "release 31.4").
Kate and KMail and Skype are messed up practically all the time:
I have 8 desktops at #1 kate should be, at #8 kmail and skype.

But add. I register that now even the after 
right mouse click on the kate window for moving to a different desktop
shows a wrong desktop no. 

Carl
Comment 15 Danny Hartley 2007-04-23 15:05:13 UTC
Debian Etch, KDE 3.5.5, Kate 2.5.5. Kernel 2.4.27-3-686 and 2.6.18-4-686.
Same for me. On KDE startup I have Kate restore the session for desktop 3 but instead Kate appears on the current desktop instead (the last one on show from previous logout). If I click on a new desktop while Kate is still restoring files Kate will appear on the desktop. Previous Kate 2.3.2 worked great. Not sure if related, but also seems slow to restore the session (24 files) compared to the previously used Kate.
Comment 16 gambas 2007-06-20 11:44:08 UTC
Still there in KDE 3.5.7
Comment 17 Adrian Dziubek 2007-06-21 05:49:06 UTC
I think this could be a helpful remark. There are basically two kinds of applications:

1) that checks the desktop on the very beginning and then the instance lands on that desktop. Most applications do it this way.

2) that checks the desktop just before instantiating (hard word for a foreigner) and this is Kate's kind...

The second one seems to fail on desktop restoring... The thing is You can test it without restarting. Simply run the app and the switch immediately. Say Firefox, will stay on the desktop You ignited it on. Kate will follow You.

That's not very clever remark... but anyway...
Comment 18 Thomas Friedrichsmeier 2007-12-11 01:45:16 UTC
*** Bug 131046 has been marked as a duplicate of this bug. ***
Comment 19 meyerm 2008-04-25 15:14:53 UTC
Still valid for KDE 3.5.9 and Kate 2.5.9 :-(
Comment 20 Ivan Nazarenko 2008-07-02 02:38:31 UTC
Kate still behaves incorrectly in opensuse 11.0 (KDE 4.04).

I also have 10 desktops. Kate works with some dozen files in desktop 2, and if I turn it off in some other desktop, bingo... next time kate will be in the wrong one.

Kate shows this odd behavior for some years now. I really hoped that, with kde 4.x, this bug would vanish, and this was the very first thing I tested in this new opensuse install on my new notebook, bougth today.

Perhaps in version 5? :-)
Comment 21 Florian Konnertz 2008-07-12 14:05:22 UTC
I encounter this issue with konsole 1.6.6 on kde 3.5.9

any help appreciated!! kubuntu 1.75 on hardy
Comment 22 gambas 2008-07-21 12:11:19 UTC
Being really bored by this bug, I finally decided to download the KDE 3.5.9 source archives, hold my breath and dive into Kate's source code.

Many hours of Kate and KWin recompilations later, I think I can fix that bug. :-)

The problem seems to come from the KateApp::restoreKate() method, located in the kateapp.cpp source file.

At line 161, you see that:

  KStartupInfo::setNewStartupId(activeMainWindow(), startupId());

This call seems to make kicker crazy. If you remove it, Kate behaves correctly.

I look in other KDE programs, and apparently none of them use this method during session restore. So I think it is safe to remove it.

When Kate reopens its documents, it displays a progress bar. The code is located in the KateDocManager::restoreDocumentList() method, in the katedocmanager.cpp source file.

With the previous change, you won't see it anymore unless the current virtual desktop is the one Kate is located on.

Adding two lines in katedocmanager.cpp fixes the problem:

  #include <kencodingfiledialog.h>
  #include <kio/job.h>
+ #include <kwin.h>
...
    QProgressDialog *pd=new QProgressDialog(
          i18n("Reopening files from the last session..."),
          QString::null,
          count,
          0,
          "openprog");

+   KWin::setOnDesktop(pd->winId(), KWin::currentDesktop());
    pd->setCaption (KateApp::self()->makeStdCaption(i18n("Starting Up")));

IMHO, this progress bar is not really useful when restoring the session at login. But removing it in that specific case will need more changes.

Well, it seems that it works for me, and I'm really happy. :-).

Now what should I do to merge these changes?
Comment 23 Florian Konnertz 2008-07-22 11:20:02 UTC
this fix cant be transferred to konsole somehow, can it??  
Comment 24 gambas 2008-07-22 14:57:14 UTC
I have no problem with konsole: I have three or four instances of konsoles with many tabs on many different virtual desktops, and they all go where they should be at login.
Comment 25 gambas 2008-08-18 20:44:59 UTC
Fixed in KDE 3.5.10
Comment 26 George Kiagiadakis 2008-09-23 12:44:50 UTC
SVN commit 846328 by bminisini:

BUG: 117618

Kate is finally restored on the correct desktop.
The opened files progress window displayed at session restore is now put on the \
current desktop now, so that the user can see it.


 M  +2 -2      kateapp.cpp  
 M  +4 -2      katedocmanager.cpp