Open Bug 1899299 Opened 4 months ago Updated 3 days ago

[Thunderbird] With Linux, Dropdowns in Message Filter Rules don't close when clicking outside

Categories

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

x86_64
Linux
defect

Tracking

()

REOPENED
Tracking Status
thunderbird_esr115 --- unaffected
thunderbird_esr128 + affected
firefox-esr115 --- unaffected
firefox-esr128 --- affected
firefox128 --- wontfix
firefox129 --- wontfix
firefox130 --- wontfix
firefox131 --- affected

People

(Reporter: afranchuk, Assigned: stransky)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: leave-open, regression, triaged)

Attachments

(8 files, 4 obsolete files)

115.03 KB, video/webm
Details
186.22 KB, text/plain
Details
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
2.32 MB, video/mp4
Details
1.63 MB, video/mp4
Details
113.66 KB, image/png
Details
48 bytes, text/x-phabricator-request
Details | Review

This is likely a GUI implementation issue, maybe something to do with a window click event handler being overriden. The select box dropdowns in other windows close when clicking elsewhere in the window, however in the Filter Rules window all select box dropdowns (whether the "Getting New Mail: [select box]" or those in the filter rules/actions) never close. They only close when I move the mouse out of the window entirely.

I'm using X11 with XFCE4.

I see this too on Ubuntu with Gnome, on daily.
STR:
Tools | Filters
New...
In the rules, click open the rule to choose Subject or something else
Try to click outside.

Actual result: popup doesn't close. (It does close when clicking the popup itself.)
Expected: should close the popup when clicking elsewhere in the dialog.

This wasn't an issue in 115.

Alice, can we get a regression window?

Flags: needinfo?(alice0775)
Summary: Dropdowns in Message Filter Rules don't close → Dropdowns in Message Filter Rules don't close when clicking outside

Thanks Alice!

Martin, Emilio, any ideas?

Flags: needinfo?(stransky)
Flags: needinfo?(emilio)
Flags: needinfo?(stransky) → needinfo?(afranchuk)

Kind of, since it's really about nothing happening on clicks outside the dropdown, the video doesn't show the issue too much.

Pretend that after opening the dropdown, I click around in the dialog (nothing happens: this is the bug).
Then i click inside the dropdown and it closes (like it should).

Yeah, mkmelin's screencast represents the issue as best as possible.

Flags: needinfo?(afranchuk)

Yeah, so... We somehow don't seem to get those button presses at all from GTK. Same for other pointer events. You can see this with the cursor not changing when hovering over stuff.

If I make the code listen to mShell rather than mContainer, then it works:

diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index 297149796986c..b007959812381 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6332,23 +6332,23 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
   // and propagate up to the first widget that handles the events, so we
   // need only connect on mShell, if it exists, to catch events on its
   // window and windows of mContainer.
-  g_signal_connect(mContainer, "enter-notify-event",
+  g_signal_connect(mShell, "enter-notify-event",
                    G_CALLBACK(enter_notify_event_cb), nullptr);
-  g_signal_connect(mContainer, "leave-notify-event",
+  g_signal_connect(mShell, "leave-notify-event",
                    G_CALLBACK(leave_notify_event_cb), nullptr);
-  g_signal_connect(mContainer, "motion-notify-event",
+  g_signal_connect(mShell, "motion-notify-event",
                    G_CALLBACK(motion_notify_event_cb), nullptr);
-  g_signal_connect(mContainer, "button-press-event",
+  g_signal_connect(mShell, "button-press-event",
                    G_CALLBACK(button_press_event_cb), nullptr);
-  g_signal_connect(mContainer, "button-release-event",
+  g_signal_connect(mShell, "button-release-event",
                    G_CALLBACK(button_release_event_cb), nullptr);
-  g_signal_connect(mContainer, "scroll-event", G_CALLBACK(scroll_event_cb),
+  g_signal_connect(mShell, "scroll-event", G_CALLBACK(scroll_event_cb),
                    nullptr);
   if (gtk_check_version(3, 18, 0) == nullptr) {
-    g_signal_connect(mContainer, "event", G_CALLBACK(generic_event_cb),
+    g_signal_connect(mShell, "event", G_CALLBACK(generic_event_cb),
                      nullptr);
   }
-  g_signal_connect(mContainer, "touch-event", G_CALLBACK(touch_event_cb),
+  g_signal_connect(mShell, "touch-event", G_CALLBACK(touch_event_cb),
                    nullptr);

   LOG("  nsWindow type %d %s\n", int(mWindowType),

Martin, do you know what might be going on / why gtk isn't sending us those events? Alternatively do you know of any issue if we just listen to events on mShell consistently?

Flags: needinfo?(emilio) → needinfo?(stransky)

An apparently related issue has been reported in bug 1902013. For that I came up with the same regression window as in comment 2 (second one) with Debian/XFCE, even though the reporter there uses 115.11.0.

See Also: → 1902013
Severity: -- → S3
Component: OS Integration → Filters
Keywords: triaged
Summary: Dropdowns in Message Filter Rules don't close when clicking outside → With Linux, Dropdowns in Message Filter Rules don't close when clicking outside
Version: Thunderbird 126 → Thunderbird 122

(In reply to Emilio Cobos Álvarez (:emilio) from comment #8)

Martin, do you know what might be going on / why gtk isn't sending us those events? Alternatively do you know of any issue if we just listen to events on mShell consistently?

I'd say there's some event routing involved, perhaps the widget is created as input transparent or so? Is that reproducible with Thunderbird only? Do we see that in Firefox anywhere? I wonder how the popup is created and configured.

Can you please run TB with MOZ_LOG="Widget:5 WidgetPopup:5" env variable on terminal, reproduce it and attach the log here?
Thanks.

Flags: needinfo?(afranchuk)
Flags: needinfo?(mkmelin+mozilla)
Attached file 1899299-widgets.log

Here's the log. For your convenience, I interjected "STARTING" and "ENDED" lines around my interaction with the filter dialog dropdowns (though I include the entire log in case there's something else pertinent there). This captures the log of me opening the filters dialog, clicking "new", opening a single dropdown and then clicking around in the window (with the dropdown not closing and clicks doing nothing) until I move the mouse out of the window (at which point the dropdown closes).

Flags: needinfo?(afranchuk)

Thanks. The whole sequence of menu creation look weird, I see there are many hidden menu popups opened/closed with the same parent window. I'd expect there's only two windows used - main dialog and the dropdown menu.

[Parent 24458: Main Thread]: D/Widget [7fe0b0b28c00]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b28c00]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b28c00]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b28c00]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b28c00]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29100]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29100]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29100]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b392c600]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b392c600]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b392c600]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b392c600]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b3a3d200]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a3d200]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a3d200]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a3d200]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a3d200]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b0b29600]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29600]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29600]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29600]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b0b29600]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b3a83e00]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83e00]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83e00]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83e00]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83e00]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b3a83400]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83400]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83400]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83400]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83400]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b3a83900]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83900]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83900]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83900]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3a83900]:     set parent window [7fe0ac469600] filtereditor

[Parent 24458: Main Thread]: D/Widget [7fe0b3fc1b00]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1b00]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1b00]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1b00]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1b00]:     set parent window [7fe0ac469600] filtereditor

arent 24458: Main Thread]: D/Widget [7fe0b3fc1100]: nsWindow::Create
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1100]:   mBounds: x:0 y:0 w:0 h:0
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1100]: nsWindow::Create() Popup
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1100]: nsWindow::Create() popup type Menu
[Parent 24458: Main Thread]: D/WidgetPopup [7fe0b3fc1100]:     set parent window [7fe0ac469600] filtereditor

Magnus, can you point me where the filter dialog is located? Looks like TB is creating bogus popups which confuses the widget code.
Thanks.

Flags: needinfo?(stransky)

FilterEditorDialog is opened by code from another dialog, https://searchfox.org/comm-central/source/mail/base/content/FilterListDialog.xhtml

Flags: needinfo?(stransky)
Flags: needinfo?(stransky)
Summary: With Linux, Dropdowns in Message Filter Rules don't close when clicking outside → [Wayland] With Linux, Dropdowns in Message Filter Rules don't close when clicking outside
Blocks: wayland
Flags: needinfo?(stransky)
Summary: [Wayland] With Linux, Dropdowns in Message Filter Rules don't close when clicking outside → [Wayland / Thunderbird] With Linux, Dropdowns in Message Filter Rules don't close when clicking outside

Does "Wayland" in the bug title imply that this is a wayland-only issue? I'm not running wayland.

(In reply to Alex Franchuk [:afranchuk] from comment #16)

Does "Wayland" in the bug title imply that this is a wayland-only issue? I'm not running wayland.

Yes, I removed it.

Summary: [Wayland / Thunderbird] With Linux, Dropdowns in Message Filter Rules don't close when clicking outside → [Thunderbird] With Linux, Dropdowns in Message Filter Rules don't close when clicking outside
Duplicate of this bug: 1906637

Fixed when reverted https://phabricator.services.mozilla.com/D193401 (but still broken on Wayland anyway).
We created popups without CSD and always painted to mShell before D193401 so the patch from comment 8 was active for popups.

Duplicate of this bug: 1906224

We're hitting more bugs together here:

  • We create the popup as modal, it means underlying dialog (also modal) doesn't get mouse button events so we don't rollup the popup. We did that due to missing mouse grab (or its different architecture at Wayland so we can't use it).

  • If we get modal popup click outside, we receive such event on mShell and not on mContainer (why? Perhaps due to the modal state?)

  • If we connect event handlers to popup mShell (as we had before), due to bug (or feature) at GetFirstNSWindowForGDKWindow() we wrongly re-direct events from popup's mShell to parent dialog nsWindow so the popup is closed.

As due to missing pointer grab we need to emulate it with modal popup. I guess our only way is to detect outside click as mouse button event between leave - enter events, i.e. mouse button click when cursor is outside the popup.

Component: Filters → Widget: Gtk
Flags: needinfo?(stransky)
Product: Thunderbird → Core
Version: Thunderbird 122 → unspecified

Note that the bug was here before and changes at Bug 1864382 only reveals it.

Flags: needinfo?(stransky)
Assignee: nobody → stransky
Status: NEW → ASSIGNED
  • Move more widget events from mContainer to mShell. We generally want to listen on mShell and use mContainer
    for GtkContainer related events only.
  • Set correct event masks for mShell/mContainer

Depends on D216912

Depends on D216913

Flags: needinfo?(stransky)

Here's a screen recording of the developer toolbox with the changes. The inspector view should have a hover effect as the mouse rolls over it, but it doesn't. Clicking on things doesn't work either.

(In reply to Geoff Lankow (:darktrojan) from comment #27)

Created attachment 9413460 [details]
simplescreenrecorder-2024-07-18_20.53.40.mp4

Here's a screen recording of the developer toolbox with the changes. The inspector view should have a hover effect as the mouse rolls over it, but it doesn't. Clicking on things doesn't work either.

As per discussion it's MINT/X11. Will try that, I don't see it on Gnome.
There's also a regression that system window titlebar doesn't receive mouse clicks on Wayland.

Geoff, please try with D216914.
Thanks.

Flags: needinfo?(geoff)

I can see what the problem might be, and it might something for a different bug. When the toolbox window is docked to the right hand side of the screen, the mouse events are happening as though the window was still in its previous position. In this recording you can see the mouse moving on the left side of the window, but things are happening on the right side of the window.

This doesn't seem to happen every time the window is docked, so I'm not sure what the trigger is. I was able to reproduce it fairly consistently in Firefox:

  • Run ./mach run --jsdebugger.
  • Dock the devtools window with Super + Right Arrow.
  • Close Firefox.
  • Repeat the same steps. (The first time is just to set the initial size of the window for the second time.)

(This was recorded before I updated my copy of the patches, but it still happens with the latest version.)

Flags: needinfo?(geoff)

(In reply to Geoff Lankow (:darktrojan) from comment #31)

(This was recorded before I updated my copy of the patches, but it still happens with the latest version.)

Do I understand correctly that it doesn't depends of the patches here?
Thanks.

It only happens with the patches here.

Does D216914 make any difference here? Is the mouse motion bug less visible with it?
Thanks.

Flags: needinfo?(geoff)

Geoff, please test with D217163 on top. It adds signal handlers to mContainer.

Yes, D217163 appears to have fixed it. Thanks!

Flags: needinfo?(geoff)

I've just noticed that pop-ups in the developer toolbox don't pop up in the right place. Same STR as before. Like before, they're where the window used to be.

Flags: needinfo?(stransky)

Lets' track possible regressions in another bugs.

Flags: needinfo?(stransky)
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/a0c9c1dcb19c
[Linux] Remove mRetryPointerGrab as it's unused r=emilio
https://hg.mozilla.org/integration/autoland/rev/d6e1dbfd1002
[Linux] Remove GetFirstNSWindowForGDKWindow() as we don't use widget plugins r=emilio
https://hg.mozilla.org/integration/autoland/rev/d300cc8b778e
[Linux] Move some widget events from mContainer to mShell r=emilio
https://hg.mozilla.org/integration/autoland/rev/e0e1f122e646
[Linux] Reformat widget event code r=emilio
https://hg.mozilla.org/integration/autoland/rev/25389422d457
[Linux] Keep propagating relocated mShell events to child widgets r=emilio
Regressions: 1912888
Regressions: 1912922
Regressions: 1912940

Backed out for causing multiple functional regressions on Linux.

Status: RESOLVED → REOPENED
Flags: needinfo?(stransky)
Resolution: FIXED → ---
Target Milestone: 131 Branch → ---
Regressions: 1912934
Flags: needinfo?(stransky)
Keywords: leave-open
Flags: needinfo?(stransky)
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/3c1b5657b7f1
[Linux] Remove mRetryPointerGrab as it's unused r=emilio
https://hg.mozilla.org/integration/autoland/rev/44257ccff494
[Linux] Remove GetFirstNSWindowForGDKWindow() as we don't use widget plugins r=emilio

Looks like the fix here is a part of the regression. When we register leave events to mShell we're getting leave events even for child popups which fixes the bug here but also brings new regression - but on X11 only.

A popup attached to a modal parent window doesn't get mouse events
from Gtk as they'are directed to the modal parent. This is usually solved
by pointer grab which that doesn't work on Wayland in our current
setup as it performs show and grab in one step.

We emulate it by setting popup as modal too but then patent
window doesn't get mouse events outside of popup (Bug 1899299).
we need to listen

Surprisingly attaching events handler to mShell fixes it
and we're getting events from both parent and popup windows.

Attachment #9413455 - Attachment is obsolete: true
Attachment #9413456 - Attachment is obsolete: true
Attachment #9413516 - Attachment is obsolete: true
Attachment #9413893 - Attachment is obsolete: true
Flags: needinfo?(stransky)
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/0727ff9372dc
[Linux] Listen mouse events on mShell for modal popups r=emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: