diff options
author | Shaun McCance <shaunm@gnome.org> | 2010-06-10 12:21:24 -0500 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2010-06-10 12:21:24 -0500 |
commit | c5a1261ee866ba5ac68e0c660557ae2134e30790 (patch) | |
tree | b196a8ace1aedd6308cadbb156c9ac3e98d1470e | |
parent | 1ab66ed67cd5fb26a765a7a725f1d96ff046a8d6 (diff) | |
download | yelp-c5a1261ee866ba5ac68e0c660557ae2134e30790.tar.gz |
[yelp-window] Skip initial and move-only configure-event signals
-rw-r--r-- | src/yelp-window.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/yelp-window.c b/src/yelp-window.c index 92b51b9d..2a167431 100644 --- a/src/yelp-window.c +++ b/src/yelp-window.c @@ -54,6 +54,9 @@ static void yelp_window_set_property (GObject *object, static void window_construct (YelpWindow *window); static void window_new (GtkAction *action, YelpWindow *window); +static gboolean window_map_event (YelpWindow *window, + GdkEvent *event, + gpointer user_data); static gboolean window_configure_event (YelpWindow *window, GdkEventConfigure *event, gpointer user_data); @@ -292,6 +295,8 @@ struct _YelpWindowPrivate { gint find_cur_height; gint find_entry_height; gint find_bar_height; + + gboolean configured; }; static const GtkActionEntry entries[] = { @@ -341,6 +346,7 @@ static void yelp_window_init (YelpWindow *window) { g_signal_connect (window, "configure-event", G_CALLBACK (window_configure_event), NULL); + g_signal_connect (window, "map-event", G_CALLBACK (window_map_event), NULL); } static void suppress_link_buttons (GtkLinkButton *button, const gchar *link, gpointer userdata) {} @@ -752,13 +758,37 @@ window_drag_received (YelpWindow *window, } static gboolean +window_map_event (YelpWindow *window, + GdkEvent *event, + gpointer user_data) +{ + YelpWindowPrivate *priv = GET_PRIV (window); + priv->configured = TRUE; + return FALSE; +} + +static gboolean window_configure_event (YelpWindow *window, GdkEventConfigure *event, gpointer user_data) { YelpWindowPrivate *priv = GET_PRIV (window); - priv->width = event->width; - priv->height = event->height; + gboolean skip = TRUE; + if (priv->width != event->width) { + skip = FALSE; + priv->width = event->width; + } + if (priv->height != event->height) { + skip = FALSE; + priv->height = event->height; + } + /* Skip the configure-event signals that GTK+ sends as it's mapping + * the window, and also skip if the event didn't change the size of + * the window (i.e. it was just a move). + */ + if (!priv->configured || skip) + return FALSE; + if (priv->resize_signal > 0) g_source_remove (priv->resize_signal); priv->resize_signal = g_timeout_add (200, |