summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-15 07:42:12 +1000
committerChase Douglas <chase.douglas@canonical.com>2011-12-21 10:34:12 -0800
commitb6a3a440700d005aeceec96bc2562e7f8a1b724e (patch)
treed414ae2d3190d2014b75af8c9f70c02b1908d97d
parent8f7f73e017743b1b67f6ddcf3a48650a0c83737f (diff)
Xi: add the hooks for passive touch grabs
Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--Xi/exevents.c34
-rw-r--r--Xi/xipassivegrab.c17
-rw-r--r--include/exevents.h8
3 files changed, 55 insertions, 4 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index f1598f750..084969097 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -2253,12 +2253,14 @@ CheckGrabValues(ClientPtr client, GrabParameters* param)
}
if ((param->this_device_mode != GrabModeSync) &&
- (param->this_device_mode != GrabModeAsync)) {
+ (param->this_device_mode != GrabModeAsync) &&
+ (param->this_device_mode != XIGrabModeTouch)) {
client->errorValue = param->this_device_mode;
return BadValue;
}
if ((param->other_devices_mode != GrabModeSync) &&
- (param->other_devices_mode != GrabModeAsync)) {
+ (param->other_devices_mode != GrabModeAsync) &&
+ (param->other_devices_mode != XIGrabModeTouch)) {
client->errorValue = param->other_devices_mode;
return BadValue;
}
@@ -2423,6 +2425,34 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
return AddPassiveGrabToList(client, grab);
}
+/* Touch grab */
+int
+GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
+ GrabParameters *param, GrabMask *mask)
+{
+ WindowPtr pWin;
+ GrabPtr grab;
+ int rc;
+
+ rc = CheckGrabValues(client, param);
+ if (rc != Success)
+ return rc;
+
+ rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGrabAccess);
+ if (rc != Success)
+ return rc;
+
+ grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
+ mask, param, XI_TouchBegin, 0, NullWindow, NullCursor);
+ if (!grab)
+ return BadAlloc;
+
+ return AddPassiveGrabToList(client, grab);
+}
+
int
SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
Mask mask, Mask exclusivemasks)
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 713a1654e..5d34abc18 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -108,19 +108,29 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (stuff->grab_type != XIGrabtypeButton &&
stuff->grab_type != XIGrabtypeKeycode &&
stuff->grab_type != XIGrabtypeEnter &&
- stuff->grab_type != XIGrabtypeFocusIn)
+ stuff->grab_type != XIGrabtypeFocusIn &&
+ stuff->grab_type != XIGrabtypeTouchBegin)
{
client->errorValue = stuff->grab_type;
return BadValue;
}
if ((stuff->grab_type == XIGrabtypeEnter ||
- stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
+ stuff->grab_type == XIGrabtypeFocusIn ||
+ stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0)
{
client->errorValue = stuff->detail;
return BadValue;
}
+ if (stuff->grab_type == XIGrabtypeTouchBegin &&
+ (stuff->grab_mode != XIGrabModeTouch ||
+ stuff->paired_device_mode != GrabModeAsync))
+ {
+ client->errorValue = stuff->grab_mode;
+ return BadValue;
+ }
+
if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
stuff->mask_len * 4) != Success)
return BadValue;
@@ -194,6 +204,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
status = GrabWindow(client, dev, stuff->grab_type,
&param, &mask);
break;
+ case XIGrabtypeTouchBegin:
+ status = GrabTouch(client, dev, mod_dev, &param, &mask);
+ break;
}
if (status != GrabSuccess)
diff --git a/include/exevents.h b/include/exevents.h
index 0186f53bf..bd1697066 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -222,6 +222,14 @@ GrabWindow(
GrabMask* /* eventMask */);
extern int
+GrabTouch(
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ DeviceIntPtr /* mod_dev */,
+ GrabParameters* /* param */,
+ GrabMask* /* eventMask */);
+
+extern int
SelectForWindow(
DeviceIntPtr /* dev */,
WindowPtr /* pWin */,