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




commit 18ed2aae39650c26c23fb896dab3afae36c3a3c0
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 ac36f3573a..c215dca0e3 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1227,7 +1227,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 5712b4d248..5c2b297445 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]