[gnome-shell] keyboard: Request a bigger size in portrait orientation
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] keyboard: Request a bigger size in portrait orientation
- Date: Mon, 6 Jul 2020 15:24:11 +0000 (UTC)
commit 261d36ba72d8051d6b1cca5a403cce3dd9b5219e
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Jul 4 02:36:10 2020 +0200
keyboard: Request a bigger size in portrait orientation
In portrait orientation, we set the height to the preferred height
for the monitor width (or, if smaller, a third o the screen height).
However as the forWidth currently doesn't make a difference, the height
is effectively controlled by the natural height of the keys - which is
rather small.
Address this by making AspectContainer request an appropriate preferred
size based on the fixed ratio.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2349
js/ui/keyboard.js | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 62df5922f7..c9b3dd5f77 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -61,6 +61,24 @@ class AspectContainer extends St.Widget {
this.queue_relayout();
}
+ vfunc_get_preferred_width(forHeight) {
+ let [min, nat] = super.vfunc_get_preferred_width(forHeight);
+
+ if (forHeight > 0)
+ nat = forHeight * this._ratio;
+
+ return [min, nat];
+ }
+
+ vfunc_get_preferred_height(forWidth) {
+ let [min, nat] = super.vfunc_get_preferred_height(forWidth);
+
+ if (forWidth > 0)
+ nat = forWidth / this._ratio;
+
+ return [min, nat];
+ }
+
vfunc_allocate(box) {
if (box.get_width() > 0 && box.get_height() > 0) {
let sizeRatio = box.get_width() / box.get_height();
@@ -1608,7 +1626,8 @@ class Keyboard extends St.BoxLayout {
* we allow the OSK being smaller than 1/3rd of the monitor height
* there.
*/
- const [, natHeight] = this.get_preferred_height(monitor.width);
+ const forWidth = this.get_theme_node().adjust_for_width(monitor.width);
+ const [, natHeight] = this.get_preferred_height(forWidth);
this.height = Math.min(maxHeight, natHeight);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]