[gnome-shell/wip/carlosg/osk-updates: 31/40] keyboard: Let the OSK take 1/4th of height in portrait mode




commit 6e823e623f952b32ada419381aba1515ca4de7d5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 1 17:39:57 2022 +0200

    keyboard: Let the OSK take 1/4th of height in portrait mode
    
    And let the keys shrink horizontally to cover the full area.

 js/ui/keyboard.js | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 795d1449f2..9e813f1c34 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -69,10 +69,6 @@ class AspectContainer extends St.Widget {
 
                 box.x1 += Math.floor(diff / 2);
                 box.x2 -= Math.ceil(diff / 2);
-            } else {
-                /* Restrict vertically, align to bottom */
-                let height = box.get_width() / this._ratio;
-                box.y1 = box.y2 - Math.floor(height);
             }
         }
 
@@ -1771,22 +1767,12 @@ var Keyboard = GObject.registerClass({
         if (!monitor)
             return;
 
-        let maxHeight = monitor.height / 3;
         this.width = monitor.width;
 
-        if (monitor.width > monitor.height) {
-            this.height = maxHeight;
-        } else {
-            /* In portrait mode, lack of horizontal space means we won't be
-             * able to make the OSK that big while keeping size ratio, so
-             * we allow the OSK being smaller than 1/3rd of the monitor height
-             * there.
-             */
-            this.height = -1;
-            const forWidth = this.get_theme_node().adjust_for_width(monitor.width);
-            const [, natHeight] = this.get_preferred_height(forWidth);
-            this.height = Math.min(maxHeight, natHeight);
-        }
+        if (monitor.width > monitor.height)
+            this.height = monitor.height / 3;
+        else
+            this.height = monitor.height / 4;
     }
 
     _updateKeys() {


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