[gtk+/popovers: 23/42] window: Keep track of popover children mapped status
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/popovers: 23/42] window: Keep track of popover children mapped status
- Date: Wed, 15 Jan 2014 12:43:16 +0000 (UTC)
commit 5371c903fff16ebeaff3a4aee0335fc74e126f8c
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Dec 23 19:05:33 2013 +0100
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.
gtk/gtkwindow.c | 43 ++++++++++++++++++++++++++++++-------------
1 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f048820..6c0b919 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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);
@@ -5419,6 +5426,24 @@ gtk_window_hide (GtkWidget *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)
{
@@ -5427,7 +5452,11 @@ popover_map (GtkWidget *widget,
gdk_window_show (popover->window);
if (gtk_widget_get_visible (popover->widget))
- gtk_widget_map (popover->widget);
+ {
+ gtk_widget_map (popover->widget);
+ popover->unmap_id = g_signal_connect (popover->widget, "unmap",
+ G_CALLBACK (popover_unmap), popover);
+ }
}
}
@@ -5567,18 +5596,6 @@ gtk_window_map_event (GtkWidget *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);
- }
-}
-
-static void
gtk_window_unmap (GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]