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




commit d0e093db89ebeaa3e04b28011418738b25807589
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 ac2a800b40..56de1d5efb 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1226,7 +1226,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]