[evince] shell: remember unmaximized window size



commit 8149f83f94d855f62c23729ecd45af73b944117c
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 b804dee7..c45ff508 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1384,15 +1384,6 @@ setup_size_from_metadata (EvWindow *window)
        if (!priv->metadata)
                return;
 
-       if (ev_metadata_get_boolean (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 (priv->metadata, "window_x", &x) &&
            ev_metadata_get_int (priv->metadata, "window_y", &y)) {
                gtk_window_move (GTK_WINDOW (window), x, y);
@@ -1402,6 +1393,14 @@ setup_size_from_metadata (EvWindow *window)
            ev_metadata_get_int (priv->metadata, "window_height", &height)) {
                gtk_window_resize (GTK_WINDOW (window), width, height);
        }
+
+       if (ev_metadata_get_boolean (priv->metadata, "window_maximized", &maximized)) {
+               if (maximized) {
+                       gtk_window_maximize (GTK_WINDOW (window));
+               } else {
+                       gtk_window_unmaximize (GTK_WINDOW (window));
+               }
+       }
 }
 
 static void
@@ -6463,7 +6462,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 (priv->document) {
                        ev_document_get_max_page_size (priv->document,
                                                       &document_width, &document_height);


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