mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 06:10:15 +00:00
window: Keep track of popover children mapped status
In order to maintain visibility of the GdkWindow that's the parent window of the popover widget.
This commit is contained in:
parent
ace25368b1
commit
db9e1d36d0
@ -131,6 +131,7 @@ struct _GtkWindowPopover
|
||||
GdkWindow *window;
|
||||
GtkPositionType pos;
|
||||
cairo_rectangle_int_t rect;
|
||||
gulong unmap_id;
|
||||
};
|
||||
|
||||
struct _GtkWindowPrivate
|
||||
@ -1332,6 +1333,12 @@ gtk_window_close (GtkWindow *window)
|
||||
static void
|
||||
popover_destroy (GtkWindowPopover *popover)
|
||||
{
|
||||
if (popover->unmap_id)
|
||||
{
|
||||
g_signal_handler_disconnect (popover->widget, popover->unmap_id);
|
||||
popover->unmap_id = 0;
|
||||
}
|
||||
|
||||
if (popover->widget && gtk_widget_get_parent (popover->widget))
|
||||
gtk_widget_unparent (popover->widget);
|
||||
|
||||
@ -5425,6 +5432,24 @@ gtk_window_hide (GtkWidget *widget)
|
||||
gtk_grab_remove (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
popover_unmap (GtkWidget *widget,
|
||||
GtkWindowPopover *popover)
|
||||
{
|
||||
if (popover->window)
|
||||
{
|
||||
if (gtk_widget_is_visible (popover->widget))
|
||||
gtk_widget_unmap (popover->widget);
|
||||
gdk_window_hide (popover->window);
|
||||
}
|
||||
|
||||
if (popover->unmap_id)
|
||||
{
|
||||
g_signal_handler_disconnect (widget, popover->unmap_id);
|
||||
popover->unmap_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
popover_map (GtkWidget *widget,
|
||||
GtkWindowPopover *popover)
|
||||
@ -5434,7 +5459,11 @@ popover_map (GtkWidget *widget,
|
||||
gdk_window_show (popover->window);
|
||||
|
||||
if (gtk_widget_get_visible (popover->widget))
|
||||
{
|
||||
gtk_widget_map (popover->widget);
|
||||
popover->unmap_id = g_signal_connect (popover->widget, "unmap",
|
||||
G_CALLBACK (popover_unmap), popover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5573,18 +5602,6 @@ gtk_window_map_event (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
popover_unmap (GtkWidget *widget,
|
||||
GtkWindowPopover *popover)
|
||||
{
|
||||
if (popover->window)
|
||||
{
|
||||
if (gtk_widget_is_visible (popover->widget))
|
||||
gtk_widget_unmap (popover->widget);
|
||||
gdk_window_hide (popover->window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_unmap (GtkWidget *widget)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user