keyboard: Reset height before requesting preferred height

If we don't set the height property to -1 before requesting the
preferred height, get_preferred_height() will just return us the fixed
height that has been set before. We don't want this behavior here, so
set the height to -1 before calling get_preferred_height().

This fixes a resizing issue where the keyboard is sized incorrectly
after switching the monitor into portrait mode and back.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2306>
This commit is contained in:
Jonas Dreßler 2022-05-26 18:13:12 +02:00
parent f6cda37b39
commit a3bfe0ab56

View File

@ -1697,6 +1697,7 @@ var Keyboard = GObject.registerClass({
* we allow the OSK being smaller than 1/3rd of the monitor height * we allow the OSK being smaller than 1/3rd of the monitor height
* there. * there.
*/ */
this.height = -1;
const forWidth = this.get_theme_node().adjust_for_width(monitor.width); const forWidth = this.get_theme_node().adjust_for_width(monitor.width);
const [, natHeight] = this.get_preferred_height(forWidth); const [, natHeight] = this.get_preferred_height(forWidth);
this.height = Math.min(maxHeight, natHeight); this.height = Math.min(maxHeight, natHeight);