[gnome-shell/wip/carlosg/osk-widgetry-fixes: 5/5] keyboard: Avoid blank space in OSK panel on portrait layouts
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-widgetry-fixes: 5/5] keyboard: Avoid blank space in OSK panel on portrait layouts
- Date: Tue, 21 Jan 2020 16:08:43 +0000 (UTC)
commit f0e6a6ec9626abddf906f55f1a8ced95192d06fc
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 21 17:01:56 2020 +0100
keyboard: Avoid blank space in OSK panel on portrait layouts
We try to make the OSK 1/3rd as big as the monitor. On landscape
layouts we usually get away with it as there's plenty of horizontal
space to enlarge the OSK while keeping the OSK aspect ratio.
In portrait layout, the horizontal space is a lot more scarce so
it means we'll still have plenty of space after making the OSK as
wide as it can possibly be, which will look as odd blank space in
the OSK panel.
In order to fix this, let the OSK panel height be less than 1/3rd
the monitor size if we are dealing with portrait layouts.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/2132
js/ui/keyboard.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index e343c564ad..01ab9c364d 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1584,7 +1584,17 @@ class Keyboard extends St.BoxLayout {
let maxHeight = monitor.height / 3;
this.width = monitor.width;
- this.height = maxHeight;
+
+ 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 = Math.min(maxHeight, this.get_preferred_height(monitor.width));
+ }
}
_onGroupChanged() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]