After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 607668 - Don't let offscreen widgets do grab adds
Don't let offscreen widgets do grab adds
Status: RESOLVED DUPLICATE of bug 658563
Product: gtk+
Classification: Platform
Component: Widget: Other
2.19.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
csw
Depends on: 771242
Blocks:
 
 
Reported: 2010-01-21 15:28 UTC by Cody Russell
Modified: 2017-12-13 11:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (589 bytes, patch)
2010-01-21 15:29 UTC, Cody Russell
none Details | Review

Description Cody Russell 2010-01-21 15:28:42 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.
Comment 1 Cody Russell 2010-01-21 15:29:44 UTC
Created attachment 151946 [details] [review]
Proposed patch
Comment 2 Martin Pitt 2011-11-22 08:57:24 UTC
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().
Comment 3 Pacho Ramos 2013-04-13 11:05:57 UTC
Any updates on this issue?
Comment 4 Daniel Boles 2016-09-29 07:15:10 UTC
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.
Comment 5 Daniel Boles 2016-09-29 13:24:10 UTC
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.
Comment 6 Emmanuele Bassi (:ebassi) 2016-09-29 14:23:57 UTC
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;
Comment 7 Emmanuele Bassi (:ebassi) 2016-09-29 14:26:45 UTC
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.
Comment 8 Daniel Boles 2016-09-29 14:28:12 UTC
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... :)
Comment 9 Emmanuele Bassi (:ebassi) 2016-09-29 14:39:45 UTC
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.
Comment 10 Daniel Boles 2016-09-29 15:41:29 UTC
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!
Comment 11 Daniel Boles 2016-09-29 17:30:13 UTC
I've posted the debug bt at the other thread:
https://bugzilla.gnome.org/show_bug.cgi?id=771242#c31
Comment 12 Daniel Boles 2016-10-22 01:49:24 UTC
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. :)
Comment 13 Daniel Boles 2016-10-25 10:39:03 UTC
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.
Comment 14 Daniel Boles 2016-10-25 10:42:49 UTC
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 ***
Comment 15 Vlad Orlov 2017-12-13 10:20:33 UTC
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
Comment 16 Daniel Boles 2017-12-13 10:27:34 UTC
(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.
Comment 17 Vlad Orlov 2017-12-13 11:51:19 UTC
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/
Comment 18 Daniel Boles 2017-12-13 11:54:11 UTC
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.