1 /**************************************************************************
5 Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
7 Contact: Boram Park <boram1288.park@samsung.com>
8 Sangjin LEE <lsj119@samsung.com>
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 **************************************************************************/
39 #include <sys/types.h>
40 #include <sys/fcntl.h>
51 #include <X11/Xatom.h>
53 #include <windowstr.h>
54 #include <X11/extensions/gesture.h>
55 #include <X11/extensions/gestureproto.h>
58 #include "xdbg_types.h"
59 #include "xdbg_evlog_gesture.h"
62 _EvlogRequestGesture(xReq *req, char *reply, int *len)
68 case X_GestureSelectEvents:
70 xGestureSelectEventsReq *stuff = (xGestureSelectEventsReq *)req;
71 REPLY (": XID(0x%lx)",
77 case X_GestureGetSelectedEvents:
79 xGestureGetSelectedEventsReq *stuff = (xGestureGetSelectedEventsReq *)req;
80 REPLY (": XID(0x%lx)",
86 case X_GestureGrabEvent:
88 xGestureGrabEventReq *stuff = (xGestureGrabEventReq *)req;
89 REPLY (": XID(0x%lx) EventType(0x%lx), Num_finger(%d)",
97 case X_GestureUngrabEvent:
99 xGestureUngrabEventReq *stuff = (xGestureUngrabEventReq *)req;
100 REPLY (": XID(0x%lx) EventType(0x%lx), Num_finger(%d)",
116 _EvlogEventGesture (xEvent *evt, int first_base, char *reply, int *len)
120 switch ((stuff->u.u.type & 0x7F) - first_base)
122 case GestureNotifyFlick:
124 xGestureNotifyFlickEvent *stuff = (xGestureNotifyFlickEvent *) evt;
125 REPLY (": XID(0x%lx) Direction(%d) Distance(%d) Duration(%ldms) Angle(0x%lx)",
135 case GestureNotifyPan:
137 xGestureNotifyPanEvent *stuff = (xGestureNotifyPanEvent *) evt;
138 REPLY (": XID(0x%lx) Direction(%d) Distance(%d) Duration(%ldms) coord(%d,%d)",
149 case GestureNotifyPinchRotation:
151 xGestureNotifyPinchRotationEvent *stuff = (xGestureNotifyPinchRotationEvent *) evt;
152 REPLY (": XID(0x%lx) Distance(%d) Coord(%d,%d) Zoom(0x%lx) Angle(0x%lx)",
163 case GestureNotifyTap:
165 xGestureNotifyTapEvent *stuff = (xGestureNotifyTapEvent *) evt;
166 REPLY (": XID(0x%lx) Coord(%d,%d) tapRepeat(%d) Interval(%ldms)",
176 case GestureNotifyTapNHold:
178 xGestureNotifyTapNHoldEvent *stuff = (xGestureNotifyTapNHoldEvent *) evt;
179 REPLY (": XID(0x%lx) Coord(%d,%d) Interval(%ldms) Holdtime(%ldms)",
189 case GestureNotifyHold:
191 xGestureNotifyHoldEvent *stuff = (xGestureNotifyHoldEvent *) evt;
192 REPLY (": XID(0x%lx) Coord(%d,%d) Holdtime(%ldms)",
201 case GestureNotifyGroup:
203 xGestureNotifyGroupEvent *stuff = (xGestureNotifyGroupEvent *) evt;
204 REPLY (": XID(0x%lx) groupID(%d) groupNum(%d)",
221 xDbgEvlogGestureGetBase (void *dpy, ExtensionInfo *extinfo)
224 Display *d = (Display*)dpy;
226 RETURN_IF_FAIL (d != NULL);
228 if (!XQueryExtension(d, GESTURE_EXT_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
230 fprintf (stderr, "[UTILX] no Gesture extension. \n");
233 extinfo->req_func = _EvlogRequestGesture;
234 extinfo->evt_func = _EvlogEventGesture;
236 ExtensionEntry *xext = CheckExtension (GESTURE_EXT_NAME);
237 RETURN_IF_FAIL (xext != NULL);
239 extinfo->opcode = xext->base;
240 extinfo->evt_base = xext->eventBase;
241 extinfo->err_base = xext->errorBase;
242 extinfo->req_func = _EvlogRequestGesture;
243 extinfo->evt_func = _EvlogEventGesture;