[gnome-shell/wip/carlosg/osk-updates: 2/26] main: Add 'osk-preview' mode




commit 7f52282c6ed953f9ced586fcaf8c6e8722fd4917
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 13 15:55:27 2022 +0200

    main: Add 'osk-preview' mode
    
    This GNOME Shell --mode option will be useful to preview changes
    done to the JSON files defining OSK key models.

 js/ui/keyboard.js    |  3 ++-
 js/ui/main.js        |  8 ++++++++
 js/ui/sessionMode.js | 22 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 37c71b16b6..63cd40f6ce 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1218,7 +1218,8 @@ var KeyboardManager = class KeyBoardManager {
     }
 
     _syncEnabled() {
-        let enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
+        let enableKeyboard = Main.sessionMode.currentMode === 'osk-preview' ||
+            this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
         let autoEnabled = this._seat.get_touch_mode() && this._lastDeviceIsTouchscreen();
         let enabled = enableKeyboard || autoEnabled;
 
diff --git a/js/ui/main.js b/js/ui/main.js
index d1a2076f66..3aacd90299 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -329,6 +329,14 @@ function _initializeUI() {
             let module = eval(`imports.perf.${perfModuleName};`);
             Scripting.runPerfScript(module, perfOutput);
         }
+
+        if (sessionMode.currentMode === 'osk-preview') {
+            let entry = new St.Entry();
+            global.stage.add_child(entry);
+            entry.set_width(global.screen_width / 2);
+            entry.set_position(global.screen_width / 4, global.screen_height / 4);
+            entry.grab_key_focus();
+        }
     });
 }
 
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index b8b627370d..82edf65da1 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -97,6 +97,28 @@ const _modes = {
             right: ['screenRecording', 'dwellClick', 'a11y', 'keyboard', 'aggregateMenu'],
         },
     },
+
+    'osk-preview': {
+        hasOverview: false,
+        showCalendarEvents: false,
+        showWelcomeDialog: false,
+        allowSettings: false,
+        allowScreencast: false,
+        hasRunDialog: false,
+        hasWorkspaces: true,
+        hasWindows: true,
+        hasWmMenus: false,
+        hasNotifications: false,
+        isLocked: false,
+        isPrimary: true,
+        unlockDialog: null,
+        components: [],
+        panel: {
+            left: [],
+            center: [],
+            right: [ 'keyboard'],
+        },
+    },
 };
 
 function _loadMode(file, info) {


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