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




commit aadf26615b69d348ef537e2126f6f365295fe4fc
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 499bc28a90..88dbb8be9c 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..36c8c95070 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]