summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2002-07-04 01:00:27 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:00:50 +0200
commit5a5fd8052a1e9b55b87dd22bd25c3478701a76f3 (patch)
treeadc933e60795486205b83d6143f81437cc33d548
parenta37bd61dc480c033e1baf0e393e643e5496b9337 (diff)
* Added z, w, left, right, up and down information to the shared memory
area. Updated synclient to report the new information. * Improved synclient to only report when something changes.
-rw-r--r--synaptics.c6
-rw-r--r--synaptics.h3
-rw-r--r--synclient.c26
3 files changed, 33 insertions, 2 deletions
diff --git a/synaptics.c b/synaptics.c
index 4372a58..e9636d2 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -488,6 +488,12 @@ ReadInput(LocalDevicePtr local)
/* shared memory */
para->x = x;
para->y = y;
+ para->z = z;
+ para->w = w;
+ para->left = left;
+ para->right = right;
+ para->up = up;
+ para->down = down;
/* 3rd button emulation */
if(!left && !right) {
diff --git a/synaptics.h b/synaptics.h
index fa74206..f9d415d 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -19,6 +19,9 @@ typedef struct _SynapticsMoveHist {
typedef struct _SynapticsSHM {
int x, y; /* actual x, y Coordinates */
+ int z; /* pressure value */
+ int w; /* finger width value */
+ int left, right, up, down; /* left/right/up/down buttons */
unsigned long int model_id; /* Model-ID */
unsigned long int capabilities; /* Capabilities */
diff --git a/synclient.c b/synclient.c
index ab5a9ac..af46cec 100644
--- a/synclient.c
+++ b/synclient.c
@@ -3,14 +3,31 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
+
#define SHM_SYNAPTICS 23947
typedef struct _SynapticsSHM {
int x, y;
+ int z; /* pressure value */
+ int w; /* finger width value */
+ int left, right, up, down; /* left/right/up/down buttons */
} SynapticsSHM;
+static int is_equal(SynapticsSHM* s1, SynapticsSHM* s2)
+{
+ return ((s1->x == s2->x) &&
+ (s1->y == s2->y) &&
+ (s1->z == s2->z) &&
+ (s1->w == s2->w) &&
+ (s1->left == s2->left) &&
+ (s1->right == s2->right) &&
+ (s1->up == s2->up) &&
+ (s1->down == s2->down));
+}
+
int main() {
SynapticsSHM *synshm;
int shmid;
+ SynapticsSHM old;
if((shmid = shmget(SHM_SYNAPTICS, 0, 0)) == -1)
printf("shmget Fehler\n");
@@ -18,9 +35,14 @@ int main() {
printf("shmat Fehler\n");
while(1) {
- printf("x:%d y:%d\n", synshm->x, synshm->y);
+ SynapticsSHM cur = *synshm;
+ if (!is_equal(&old, &cur)) {
+ printf("x:%4d y:%4d z:%3d w:%2d left:%d right:%d up:%d down:%d\n",
+ cur.x, cur.y, cur.z, cur.w, cur.left, cur.right, cur.up, cur.down);
+ old = cur;
+ }
usleep(100000);
- }
+ }
exit(0);
}