[evince/gnome-3-30] shell: remember unmaximized window size



commit 76f561530dd6ee4a525337da0d1876a88d8fe785
Author: Jason Crain <jcrain src gnome org>
Date:   Wed Jun 5 15:02:21 2019 -0600

    shell: remember unmaximized window size
    
    Evince tries to save the window size and maximization state for each
    document and restores them when the document is reopened. However, for
    maximized documents, Evince does not correctly save and restore the
    window size. If a document is opened in a maximized state and later
    unmaximized, the window is restored to the default 600x600 size instead
    of the window's size prior to maximization.
    
    This fixes how Evince saves and restores the window size for maximized
    documents.

 shell/ev-window.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 11169c14..cfed16ca 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1354,15 +1354,6 @@ setup_size_from_metadata (EvWindow *window)
        if (!window->priv->metadata)
                return;
 
-       if (ev_metadata_get_boolean (window->priv->metadata, "window_maximized", &maximized)) {
-               if (maximized) {
-                       gtk_window_maximize (GTK_WINDOW (window));
-                       return;
-               } else {
-                       gtk_window_unmaximize (GTK_WINDOW (window));
-               }
-       }
-
        if (ev_metadata_get_int (window->priv->metadata, "window_x", &x) &&
            ev_metadata_get_int (window->priv->metadata, "window_y", &y)) {
                gtk_window_move (GTK_WINDOW (window), x, y);
@@ -1372,6 +1363,14 @@ setup_size_from_metadata (EvWindow *window)
            ev_metadata_get_int (window->priv->metadata, "window_height", &height)) {
                gtk_window_resize (GTK_WINDOW (window), width, height);
        }
+
+       if (ev_metadata_get_boolean (window->priv->metadata, "window_maximized", &maximized)) {
+               if (maximized) {
+                       gtk_window_maximize (GTK_WINDOW (window));
+               } else {
+                       gtk_window_unmaximize (GTK_WINDOW (window));
+               }
+       }
 }
 
 static void
@@ -6146,7 +6145,8 @@ window_configure_event_cb (EvWindow *window, GdkEventConfigure *event, gpointer
 
        state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
 
-       if (!(state & GDK_WINDOW_STATE_FULLSCREEN)) {
+       if (!(state & GDK_WINDOW_STATE_FULLSCREEN) &&
+           !(state & GDK_WINDOW_STATE_MAXIMIZED)) {
                if (window->priv->document) {
                        ev_document_get_max_page_size (window->priv->document,
                                                       &document_width, &document_height);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]