aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-03-22 10:40:21 +0100
committerdec05eba <dec05eba@protonmail.com>2021-03-22 10:40:21 +0100
commit9ba59929c23c71a5231670a50c3fcb1165111c90 (patch)
treeddc7ff719f76c009410c96c09a34be5b75b9bc92 /src/Utils.cpp
parent4aec31515ff6f61f41dfd66551a3fce44f243535 (diff)
Fix touch scroll clamping to selected item, making it appear laggy. Fix emoji offset for non 1.0 scaling
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp30
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