summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-09-24 19:58:56 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-09-24 19:58:56 +0300
commitba84e84575b4167b0c6298e86a860b0741e2d2a3 (patch)
tree11c22fcbfbc9a106e15c34189d8597ae1763c2f8
parent93d3c2c45ccd9a806342746c4df33c684a284dd6 (diff)
parent576c5794cf4b786dfc183c9b6f0a387cad4a5460 (diff)
downloadxorg-lib-libXi-ba84e84575b4167b0c6298e86a860b0741e2d2a3.tar.gz
Merge branch 'input-hotplug'
-rw-r--r--configure.ac4
-rw-r--r--src/XChgDCtl.c48
-rw-r--r--src/XExtInt.c28
-rw-r--r--src/XGetDCtl.c47
4 files changed, 116 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 3b34ffa..d443194 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
-AC_INIT(libXi, 1.0.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi)
+AC_INIT(libXi, 1.1.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
@@ -15,7 +15,7 @@ AC_PROG_CC
AC_PROG_LIBTOOL
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XI, xproto x11 xextproto xext inputproto)
+PKG_CHECK_MODULES(XI, xproto x11 xextproto xext inputproto >= 1.4)
AC_SUBST(XI_CFLAGS)
AC_SUBST(XI_LIBS)
diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c
index be5d941..a196523 100644
--- a/src/XChgDCtl.c
+++ b/src/XChgDCtl.c
@@ -92,7 +92,7 @@ XChangeDeviceControl(dpy, dev, control, d)
R = (XDeviceResolutionControl *) d;
r.control = DEVICE_RESOLUTION;
r.length = sizeof(xDeviceResolutionCtl) +
- R->num_valuators * sizeof(int);
+ R->num_valuators * sizeof(int);
r.first_valuator = R->first_valuator;
r.num_valuators = R->num_valuators;
req->length += ((unsigned)(r.length + 3) >> 2);
@@ -107,6 +107,52 @@ XChangeDeviceControl(dpy, dev, control, d)
} else
return (rep.status);
}
+ case DEVICE_TOUCHSCREEN:
+ {
+ XDeviceTSControl *T = (XDeviceTSControl *) d;
+ xDeviceTSCtl t;
+
+ t.control = DEVICE_TOUCHSCREEN;
+ t.length = sizeof(t);
+ t.min_x = T->min_x;
+ t.max_x = T->max_x;
+ t.min_y = T->min_y;
+ t.max_y = T->max_y;
+ t.button_threshold = T->button_threshold;
+
+ req->length += (sizeof(t) + 3) >> 2;
+ Data(dpy, (char *) &t, sizeof(t));
+
+ if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NoSuchExtension;
+ }
+ else {
+ return rep.status;
+ }
+ }
+ case DEVICE_CORE:
+ {
+ XDeviceCoreControl *C = (XDeviceCoreControl *) d;
+ xDeviceCoreCtl c;
+
+ c.control = DEVICE_CORE;
+ c.length = sizeof(c);
+ c.status = C->status;
+
+ req->length += (sizeof(c) + 3) >> 2;
+ Data (dpy, (char *) &c, sizeof(c));
+
+ if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NoSuchExtension;
+ }
+ else {
+ return rep.status;
+ }
+ }
default:
{
xDeviceCtl u;
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 811c0c3..e5baccb 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -122,7 +122,9 @@ XEXT_GENERATE_FIND_DISPLAY(XInput_find_display, xinput_info,
{XI_Present, XI_Add_XSetDeviceValuators_Major,
XI_Add_XSetDeviceValuators_Minor},
{XI_Present, XI_Add_XChangeDeviceControl_Major,
- XI_Add_XChangeDeviceControl_Minor}
+ XI_Add_XChangeDeviceControl_Minor},
+ {XI_Present, XI_Add_DevicePresenceNotify_Major,
+ XI_Add_DevicePresenceNotify_Minor}
};
/***********************************************************************
@@ -251,6 +253,14 @@ Ones(mask)
return (((y + (y >> 3)) & 030707070707) % 077);
}
+static int
+_XiGetDevicePresenceNotifyEvent(Display * dpy)
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ return info->codes->first_event + XI_DevicePresenceNotify;
+}
+
/***********************************************************************
*
* Handle Input extension events.
@@ -665,6 +675,22 @@ XInputWireToEvent(dpy, re, event)
return (ENQUEUE_EVENT);
}
break;
+
+ case XI_DevicePresenceNotify:
+ {
+ XDevicePresenceNotifyEvent *ev = (XDevicePresenceNotifyEvent *) re;
+ devicePresenceNotify *ev2 = (devicePresenceNotify *) event;
+
+ fprintf(stderr, "got DevicePresenceNotify event (reltype=%d)\n",
+ reltype);
+
+ *ev = *(XDevicePresenceNotifyEvent *) save;
+ ev->window = 0;
+ ev->time = ev2->time;
+ return (ENQUEUE_EVENT);
+ }
+ break;
+
default:
printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type);
break;
diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c
index 9862dcc..139f7e7 100644
--- a/src/XGetDCtl.c
+++ b/src/XGetDCtl.c
@@ -61,13 +61,11 @@ SOFTWARE.
#include <X11/extensions/extutil.h>
#include "XIint.h"
-XDeviceControl * XGetDeviceControl(dpy, dev, control)
- register Display *
- dpy;
- XDevice *
- dev;
- int
- control;
+XDeviceControl *
+XGetDeviceControl(dpy, dev, control)
+ register Display *dpy;
+ XDevice *dev;
+ int control;
{
int size = 0;
int nbytes, i;
@@ -116,6 +114,15 @@ XDeviceControl * XGetDeviceControl(dpy, dev, control)
(3 * sizeof(int) * r->num_valuators);
break;
}
+ case DEVICE_TOUCHSCREEN:
+ {
+ size += sizeof(xDeviceTSState);
+ break;
+ }
+ case DEVICE_CORE:
+ {
+ size += sizeof(xDeviceCoreState);
+ }
default:
size += d->length;
break;
@@ -152,6 +159,32 @@ XDeviceControl * XGetDeviceControl(dpy, dev, control)
*iptr++ = *iptr2++;
break;
}
+ case DEVICE_TOUCHSCREEN:
+ {
+ xDeviceTSState *t = (xDeviceTSState *) d;
+ XDeviceTSState *T = (XDeviceTSState *) Device;
+
+ T->control = DEVICE_TOUCHSCREEN;
+ T->length = sizeof(T);
+ T->min_x = t->min_x;
+ T->max_x = t->max_x;
+ T->min_y = t->min_y;
+ T->max_y = t->max_y;
+ T->button_threshold = t->button_threshold;
+
+ break;
+ }
+ case DEVICE_CORE:
+ {
+ xDeviceCoreState *c = (xDeviceCoreState *) d;
+ XDeviceCoreState *C = (XDeviceCoreState *) Device;
+
+ C->control = DEVICE_CORE;
+ C->length = sizeof(C);
+ C->status = c->status;
+
+ break;
+ }
default:
break;
}