Permalink
Browse files

Add support for querying touchpad capabilities

Add pseudo properties to assist in querying Synaptics Capabilities
and Touchpad::capability() helper. For older Synaptics driver
(pre 1.2.0) that does not set Synaptics Capabilities just assume
all of them are present.
  • Loading branch information...
1 parent 51585ca commit 6e983b5627770f4ed102d3574b9b10973befff3f @arvidjaar arvidjaar committed Jan 23, 2010
Showing with 20 additions and 0 deletions.
  1. +13 −0 touchpad.cpp
  2. +7 −0 touchpad.h
View
@@ -378,6 +378,19 @@ Touchpad::set_parameter(const char* name, double variable) {
dp_set_parameter(display, device, name, variable);
}
+bool
+Touchpad::capability(const char* name) {
+ if (display && device) {
+ char *cap;
+
+ cap = (char *)dp_get_parameter(display, device, name);
+ if (cap)
+ return *cap == 1;
+ }
+
+ return true;
+}
+
const char*
Touchpad::get_device_name() {
return dev_name;
View
@@ -140,6 +140,11 @@ static struct Parameter params[] = {
{"AreaRightEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 1},
{"AreaTopEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 2},
{"AreaBottomEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 3},
+ {"_CapLeftButton", PT_BOOL, 0, 1, SYNAPTICS_PROP_CAPABILITIES, 8, 0},
+ {"_CapMiddleButton", PT_BOOL, 0, 1, SYNAPTICS_PROP_CAPABILITIES, 8, 1},
+ {"_CapRightButton", PT_BOOL, 0, 1, SYNAPTICS_PROP_CAPABILITIES, 8, 2},
+ {"_CapTwoFingers", PT_BOOL, 0, 1, SYNAPTICS_PROP_CAPABILITIES, 8, 3},
+ {"_CapThreeFingers", PT_BOOL, 0, 1, SYNAPTICS_PROP_CAPABILITIES, 8, 4},
{ NULL, ParaType(0), 0, 0, 0, 0, 0 }
};
@@ -152,6 +157,8 @@ namespace Touchpad {
const void* get_parameter(const char* name);
void set_parameter(const char* name, double variable);
+ bool capability(const char* name);
+
const char* get_device_name();
}

0 comments on commit 6e983b5

Please sign in to comment.