[gnome-shell/wip/carlosg/osk-gesture-feedback: 5/8] keyboard: Simplify focus window tracking
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-gesture-feedback: 5/8] keyboard: Simplify focus window tracking
- Date: Fri, 12 Feb 2021 00:04:16 +0000 (UTC)
commit f9551c05a15bf2c5e651517f6417c65ab1231f09
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Feb 11 15:36:42 2021 +0100
keyboard: Simplify focus window tracking
Keep the focus window in a single field, and optionally animate
depending on keyboard visibility.
js/ui/keyboard.js | 47 ++++++++++++++++++++---------------------------
1 file changed, 20 insertions(+), 27 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index f8fb322dc7..6ebfe20411 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1239,9 +1239,7 @@ var Keyboard = GObject.registerClass({
this._emojiActive = false;
this._languagePopup = null;
- this._currentFocusWindow = null;
- this._animFocusedWindow = null;
- this._delayedAnimFocusWindow = null;
+ this._focusWindow = null;
this._latched = false; // current level is latched
@@ -1252,9 +1250,7 @@ var Keyboard = GObject.registerClass({
this._connectSignal(this._focusTracker, 'position-changed',
this._onFocusPositionChanged.bind(this));
this._connectSignal(this._focusTracker, 'reset', () => {
- this._delayedAnimFocusWindow = null;
- this._animFocusedWindow = null;
- this._oskFocusWindow = null;
+ this._focusWindow = null;
});
// Valid only for X11
if (!Meta.is_wayland_compositor()) {
@@ -1764,11 +1760,6 @@ var Keyboard = GObject.registerClass({
this.animateShow();
this._setEmojiActive(false);
-
- if (this._delayedAnimFocusWindow) {
- this._setAnimationWindow(this._delayedAnimFocusWindow);
- this._delayedAnimFocusWindow = null;
- }
}
close() {
@@ -1798,6 +1789,9 @@ var Keyboard = GObject.registerClass({
}
animateShow() {
+ if (this._focusWindow)
+ this._animateWindow(this._focusWindow, true);
+
Main.layoutManager.keyboardBox.show();
this.ease({
translation_y: -this.height,
@@ -1823,6 +1817,9 @@ var Keyboard = GObject.registerClass({
}
animateHide(immediate) {
+ if (this._focusWindow)
+ this._animateWindow(this._focusWindow, false);
+
if (this._keyboardHeightNotifyId) {
Main.layoutManager.keyboardBox.disconnect(this._keyboardHeightNotifyId);
this._keyboardHeightNotifyId = 0;
@@ -1898,16 +1895,18 @@ var Keyboard = GObject.registerClass({
}
}
- _setAnimationWindow(window) {
- if (this._animFocusedWindow == window)
+ _setFocusWindow(window) {
+ if (this._focusWindow == window)
return;
- if (this._animFocusedWindow)
- this._animateWindow(this._animFocusedWindow, false);
- if (window)
- this._animateWindow(window, true);
+ if (this._keyboardVisible) {
+ if (this._focusWindow)
+ this._animateWindow(this._focusWindow, false);
+ if (window)
+ this._animateWindow(window, true);
+ }
- this._animFocusedWindow = window;
+ this._focusWindow = window;
}
setCursorLocation(window, x, y, w, h) {
@@ -1917,19 +1916,13 @@ var Keyboard = GObject.registerClass({
let keyboardHeight = Main.layoutManager.keyboardBox.height;
if (y + h >= monitor.y + monitor.height - keyboardHeight) {
- if (this._keyboardVisible)
- this._setAnimationWindow(window);
- else
- this._delayedAnimFocusWindow = window;
+ this._setFocusWindow(window);
} else if (y < keyboardHeight) {
- this._delayedAnimFocusWindow = null;
- this._setAnimationWindow(null);
+ this._setFocusWindow(null);
}
} else {
- this._setAnimationWindow(null);
+ this._setFocusWindow(null);
}
-
- this._oskFocusWindow = window;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]