This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Keystrokes sent to window without focus in Firefox

Tags: None
(comma "," separated)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I've recently noticed a bug in KDE and/or Firefox, in the last few weeks. I have three windows in Firefox open that I can alt-tab between. However, sometimes when I type, keystrokes are sent to a background window. For example, if I press `ctrl+w` to close a tab, a tab in one of the background window closes. Even if I click (again) on the foreground window, keystrokes are sent to a background window.

At least on one occasion I can somewhat fix it. Let's call the windows [a], [b] and [c]. [a] is foreground and keystrokes are sent to [b]. Alt-tabbing between [a] and [b] does nothing. However, if I switch to [c], then back to [a], keystrokes are sent correctly. What's odd is that if I move to another program and then back, this problem will occur again (sometimes).

This might also be relevent… I've also noticed Firefox is not focusing as it used to. In the past, If I open a link from RSSOwl, Firefox would be brought to the foreground. This no longer happens. Firefox remains in the background, and the window doesn't call for attention. I have focus-stealing prevention set to "low", but this also occurs if it's turned off. (And this setting has not changed recently anyway.)

I guess I should file a bug, but I wanted to get an idea of any fix in the meantime, and also what to file the bug against.

Last edited by sparhawk on Wed Nov 06, 2013 11:15 am, edited 3 times in total.
mgraesslin
KDE Developer
Posts
572
Karma
7
OS
Sounds like a Firefox issue to me. Firefox has quite a lot issues with X as they more or less have their own toolkit instead of going with default ones.
luebking
Karma
0
Notice that the stacking ("foreground") is not related to activation state or input focus.
Esp. clients are permitted to juggle around the stacking between their own windows as much as they want.

Alt+Tab should however pass the input focus to the window as long as it accepts it ("xwininfo -wm | grep -i focus")

Next thing is that the client process can perform the input event handling "as it wants", so if all three windows (or esp. "a" and "b") run in the same process, FF could easily receive input on window "a" but process it as if it had occured on window "b".

To figure this:
1. obtain the WId of the window that should receive the keystrokes. (run "xwininfo | grep -i 'window id'" and look for the hex number like 0x123456)
2. run "xev -event keyboard -id 0x123456" where "0x123456" should be the actual WId from (1)
3. ensure you get ouput from this while the window works as expected.
4. watch for the output when the window starts to misbehave.

If there's still output, the bug is at FF. If not, check whether that window actually still accepts the input focus.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Thanks luebking, great instructions.

luebking wrote:2. run "xev -event keyboard -id 0x123456" where "0x123456" should be the actual WId from (1)


However, this didn't work, giving me a usage error. I can't find any reference to -event in the man page.
luebking
Karma
0
No idea when that key was introduced.
Just do

Code: Select all
xev -id 0x123456 | grep Key


instead
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Ok, so keystrokes *are* passed to the "broken" window from running
Code: Select all
xwininfo -wm | grep -i focus

Then, when the bug occurred, I tried
Code: Select all
xev -id 0x123456 | grep Key

When the non-responsive window was in the front, xev showed it still registering keystrokes. I also tried xev for the background window that was acting on the keystrokes. No keystrokes were registering from xev.

I presume this means that the bug is in Firefox? Where do you think it's best to file this bug? I'm using Kubuntu, so I guess either Ubuntu or Mozilla directly?

Thanks for you help.
luebking
Karma
0
Yes, is Firefox issue then.

Unless you obtained the version directly from Mozialla, you should ask on your distro first (in case they've patched FF or use a for like iceweasel) and have them (ask you to) escalate the issue to Mozilla.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Hmm, it looks like a recent upgrade fixed it for me.

Code: Select all
$ less /var/log/apt/history.log
<snip>
Start-Date: 2013-03-02  10:10:21
<snip>
Upgrade: firefox-globalmenu:amd64 (19.0+build1-0ubuntu0.12.10.1, 19.0+build1-0ubuntu0.12.10.2), firefox:amd64 (19.0+build1-0ubuntu0.12.10.1, 19.0+build1-0ubuntu0.12.10.2), firefox-locale-en:amd64 (19.0+build1-0ubuntu0.12.10.1, 19.0+build1-0ubuntu0.12.10.2)


I guess it was firefox:amd64 19.0+build1-0ubuntu0.12.10.2, although the changelog doesn't mention anything about my bug. I wonder if it's possible that my installation was corrupt, and the upgrade fixed it by reinstalling Firefox? Thanks again for your help.

EDIT: I should be more specific. I mean that I haven't noticed keystrokes being sent to background windows. This was previously an intermittent problem, but RSSOwl is now pushing Firefox to the foreground all the time now, so I assume that both parts of this single bug have been solved.
luebking
Karma
0
No idea but this sounds as if FF manages the active window internally (ie. attempted to activate one the other window, failed, didn't notice and thus acted "as if" it had been successfully activated)

Activation could have failed because
- it wasn't actually performed
- KWin believed the window could not accept focus (either by client hint or rule, though you ruled out the client hint)
- FF didn't sufficiently (for KWin's opinion) hint that both FF windows are siblings.

Either way it would have been a FF bug - there's no guarantee the activation request is granted by the WM, so requesting to be active and assuming to be afterwards is simply wrong (the window gets an event when it's actually activated - for whatever reason)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Just to update this thread, I've been noticing these focusing bugs intermittently since my previous post. I also see an additional bug that occurs quite frequently. I often have three windows open. When I open a new tab in two of them, typing immediately puts text into the address bar. However, the address bar is not highlighted, and there is no text cursor. Furthermore, when I press enter, nothing happens.

I tried to lodge a bug through `ubuntu-bug`, and realised that I was running the blue-shell patched version of Firefox. This version supposedly patches Firefox for KDE (filedialog + mimetypes), although I can't really tell the difference between this and the official Ubuntu Firefox. Anyway, since reverting to the official Ubuntu release, I haven't noticed any problems (yet).

In addition, apparently the blue-shell patch lags somewhat behind official releases, and hence the latest-update cycle alternates between repositories. This might explain why I thought the bug had been fixed at points.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I'm still getting this bug, and more frequently in Thunderbird. I've filed a bug report for Firefox.

=EDIT=
See Thunderbird link for fix.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar