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 620832 - make _gtk_window_group_get_current_grab() public
make _gtk_window_group_get_current_grab() public
Product: gtk+
Classification: Platform
Component: Widget: Other
Other All
: Normal major
: ---
Assigned To: gtk-bugs
Depends on:
Blocks: 597610 615407
Reported: 2010-06-07 13:10 UTC by Jonh Wendell
Modified: 2011-02-04 16:12 UTC
See Also:
GNOME target: 3.0
GNOME version: ---

Description Jonh Wendell 2010-06-07 13:10:59 UTC
I'm porting libview[1] to gtk+ 3, and it needs access to that function, which is currently an internal gtk+ symbol.

Comment 1 Owen Taylor 2010-06-07 20:21:25 UTC
Neither in the mail or here have you described what libview is doing - *why* it needs this. (The code snippet in the mail doesn't have any context.) This is vital information to evaluate the request and to document any function that is added.
Comment 2 Christian Hammond 2010-06-08 08:21:13 UTC
Hi Owen,

This is for a widget we have called AutoDrawer, which is for dropping down a toolbar (or whatever) when the mouse cursor is at the top of the screen (well, maximized/fullscreen window).

I'm not an expert on this widget, but the idea is that we're trying to get the widget that currently has the grab in the window. Based on this, we decide whether to immediately drop down the AutoDrawer and keep it open. We key off this logic based on the type of widget owning the grab, and whether or not it's an ancestor of an EventBox that AutoDrawer connects to.

I'm CC'ing the original developer of this widget (I think he wrote this anyway).

For what it's worth, this is functionality we need to keep working in VMware Workstation and Player, so it's pretty important for us to have access to this functionality.
Comment 3 Régis Duchesne 2010-06-08 17:55:47 UTC
Owen, you can look at the AutoDrawer code at
(search for "grab" in that page)

Essentially, the drawer is a container which can contain an arbitrary widget hierarchy. The purpose of the drawer is to well, open like a drawer. In one mode, the drawer can show/hide automatically. In that mode, we open the drawer as soon as (and keep the drawer opened as long as):
1) The mouse cursor is over the drawer (indicating the user is showing interest to see what is inside the drawer, and is about to interact with the drawer)
2) There is a focused widget inside the drawer (indicating the user is interacting with a widget in the drawer, such as a text box)
3) There is grabbed by a widget inside the drawer (indicating the user is interacting with a widget in the drawer, such as a pop-up menu attached to a drop-box for example)

To do #3 above, we evaluate group->grabs at line 249. As Jonh Wendell noticed, in GTK+ 3, this requires _gtk_window_group_get_current_grab(). Currently that function is private, we would like it to be public as libview's use of it seems legitimate.

Comment 4 Jonh Wendell 2010-06-22 16:57:23 UTC
It would be nice if it would added in gtk+ 2.x as well.
Comment 5 Matthias Clasen 2010-06-24 05:19:02 UTC
I cannot say that the code in libview looks very 'legitimate' to me. Special-casing menus, and navigating up the menu hierarchy, etc... 

I think what you rather want to do is listen for grab-notify on your event-box and keep track of it being grab-shadowed.

But I guess making this function public does not cost us much, so we should just do it.
Comment 6 Alejandro Piñeiro Iglesias (IRC: infapi00) 2010-06-24 16:00:39 UTC
Just to comment that it seems that a error was included with this patch.

I get this error compiling gtk:

./.libs/ undefined reference to `_gtk_window_group_get_current_grab'

You can also see this error on
Comment 7 Javier Jardón (IRC: jjardon) 2010-06-24 17:13:00 UTC
Alejandro: fixed in gtk-2-22 in commit fa7ace866cf794e3f320fe736eede93876e3b074