[gtk+/popovers: 23/33] 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/33] window: Keep track of popover children mapped status
- Date: Fri, 10 Jan 2014 15:16:54 +0000 (UTC)
commit c8ffa990571fba05be7b8efc5445c4939a79f13b
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 b5e9d07..db67c84 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
@@ -1295,6 +1296,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);
@@ -5379,6 +5386,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)
{
@@ -5387,7 +5412,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);
+ }
}
}
@@ -5527,18 +5556,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]