diff options
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r-- | src/Utils.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp index 2c3bfb7..2a36d27 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -7,6 +7,8 @@ namespace QuickMedia { static float scale = 1.0f; static bool scale_set = false; + static bool qm_enable_touch = false; + static bool qm_enable_touch_set = false; static const int XFT_DPI_DEFAULT = 96; // Returns 96 on error @@ -55,4 +57,32 @@ namespace QuickMedia { scale_set = true; return scale; } + + void show_virtual_keyboard() { + if(!is_touch_enabled()) + return; + + fprintf(stderr, "Show virtual keyboard\n"); + system("busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true"); + } + + void hide_virtual_keyboard() { + if(!is_touch_enabled()) + return; + + fprintf(stderr, "Hide virtual keyboard\n"); + system("busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false"); + } + + bool is_touch_enabled() { + if(qm_enable_touch_set) + return qm_enable_touch; + + const char *qm_enable_touch_env = getenv("QM_ENABLE_TOUCH"); + if(qm_enable_touch_env && qm_enable_touch_env[0] == '1') + qm_enable_touch = true; + + qm_enable_touch_set = true; + return qm_enable_touch; + } }
\ No newline at end of file |