Open Bug 350816 Opened 18 years ago Updated 10 months ago

Clicking anywhere in a window raises and focuses it, even with sloppy focus

Categories

(Core :: Widget: Gtk, defect, P5)

x86
Linux
defect

Tracking

()

People

(Reporter: ajschult784, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: access)

Attachments

(1 file)

With linux seamonkey build 2006-08-30-09-trunk, clicking anywhere in a window (content and chrome) raises and focuses the window, even though I have my WM configured to use sloppy focus (clicking should neither raise nor focus a window).
Blocks: focusnav
Keywords: access
Attached file stack to GetAttention
(gdb) frame 2
#2  0x019f8a52 in nsGlobalWindow::Focus (this=0xa36f6f0) at /build/andrew/moz-debug/mozilla/dom/src/base/nsGlobalWindow.cpp:3610
3610            result = widget->SetFocus(PR_TRUE);

Looking through the code, I discovered the mozilla.widget.raise-on-setfocus pref, which basically makes this bug go away (set to false).  And with it set to false, if I switch my WM to click-to-focus, a window still raises and focuses when I click on it.  But setting it to false also breaks window.focus().  I guess the code really needs to be able to distinguish between mouse clicks (don't raise/focus) and window.focus() calls (do raise/focus) instead of using the pref.  Is there some way to get at the cause of the focus call?
OK, after poking around with a gtk1 build (which doesn't have this problem), I discovered that the problem is that gtk2 code is requesting focus from the button press (nsWindow::OnButtonPressEvent)

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/widget/src/gtk2/nsWindow.cpp&rev=1.182&mark=1871-1874#1843

The original code to grab focus was added in bug 121615.  Removing that chunk makes everything work as I would expect.  Is that code still needed for something?
> Is that code still needed for something?

Yes, plugins.  :(  Somehow gtk1 does OK with focus and plugins without those bits.
Severity: normal → S3

Suddenly seeing behavior like this in a current Firefox. Has not done it before; just seems to have started, presumably from an update. Fedora with XFCE. Just vanilla Firefox with the distro, says 112.0 (64-bit). Window manager set to focus-follows-mouse and not to raise on click. Other apps behave correctly. (Interestingly enough the FireFox about window that I got the version from does not raise when clicked, just the main window that I've observed.)

Fedora release 36 (Thirty Six)
firefox-112.0-3.fc36.x86_64
xfwm4-4.16.1-5.fc36.x86_64

% xfconf-query -c xfwm4 -p /general/raise_on_click
false
% xfconf-query -c xfwm4 -p /general/click_to_focus
false

I'd really appreciate any help or advice. Very annoying.

I tried setting "mozilla.widget.raise-on-setfocus" to false, yet that does not have an effect on the behaviour.

Sloppy focus is very nice on single-display system. Dearly like it, Firefox should not override window-manager settings.

System Xubuntu with xfwm, firefox from distro package repository - behaviour changed with recent update, (now 113, but maybe was in 112 too, but not 111?)

For developer tools a workaround is to mark the console/debugger/whatever "always on top" from the window manager.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: