summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-08-31 11:56:16 +1000
committerPing Cheng <pinglinux@gmail.com>2022-09-13 16:04:34 -0700
commit829a2d996f1a8d8a735c0eb7340797959de03ca8 (patch)
tree2e2e32d4818d54488a9f9d9cf6d617ba724613b1
parent8e4a77bc28970d23da80838c195550cad4ef8e05 (diff)
downloadxf86-input-wacom-829a2d996f1a8d8a735c0eb7340797959de03ca8.tar.gz
gwacom: add support for special runtime options
This is a hack to make it possible to test options that cannot be set through the xorg.conf, e.g button actions that are set through the X-specific properties interface. Expose a new function for "runtime options", though the actual option implementation needs to be handled in the gwacom wrapper code - i.e. only options explicitly supported can work. The currently supported option is "PanButton" which maps the given button to the PanScroll action.
-rw-r--r--src/gwacom/wacom-device.c15
-rw-r--r--src/gwacom/wacom-device.h10
2 files changed, 25 insertions, 0 deletions
diff --git a/src/gwacom/wacom-device.c b/src/gwacom/wacom-device.c
index 29fb9ae..87ac433 100644
--- a/src/gwacom/wacom-device.c
+++ b/src/gwacom/wacom-device.c
@@ -296,6 +296,21 @@ WacomOptions *wacom_device_get_options(WacomDevice *device)
return device->options;
}
+void wacom_device_set_runtime_option(WacomDevice *device, const char *name, const char *value)
+{
+ WacomDevicePtr priv = device->priv;
+
+ wcmLog(priv, W_ERROR, "Setting special option %s=%s\n", name, value);
+
+ if (g_str_equal(name, "PanButton")) {
+ guint btn = atoi(value) - 1; /* array is zero-indexed, config options use 1-indexed ones */
+ assert(btn < sizeof(priv->key_actions));
+ wcmActionSet(&priv->key_actions[btn], 0, AC_PANSCROLL);
+ } else {
+ wcmLog(priv, W_ERROR, ":::::::::::::::: Unsupported runtime option %s ::::::::::::::::\n", name);
+ }
+}
+
/****************** Driver layer *****************/
int
diff --git a/src/gwacom/wacom-device.h b/src/gwacom/wacom-device.h
index 3ada1dd..546fd9f 100644
--- a/src/gwacom/wacom-device.h
+++ b/src/gwacom/wacom-device.h
@@ -197,6 +197,16 @@ WacomToolType wacom_device_get_tool_type(WacomDevice *device);
*/
WacomOptions *wacom_device_get_options(WacomDevice *device);
+/**
+ * wacom_device_set_runtime_option:
+ *
+ * Some options like button actions are runtime-only and cannot be set through.
+ * WacomOptionx (which maps to the xorg.conf support of the driver).
+ * This is a hack to set some of those options, however the options
+ * and values supported are very specific to the implementation.
+ */
+void wacom_device_set_runtime_option(WacomDevice *device, const char *name, const char *value);
+
/* The following getters are only available after wacom_device_setup() */
int wacom_device_get_num_buttons(WacomDevice *device);