Pointer focus switches away from popover during intense scrolls
I've noticed a rather strange issue that I've at least noticed so far occurs with GtkPopovers. First some context: in nvim-gtk we have an option to represent completion popups using native GTK popovers like this:
Nvim itself is able to control the current selection. Since users are going to generally expect to be able to configure these popovers the same way they would with nvim's own completion popups - we disallow the popover and any of it's children from being able to get input focus when we create it so that all input events go to the main NvimViewport
widget (tl;dr, the main custom widget we use for rendering nvim content using GTK snapshots):
let content = gtk::Box::new(gtk::Orientation::Vertical, 0);
let popover = PopupMenuPopover::new();
popover.set_autohide(false);
popover.set_can_focus(false);
popover.set_child(Some(&content));
popover.add_css_class("background");
popover.add_css_class("nvim-popover");
popover.set_position(gtk::PositionType::Top);
(Please note, PopupMenuPopover
is simply our own customized GtkPopover type, which we use to implement events for when the popover's bounds change. You can find the source here
From there, NvimViewport
forwards the info on the input events to nvim, which then handles updating the current state of the popover. However, pretty much nothing is changed in regards to pointer events, including scroll events. Those are simply handled by nvim-gtk. In previous GTK4 versions this worked fine, but since updating to 4.10.4 I've noticed a rather strange issue regarding pointer scroll events and the GtkListView that we use. It seems that if I scroll gently, everything works normally. But if I do a larger more intense scroll, the popover immediately closes and the scroll event is sent to the NvimViewport
instead of the PopupMenuPopover
.
You can sort of see what I mean here
Note that I've been able to reproduce this both using my touchpad and the trackpoint on my laptop. I think this is a regression as this previously worked before, but please feel free to point out if there's something I'm missing in my code to make this work correctly. As well, my system info is:
GTK 4.10.4
GNOME 44.1 on Wayland
Fedora 38
X1 Carbon 7th Generation
And of course, the program in question here is neovim-gtk. If there's any other information you need from me feel free to let me know.
(also, thank you so much for your hard work on fixing the previous issues with scrolling in GtkListView! Seriously tremendously appreciated