[sushi] Add a function to get max window size



commit c9f64bca5adfb6071d8552adabc3d8b1289372cc
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jul 10 16:53:15 2019 +0200

    Add a function to get max window size
    
    Instead of only relying on constants, since we want to add some
    resolution-dependent logic.

 src/ui/mainWindow.js  | 9 ++++++++-
 src/util/constants.js | 2 --
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/ui/mainWindow.js b/src/ui/mainWindow.js
index 849d758..a65f71b 100644
--- a/src/ui/mainWindow.js
+++ b/src/ui/mainWindow.js
@@ -30,6 +30,9 @@ const MimeHandler = imports.ui.mimeHandler;
 const Renderer = imports.ui.renderer;
 const Utils = imports.ui.utils;
 
+const WINDOW_MAX_W = 800;
+const WINDOW_MAX_H = 600;
+
 const Embed = GObject.registerClass(class Embed extends Gtk.Overlay {
     vfunc_get_request_mode() {
         return Gtk.SizeRequestMode.HEIGHT_FOR_WIDTH;
@@ -214,6 +217,10 @@ var MainWindow = GObject.registerClass(class MainWindow extends Gtk.ApplicationW
             this.show_all();
     }
 
+    _getMaxSize() {
+        return [WINDOW_MAX_W, WINDOW_MAX_H];
+    }
+
     _resizeWindow() {
         if (!this._renderer)
             return;
@@ -221,7 +228,7 @@ var MainWindow = GObject.registerClass(class MainWindow extends Gtk.ApplicationW
         if (this._renderer.fullscreen)
             return;
 
-        let maxSize = [Constants.VIEW_MAX_W, Constants.VIEW_MAX_H];
+        let maxSize = this._getMaxSize();
         let rendererSize = [this._renderer.get_preferred_width(), this._renderer.get_preferred_height()];
         let natSize = [rendererSize[0][1], rendererSize[1][1]];
         let windowSize;
diff --git a/src/util/constants.js b/src/util/constants.js
index 655a9b9..580bf72 100644
--- a/src/util/constants.js
+++ b/src/util/constants.js
@@ -24,6 +24,4 @@
  */
 
 var VIEW_MIN = 400;
-var VIEW_MAX_W = 800;
-var VIEW_MAX_H = 600;
 var TOOLBAR_SPACING = 32;


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