From 9ba59929c23c71a5231670a50c3fcb1165111c90 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 22 Mar 2021 10:40:21 +0100 Subject: Fix touch scroll clamping to selected item, making it appear laggy. Fix emoji offset for non 1.0 scaling --- src/Utils.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/Utils.cpp') 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 -- cgit v1.2.3