Bug 49042 - Pop-up window opening on a different virtual desktop forces focus on itself
Summary: Pop-up window opening on a different virtual desktop forces focus on itself
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: HI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 35245 44656 57191 58983 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-12 00:23 UTC by Svein Brostigen
Modified: 2007-02-06 16:17 UTC (History)
8 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 Svein Brostigen 2002-10-12 00:23:12 UTC
Version:            (using KDE KDE 3.0.8)
Installed from:    Compiled From Sources
Compiler:          gcc 3.1 
OS:          Linux

One of the really nice features in KDE is the ability to use multiple virtual desktops.

My problem is as follows:

1. I have a program running on Desktop 1
2. I switch to Desktop 2 to work in another program
3. The program on Desktop 1 opens a pop-up window on Desktop 1 and my focus is switched
   from Desktop 2 to Desktop 1.

This behaviour often leads to unwanted results, i.e in the middle of typing something and not really paying attention to the monitor.

My default Focus Policy is "Click to focus" and frankly I did not click :)

At least there should be some form of an option on how to define this behaviour.
My problem can be really pronounced as I have several programs running related to work that from time to time pop-up windows with alerts, messages and so forth.
Comment 1 Lubos Lunak 2002-10-14 11:40:17 UTC
*** Bug 44656 has been marked as a duplicate of this bug. ***
Comment 2 Svein Brostigen 2002-10-14 21:37:48 UTC
Hmmm. The bug that this one has been marked as a duplicate of has a status of 
resolved. Since the bug system you are using is not very well developed, it 
doesn't really show any useful information.  
Can someone please elaborate on in when this was fixed. Since I'm currently 
using 3.1 Beta 2, and I haven't been able to find a way to handle the issue, I 
find it hard to believe that the issue is resolved. 
 
Please adivse. 
Thank you! 
 
Comment 3 Frank Lee 2003-01-11 02:38:41 UTC
I have the same problem on Redhat 7.3 running KDE 3.0.

If this has been fixed, please tell in which version (operating system, and 
KDE) it was fixed. Thanks.
Comment 4 Matt Fago 2003-02-06 18:51:40 UTC
Frankly this is the one "feature" of KDE that drives me _CRAZY_!

Luckily I have a suggested fix.

First, to reiterate the problem:

If an application pops up a window/dialog (say an error message) on another
desktop, KDE instantly switches to that desktop and changes focus to the new
window/dialog.

This happens several times a day to me, and invaribly when I am typing something.

IMHO this behavior is completely unacceptable, and at the very least should be
controlled by a preference.

IMHO a more acceptable behavior would be to alert the user in some other way.
Personally, I would prefer that the pager for the desktop in question flash red
or something -- alerting me that an application on that desktop requires my
attention, but allowing me to finish typing.

I would really like to see this issue addressed. Unfortunately I'm not sure that
I have the expertise to fix this issue myself.

Is there any way that I can help?


Thanks!
Comment 5 Manuele Rampazzo 2003-02-18 18:08:11 UTC
I suppose that a good solution is something like the WindowMaker one.

You can specify in which desktop you want to open an application window
selecting it by "window class". I can force every konqueror window to open in
desktop 2, kopete windows in desktop 3 and so on.

I think it is very useful for a tidy desktop, it can be a very nice feature.

Of course, Kwin can flash the desktop with new activity or send another kind of
signal, as Matt Fago wrote.
Comment 6 Matt Fago 2003-02-21 20:26:14 UTC
Right now KWin does seem to open the alerts in the appropriate desktop. My issue
is that it then switches the user to that desktop and changes focus to the alert.

Perhaps add a new preference:

 o Click to focus
     o Even for alerts  (new)

This also should (?) stop KWin from switching desktops.

An additional preference to flash the pager for any desktops with new alerts
would make the whole thing more user friendly.

A suggestion for a UI, but nothing close to a patch...
Comment 7 Wolfgang Silbermayr 2003-04-01 15:08:51 UTC
Well, I also have sometimes had this problem (korn focuses the kmail window 
running on another desktop). My suggestion is to put this into an option where you 
can also set a certain time that kde waits after the last keyboard and mouse action 
before switching to another desktop itself. For me this would be acceptable if I am 
typing and after my last keystroke kde waits a second or two and then switches to 
the other desktop. 
Comment 8 Matt Fago 2003-04-03 16:14:05 UTC
Re: comment #7

This would help in certain situations, but not others. 

I have had problems where the desktop switches just as I start to type. It
invaribly happens when an error dialog gets popped up -- hence it gets dismissed
before I can read it. A serious problem IMHO.

Any hope of getting this bug addressed?
Comment 9 Wolfgang Silbermayr 2003-04-03 16:18:55 UTC
Well, You are right. I did not think about this before, but this is really a serious 
problem. 
My typical situation is that I am typing something and korn activates my email 
window at the same moment. After this I have many new message windows open 
from the standard shortcuts used by kmail, although it is not as bad as losing an 
important error message before being able to read it. 
Comment 10 Lubos Lunak 2003-04-15 09:38:31 UTC
*** Bug 57191 has been marked as a duplicate of this bug. ***
Comment 11 Lubos Lunak 2003-05-07 20:32:43 UTC
*** Bug 35245 has been marked as a duplicate of this bug. ***
Comment 12 Lubos Lunak 2003-05-07 20:33:09 UTC
Almost done. 
 
Comment 13 Cyrille Dunant 2003-05-19 22:07:50 UTC
   A possible solution : the error window appears on the app desktop + a KPassivePopup 
appears sgnalling an error+desktop name... 
 
   
Comment 14 Andrew Berry 2003-05-20 00:20:58 UTC
I have the same issue with KDE under MDK 9.1, kde 3.1.1. I use sloppy focus with 
autoraise, but I still think that KDE should not switch desktops for alerts 
automatically. How about flashing the desktop number in the desktop switcher 
when an alert pops up?
Comment 15 Lubos Lunak 2003-05-26 13:05:51 UTC
*** Bug 58983 has been marked as a duplicate of this bug. ***
Comment 16 Lubos Lunak 2003-05-30 17:03:44 UTC
Committed to kwin_iii, and is currently being tested. 
 
Comment 17 Matt Fago 2003-08-18 04:50:55 UTC
Is this fix in KDE 3.1.3? I found the preference dialog in "System
Notifications:" "Show message in a pop-up window" and "Use a passive window that
does not interrupt other work."

Unfortunately, this does not seem to work at all for me. Is this feature only
available with KDE applications?
Comment 18 Lubos Lunak 2003-08-18 10:35:59 UTC
KDE3.2+ only. 
 
Comment 19 Caio Boiteux 2005-04-01 18:28:38 UTC
I saw this bug as resolved but, I still have the same bug in kde 3.4 compiled from source
what happens is this, go to another virtual desktop open a program there (lets name it prog A)
then change virtual desktop and go work in another prog (lets call it prog b)
if prog A pops up any msg it takes away focus from prog b and switchs me to the desktop that contains prog A
its vey anoying and happens all the time during a busy work day
if this is really fixed how can i stop this from happening ?
thanks
Comment 20 Lubos Lunak 2005-04-04 12:16:02 UTC
> if this is really fixed how can i stop this from happening ?
By describing the problem more precisely than just saying things like "lets name it prog A".
Comment 21 Caio Boiteux 2005-05-08 20:15:20 UTC
i think all the descriptions above mine, were very precise and didn't want to elaborate more, but let's go
configure kwin with more than 1 desktop (I have 8)
open one konqueror window in desktop 1 to a site that is slashdoted or very slow
move to desktop 2
do the same to some other very slow (or down) site
move to desktop 3 
open kwrite and start to type 
as soon as the site in konqueror 1 (desktop 1) times out, you are automaticaly switched to the error message in desktop 1 (remember i was typing in desktop 3)
then when the konqueror in desktop 2 times out
you are again switched to the popup in desktop 2

this happens a lot of times a day (everytime theres a popup in another desktop that is not the current). aparently when kwin map a new window it switches the desktop to that of the new window ang give this windows focus.
what i and probably all in this thread are looking for is a way to override this so that if there's a popup in a desktop that is not the active one, the focus and the desktop doesnt change

unfortunately i cant code this level of change in kwin, but will gladly test any patch to help achieve that

thanks 
Comment 22 Caio Boiteux 2005-05-08 22:18:40 UTC
Hi Lubos
i made some tests and i "resolved" the problem
in kwin/manage.cpp line 476 there's
virtualDesktopChange();

supressig this line, make kwin behaves like i want (not change desktop when mapping new windows).
but this "solution" only solves half the problem, because that way you dont have any indication that a new windows was mapped in another desktop.

To solve this other part of the problem, i think the sugestion Mat Faggo gave in the thread of making the pager flash for the desktop that had the window mapped would be great
unfortunately altought i can read code, i cant code decent C++, so i cant send the patch.
if you can write it, i'll serve as guinea pig
thanks
Comment 23 Caio Boiteux 2005-05-09 05:10:51 UTC
Lubos,
I made many more tests and I was wrong before
the virtualDesktopChange in line 476 of manage.cpp doesn't fix the problem.

but I found a very interesting info that i'm sure will help you pinpoint it.

My kde is configured to let me save a session manualy
wen I run kwin for the first time (without saving any session), the problem doesn't manifest itself (that is you're not redirected to the new window desktop)
but as soon as you save a session manualy, everytime a new window is mapped, you're switched to it's desktop
I think the save session code is forgetting to unset something, at firt I tought that workspace()->sessionSaving() was no returning to false at save session end, but even thought I commented out the code that checks for it and redirects in managed.cpp i couldn't stop the switching
since i'm terrible in C++ I gave up and decided to pass you all this info in hope that it would help

if you need any more info, let me know
Comment 24 Lubos Lunak 2005-05-09 15:01:15 UTC
That's what I needed to know. Fixed.
Comment 25 Lubos Lunak 2005-05-09 15:02:21 UTC
SVN commit 411485 by lunakl:

Send SaveComplete when checkpoint is completed (comment #19 and onward in #49042).
CCBUG: 49042



 M  +3 -0      trunk/KDE/kdebase/ksmserver/server.cpp  


--- trunk/KDE/kdebase/ksmserver/server.cpp #411484:411485
@@ -1260,6 +1260,9 @@
         }
         startKilling();
     } else if ( state == Checkpoint ) {
+        for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
+            SmsSaveComplete( c->connection());
+        }
         state = Idle;
     }
 }
Comment 26 wurst2 2006-10-20 12:03:53 UTC
I experience the same behaviour as people reported here - new mapped windows or popups switch the current desktop automatically. So I think the bug is not really fixed.

The desktop should never be changed automatically, or at least that should not be the default configuration. This can even be a security issue, when the switch happens when I am typing in passwords or other sensitive information.

System information: I have kde 3.3.5 from Debian Linux testing/unstable installed.
Comment 27 wurst2 2006-10-20 12:07:29 UTC
Correction to the system information: the version is kde 3.5.5, not 3.3.5. Or to be precise, I have the Debian kwin package 4:3.5.5a-2 installed.

Comment 28 Reid Rivenburgh 2007-02-06 03:47:12 UTC
I'm not sure if what I'm seeing is related, but just in case....  I have 8 desktops.  I run Firefox on one of them.  When I start it, Firefox often restores a previous session with many tabs.  Because there are so many tabs, it takes quite a lot of time to restore them all.  I typically go to a different desktop to do something else while I wait.  Several times as tabs fully load, it will automatically switch me to the desktop with Firefox.  It's quite annoying.  I can't easily recreate this with a single tab reload (i.e. reload a page and quickly jump to a different desktop), so I don't know what's going on.  I have focus stealing prevention set to Extreme, but it doesn't seem to affect this.

I'm running FC6 with the latest kdebase RPM: kdebase-3.5.6-0.1.fc6.  TIA.
Comment 29 jos poortvliet 2007-02-06 11:08:47 UTC
check this: rightmouseclick on windowdecoration -> configure window behaviour -> specific window settings.

you see for firefox, focus stealing prevention is disabled by default. i have no idea why, but i removed that, and it doesn't irritate anymore ;-)
Comment 30 Reid Rivenburgh 2007-02-06 16:17:44 UTC
Thanks, jos!  That does indeed seem to have fixed my problem.  (I'm curious why it's disabled and why this isn't better publicized [or maybe it is and I didn't see it]!)  Sorry to waste bug bandwidth....