GNOME Bugzilla – Bug 607668
Don't let offscreen widgets do grab adds
Last modified: 2017-12-13 11:54:11 UTC
Widgets inside GtkOffscreenWindow seem like they should not be allowed to do grab the mouse or whatever, as this can deactivate open menus and stuff.
Created attachment 151946 [details] [review] Proposed patch
If someone wants to ack this patch, please also have a look at bug 658563, which fixes the corresponding problem in gtk_device_grab_add().
Any updates on this issue?
Yes, the update is that its patching in Ubuntu/Debian breaks ComboBoxes: https://bugzilla.gnome.org/show_bug.cgi?id=771242 > seem like they should not be allowed to do grab the mouse or whatever does not seem like a rationale to me. Don't apply this.
Sorry, my previous comment was unnecessarily negative. Given that ebassi said on the related ticket - https://bugzilla.gnome.org/show_bug.cgi?id=658563 - that it seems like an OK idea, I guess the problem is more in ComboBox rather than the concept of preventing grabs on offscreen widgets. Perhaps the solution is for CB to map its window in time for this.
The GtkComboBox widget and the GtkCellRendererCombo renderer do not use offscreen windows, so the patch is clearly tripping on a missing association between the combo popup and the top level widget, not on whether the window is offscreen or not. The backward compatible solution would be to change the condition to: toplevel = gtk_widget_get_toplevel (widget); if (toplevel != NULL && gdk_window_get_window_type (gtk_widget_get_window (toplevel)) == GDK_WINDOW_OFFSCREEN) return;
Mmh, actually, no: that's what the patch does, so I have no idea why it's tripping up the check, since GTK+ does not use offscreen windows anywhere.
Indeed, that difference is incorporated in Debian's version of the patch, but the problem persists: https://sources.debian.net/src/gtk%2B3.0/3.22.0-1/debian/patches/016_no_offscreen_widgets_grabbing.patch/ My guess was it's because the toplevel at that point does not have a GdkWindow yet. But I don't know enough to say what the toplevel is in this case... :)
If the top-level does not have a GdkWindow at the time of the check then it means it's not realized, which would make any subsequent grab call fail anyway, because the widget has not windowing system resources associated to it. I'm afraid this will require some more debugging, to understand where the grab is coming from, and what kind of requirements are not being satisfied.
Yeah, my previous backtrace - https://bug771242.bugzilla-attachments.gnome.org/attachment.cgi?id=335315 - is not much use because many of the functions' names are lost. Now I have a fresh build of master, so I'll get us a proper debug bt later, and hopefully that'll point us in the right direction. Thanks for taking a look!
I've posted the debug bt at the other thread: https://bugzilla.gnome.org/show_bug.cgi?id=771242#c31
I've posted a patch here that seems to fix this: https://bugzilla.gnome.org/show_bug.cgi?id=771242 Review would be welcome, if only to get that thread closed and stop me spamming in it so much... sorry. :)
AFAICT these patches (and their counterparts applied in Debian) will become redundant in GTK+ 4 with this commit: https://git.gnome.org/browse/gtk+/commit/?id=70935f09526ba9f1d0b2f6af10e18712df73eda9 The ComboBox menu popup/selection ordering issue that this patch revealed should probably still be fixed, though.
Even so, I think this should be closed in favour of Bug 658563, which seems to be a duplicate but with more detail and reviews on the patches. *** This bug has been marked as a duplicate of bug 658563 ***
Hi, Had the patch from this report ever been accepted? A little research in a downstream Ubuntu report showed that the patch makes gnome-terminal-server and mate-terminal crash when editing keyboard shortcuts: https://bugs.launchpad.net/bugs/1667227 So I wonder if the problem should be handled upstream or downstream. For the record, the original report is at: https://bugs.launchpad.net/bugs/1438014
(In reply to Vlad Orlov from comment #15) > Had the patch from this report ever been accepted? As the duplicate shows, no; it was reviewed but not given conclusive acceptance.
Ok, so it's a downstream issue. Weird situation... there are actually two patches, one is from here, another is a half of a patch from bug 658563. https://sources.debian.org/src/gtk+3.0/3.22.11-1/debian/patches/016_no_offscreen_widgets_grabbing.patch/ https://sources.debian.org/src/gtk+3.0/3.22.11-1/debian/patches/017_no_offscreen_device_grabbing.patch/
The latest patch in that other bug covers both. I don't know whether anyone will accept it. Until then, yes, I guess it is an issue for your downstream.