diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-11-20 12:49:48 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-11-20 12:49:48 +0800 |
commit | a085eae9954d2621215b8a78367d29af941bdca7 (patch) | |
tree | 222a57c8419fa848783e31e89f22deb2d13d62ff | |
parent | da2ca5896d9a0ce1ead4af6dde295c5cfa2892df (diff) | |
download | gsoc2013-evolution-a085eae9954d2621215b8a78367d29af941bdca7.tar.gz gsoc2013-evolution-a085eae9954d2621215b8a78367d29af941bdca7.tar.zst gsoc2013-evolution-a085eae9954d2621215b8a78367d29af941bdca7.zip |
Still tweaking pane position restoration.
My window maximization hack in EPaned works great if the top-level
window has not been shown yet. But if it has, we've already missed
the window state event we're listening for and so the pane position
will not be restored properly.
This commit fixes that.
-rw-r--r-- | widgets/misc/e-paned.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/widgets/misc/e-paned.c b/widgets/misc/e-paned.c index 08eef6f076..b363d0aa0e 100644 --- a/widgets/misc/e-paned.c +++ b/widgets/misc/e-paned.c @@ -156,6 +156,8 @@ paned_realize (GtkWidget *widget) { EPanedPrivate *priv; GtkWidget *toplevel; + GdkWindowState state; + GdkWindow *window; priv = E_PANED_GET_PRIVATE (widget); @@ -167,10 +169,18 @@ paned_realize (GtkWidget *widget) * to make that happen. */ toplevel = gtk_widget_get_toplevel (widget); - - priv->wse_handler_id = g_signal_connect_swapped ( - toplevel, "window-state-event", - G_CALLBACK (paned_window_state_event_cb), widget); + window = gtk_widget_get_window (toplevel); + state = gdk_window_get_state (window); + + /* If the window is withdrawn, wait for it to be shown before + * setting the pane position. If the window is already shown, + * it's safe to set the pane position immediately. */ + if (state & GDK_WINDOW_STATE_WITHDRAWN) + priv->wse_handler_id = g_signal_connect_swapped ( + toplevel, "window-state-event", + G_CALLBACK (paned_window_state_event_cb), widget); + else + priv->toplevel_ready = TRUE; } static void |