Bug 306365 - Clicking several times puts focus on background window
Summary: Clicking several times puts focus on background window
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-06 18:23 UTC by Philip
Modified: 2012-10-13 22:57 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
xev log (mouse wheel) scrolling through window (740 bytes, application/gzip)
2012-09-18 16:22 UTC, Philip
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip 2012-09-06 18:23:29 UTC
Example 1:
In Firefox, the search bar is visible (Ctrl + F). I keep clicking the "Next" button for a couple of times. After a few seconds, it behaves as if the mouse were gone - it's still focused (dotted border line), but the 3D hover effect is gone (so the button looks just the "Previous" button next to it) and clicks don't get to this button. Sometimes it seems, as if the clicks reach the window behind the browser.

Example 2:
A browser window is open, behind it is a terminal window. Both have vertical scrollbars enabled.
I keep scrolling (mouse wheel) the web page (browser has focus) without moving the mouse. After a few seconds, the terminal window starts scrolling (in other words, the wheel action is sent to the terminal window). Sometimes, another workspace appears, as if the wheel had been used directly on the desktop.

I know that Firefox uses GTK and KDE uses Qt, but the same has happened with Qt applications too.
I'm not completely sure if this is a KDE issue, but I use KDE as well as Fluxbox and it only seems to happen in KDE.

Reproducible: Always

Steps to Reproduce:
1. Keep clicking a button quickly (at least twice per second).
2. Don't move the mouse (not even 1 pixel).
3. Mouse somehow gets lost in another dimension.
Actual Results:  
Mouse gets lost in some parallel universe.

Expected Results:  
Clicking (or scrolling with wheel) should for more than 5 seconds.
Comment 1 Christoph Feck 2012-09-07 22:53:03 UTC
Please add the following information:

1. which KDE version do you use?

2. does the window below, which incorrectly has focus, get activated by the window manager, i.e. different title bar or shadow glow?
Comment 2 Thomas Lübking 2012-09-07 22:58:32 UTC
When this happens suspend compositing (assuming you use it) - what happens then?
Comment 3 Philip 2012-09-09 13:05:09 UTC
KDE 4.8.5.
This happens on several systems (all running Fedora).

No, the background window does not get activated. In fact, I don't see any visible change at all.
And it really only seems to affect the mouse, because when it happens and I'm scrolling (mouse wheel) through a terminal window (foreground window) and suddenly the terminal stops scrolling and the Firefox window (background window) starts scrolling, I can still navigate through the terminal window using the keyboard, only the mouse wheel is sent to the background window.
And like I said, it only happens as long as I don't move the mouse. The second I move it one single pixel, the wheel is sent to the foreground terminal window again.

I disabled compositing (by adding "Enabled=false" to the "[compositing]" section of ~/.kde4/share/config/kwinrc, logout, login, no real transparency anymore), but this didn't change anything.

I have a feeling that it might be related to Fedora in some way. I've just started my only Ubuntu (test) system and it did *not* happen there. It still runs KDE 4.7.2 though, so I'll update it and try again.
Comment 4 Thomas Lübking 2012-09-09 20:51:20 UTC
FYI: Shift+Alt+F12 will suspend/resume compositing - no need to edit anything or quit the session ;-)

Regarding the actual issue:
is always FF or another Browser involved or does it also happen with, say, 2 kwrite windows?
Comment 5 Philip 2012-09-10 17:16:55 UTC
Same thing with 2 KWrite windows (can be anything, apparently).
When the "mouse focus" drops into the background window, it doesn't always stay that way forever. If I keep scrolling, the mouse focus (the actual focus remains in the foreground window) drops even further and I suddenly end up on another workspace (wheel on desktop).

Do you have a Fedora based test system you could use to reproduce this behavior?
Comment 6 Thomas Lübking 2012-09-10 18:47:48 UTC
No, no fedora.
If you can reproduce this for somewhat certain, you could log root events:

xev -root > xev.out

- trigger the issue
- ctrl+c xev logging
- probably compress the file (iirc bugzilla has a 1MB limit or so) and attach it to the bug.

please avoid any explicit focus changing as much as possible when doing this (so the wanted events would kinda stick out in the log)
Comment 7 Philip 2012-09-18 16:22:17 UTC
Created attachment 74002 [details]
xev log (mouse wheel) scrolling through window

Foreground window: Terminal window (674x448)
Background window: Browser window (1024x730)

I started (mouse wheel) scrolling (mouse on the terminal window) and just after a few seconds, the browser window in the background started scrolling. I was also able to stop for a second and scroll in the other direction (still the browser) - as long as I didn't move the mouse.
Comment 8 Philip 2012-09-18 16:24:27 UTC
Comment on attachment 74002 [details]
xev log (mouse wheel) scrolling through window


ClientMessage event, serial 13, synthetic YES, window 0x4e00013,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 14, synthetic NO, window 0x132,
    event 0x132, window 0x2000258, (197,88), width 827, height 642,
    border_width 0, above 0x200005f, override NO

PropertyNotify event, serial 14, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16231879, state PropertyNewValue

MapNotify event, serial 15, synthetic NO, window 0x132,
    event 0x132, window 0x2000258, override NO

PropertyNotify event, serial 15, synthetic NO, window 0x132,
    atom 0x11b (_NET_STARTUP_ID), time 16231909, state PropertyNewValue

UnmapNotify event, serial 15, synthetic YES, window 0x132,
    event 0x132, window 0x132, from_configure NO

ClientMessage event, serial 16, synthetic YES, window 0x4e00013,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16231935, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16231935, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x60000c3,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x2004a90, (0,0), width 1024, height 730,
    border_width 0, above 0x2000258, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16231987, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x60000c3,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232100, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232100, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x1c00055,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ClientMessage event, serial 16, synthetic YES, window 0x1c00055,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x200005f, (14,56), width 674, height 448,
    border_width 0, above 0x2004a90, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16232189, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x1c00055,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232199, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232199, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x4e00013,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ClientMessage event, serial 16, synthetic YES, window 0x4e00013,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x2000258, (197,88), width 827, height 642,
    border_width 0, above 0x200005f, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16232239, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x4e00013,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232251, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232251, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x60000c3,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x2004a90, (0,0), width 1024, height 730,
    border_width 0, above 0x2000258, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16232315, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232330, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16232330, state PropertyNewValue

CreateNotify event, serial 16, synthetic NO, window 0x132,
    parent 0x132, window 0x22003dd, (0,0), width 512, height 307
border_width 0, override NO

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x22003dd, (0,0), width 243, height 82,
    border_width 0, above 0x6000631, override YES

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x22003dd, (532,648), width 243, height 82,
    border_width 0, above 0x6000631, override YES

MapNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x22003dd, override YES

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x11b (_NET_STARTUP_ID), time 16232457, state PropertyNewValue

UnmapNotify event, serial 16, synthetic YES, window 0x132,
    event 0x132, window 0x132, from_configure NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x11b (_NET_STARTUP_ID), time 16232739, state PropertyNewValue

UnmapNotify event, serial 16, synthetic YES, window 0x132,
    event 0x132, window 0x132, from_configure NO

ClientMessage event, serial 16, synthetic YES, window 0x4e00013,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x2000258, (197,88), width 827, height 642,
    border_width 0, above 0x2004a90, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16233502, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16233506, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16233506, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x1c00055,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x200005f, (14,56), width 674, height 448,
    border_width 0, above 0x2000258, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16233519, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16233524, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16233524, state PropertyNewValue

ClientMessage event, serial 16, synthetic YES, window 0x60000c3,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ClientMessage event, serial 16, synthetic YES, window 0x60000c3,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x2004a90, (0,0), width 1024, height 730,
    border_width 0, above 0x200005f, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16233589, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16233601, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16233602, state PropertyNewValue

UnmapNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x22003dd, from_configure NO

UnmapNotify event, serial 16, synthetic YES, window 0x132,
    event 0x132, window 0x22003dd, from_configure NO

DestroyNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x22003dd

ClientMessage event, serial 16, synthetic YES, window 0x1c00055,
    message_type 0x118 (_NET_ACTIVE_WINDOW), format 32

ConfigureNotify event, serial 16, synthetic NO, window 0x132,
    event 0x132, window 0x200005f, (14,56), width 674, height 448,
    border_width 0, above 0x2004a90, override NO

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x17c (_NET_CLIENT_LIST_STACKING), time 16238328, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16238333, state PropertyNewValue

PropertyNotify event, serial 16, synthetic NO, window 0x132,
    atom 0x118 (_NET_ACTIVE_WINDOW), time 16238333, state PropertyNewValue
Comment 9 Thomas Lübking 2012-09-18 17:40:41 UTC
- "kcmshell4 kwinoptions", "Window Actions" tab - what are the wheel settings (also for the "titlebar actions" tab)

- Did the _NET_CLIENT_LIST_STACKING and _NET_ACTIVE_WINDOW correspond to using the wheel?

- Do you use the oxygen style and does it happen when switching to eg. plastique for KDE applications?
Comment 10 Philip 2012-09-21 20:12:02 UTC
Window Behavior - Window Actions:
Inactive Inner Window - Wheel: Scroll
Inner Window, Titlebar & Frame - Mouse Wheel: Nothing

Window Behavior - Titlebar Actions:
Titlebar wheel event: Switch to Window Tab to the Left/Right

Correction:
I've just realized that xev doesn't seem to record mouse wheel events at all for some reason (at least in command line mode). So my log file should be pretty much useless - sorry about that.

However, xev (without -root option, in a window) will record wheel events (while the mouse is above the xev window) until the error occurs and the background window starts scrolling (no more xev output).
Every time I scoll the wheel, a ButtonPress and a ButtonRelease event is triggered:

ButtonPress event, serial 32, synthetic NO, window 0x5000001,
    root 0x132, subw 0x0, time 133638892, (85,177), root:(827,327),
    state 0x10, button 5, same_screen YES

ButtonRelease event, serial 32, synthetic NO, window 0x5000001,
    root 0x132, subw 0x0, time 133638892, (85,177), root:(827,327),
    state 0x1010, button 5, same_screen YES

Then I keep scrolling until the background window starts scrolling.
xev doesn't receive/log any button events anymore, instead there is only one last event:

LeaveNotify event, serial 32, synthetic NO, window 0x5000001,
    root 0x132, subw 0x0, time 133638962, (86,178), root:(828,328),
    mode NotifyNormal, detail NotifyNonlinear, same_screen YES,
    focus YES, state 16

Like I said, it happens on all Fedora/KDE systems and they all use different widget styles (plastique too), none of them uses the oxygen style though.
Comment 11 Thomas Lübking 2012-09-21 20:22:44 UTC
(In reply to comment #10)
> Window Behavior - Window Actions:
> Inactive Inner Window - Wheel: Scroll
> Inner Window, Titlebar & Frame - Mouse Wheel: Nothing
> 
> Window Behavior - Titlebar Actions:
> Titlebar wheel event: Switch to Window Tab to the Left/Right
Meeh - had hoped for "lower" window or such :-(

> I've just realized that xev doesn't seem to record mouse wheel events at all
> for some reason (at least in command line mode). So my log file should be
> pretty much useless - sorry about that.
No, i wasn't interested in the wheel event at that time at all.
The event is monitored with the window that receives in, the root window practically never receives input event but is used by the clients (and the WM) to communicate.

> LeaveNotify event, serial 32, synthetic NO, window 0x5000001,
>     root 0x132, subw 0x0, time 133638962, (86,178), root:(828,328),
>     mode NotifyNormal, detail NotifyNonlinear, same_screen YES,
>     focus YES, state 16
yes, the window is left (covered by sth. else that now receives the wheel input)
Comment 12 Philip 2012-10-13 20:25:45 UTC
I didn't mention what could be the most important piece of information:
All of this is happening within virtual machines. However, only virtual machines running Fedora are affected. VMs running other systems (like Ubuntu - same host, same virtualization environment) do not have this issue. Then again, I wasn't able to reproduce the error on a physical machine running Fedora.

Also, I've just noticed that the same error occurs in Gnome (again, only on a virtualized Fedora Linux).
So I don't think this has anything to do with KDE.
I should probably file a bug to Fedora.
Comment 13 Thomas Lübking 2012-10-13 21:31:17 UTC
Yes, "could" be important =)

Does the vmware host process use the oxygen gtk+ theme? (Does it use gtk+ at all?)
In case, you might want to check another theme (there's another bug reported about some virtual machine and mouse input related to the oxygen gtk+ theme)

For the time being, not our bug. Waiting on whether it's an oxygen gtk+ one.
Comment 14 Philip 2012-10-13 22:44:36 UTC
No, the VM host process does not use the oxygen theme, it's not even running in KDE (Fluxbox), but it's using GTK+.
When running Linux Mint (Mate desktop) in a virtual machine, the error occurs too.

Although I'm now confused where I'm supposed to file the bug, it doesn't seem to be a KDE bug.
Comment 15 Thomas Lübking 2012-10-13 22:57:33 UTC
Since it's not distro specific, it will be between the virtual machine input forwarding and the used client Xorg resp. xf86-input-* (evedev?)

If you can, try another VM (other version, competitor) and you should also check the xorg versions of the host and match them to the failing and working clients.

But ultimately it will likely be in the VM (since it does not happen on HW at all)