forked from AuroraMiddleware/gtk
surface: Be smarter about autohide
When we close grabbing popups due to an outside click, check at each level if the click is still outside. This makes closing the nested popover menu in the popover on page 3 of widget-factory work as expected, when you click the menubutton again.
This commit is contained in:
parent
75f96b83de
commit
dcfb6e5ef5
@ -2657,18 +2657,6 @@ gdk_synthesize_surface_state (GdkSurface *surface,
|
||||
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
|
||||
}
|
||||
|
||||
static void
|
||||
hide_popup_chain (GdkSurface *surface)
|
||||
{
|
||||
GdkSurface *parent;
|
||||
|
||||
gdk_surface_hide (surface);
|
||||
|
||||
parent = surface->parent;
|
||||
if (parent->autohide)
|
||||
hide_popup_chain (parent);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_autohide (GdkEvent *event)
|
||||
{
|
||||
@ -2695,13 +2683,23 @@ check_autohide (GdkEvent *event)
|
||||
device = gdk_event_get_device (event);
|
||||
if (gdk_device_grab_info (display, device, &grab_surface, NULL))
|
||||
{
|
||||
GdkSurface *event_surface = gdk_event_get_surface (event);
|
||||
GdkSurface *event_surface;
|
||||
|
||||
event_surface = gdk_event_get_surface (event);
|
||||
|
||||
if (grab_surface != event_surface &&
|
||||
grab_surface != event_surface->parent &&
|
||||
grab_surface->autohide)
|
||||
{
|
||||
hide_popup_chain (grab_surface);
|
||||
GdkSurface *surface = grab_surface;
|
||||
|
||||
do
|
||||
{
|
||||
gdk_surface_hide (surface);
|
||||
surface = surface->parent;
|
||||
}
|
||||
while (surface->autohide && surface != event_surface);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user