1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
From 6c5ac8e2258c5d23d04f5799c0471b8404a717ec Mon Sep 17 00:00:00 2001
From: Fedora X Ninjas <x@fedoraproject.org>
Date: Tue, 29 Jun 2010 14:29:04 +1000
Subject: [PATCH 2/4] xkb: rename XkbFakeDeviceButton and XkbFakeDeviceMotion, move into xkbActions.c
The name XkbDDXFakeDeviceButton and XkbDDXFakeDeviceMotion is somewhat
misleading, there's no DDX involved in the game at all anymore.
This removes XkbFakeDeviceMotion and XkbFakeDeviceButton from the API where
it arguably shouldn't have been in the first place.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Conflicts:
xkb/xkbActions.c
---
include/xkbsrv.h | 13 -------
xkb/Makefile.am | 4 +--
xkb/ddxDevBtn.c | 69 --------------------------------------
xkb/ddxFakeMtn.c | 64 -----------------------------------
xkb/xkbActions.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++-------
5 files changed, 85 insertions(+), 162 deletions(-)
delete mode 100644 xkb/ddxDevBtn.c
delete mode 100644 xkb/ddxFakeMtn.c
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index de8ec90..c2da3f3 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -786,19 +786,6 @@ extern _X_EXPORT void XkbDDXUpdateDeviceIndicators(
CARD32 /* newState */
);
-extern _X_EXPORT void XkbDDXFakePointerMotion(
- DeviceIntPtr /* dev */,
- unsigned int /* flags */,
- int /* x */,
- int /* y */
-);
-
-extern _X_EXPORT void XkbDDXFakeDeviceButton(
- DeviceIntPtr /* dev */,
- Bool /* press */,
- int /* button */
-);
-
extern _X_EXPORT int XkbDDXTerminateServer(
DeviceIntPtr /* dev */,
KeyCode /* key */,
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
index b85ee8a..c88fbd0 100644
--- a/xkb/Makefile.am
+++ b/xkb/Makefile.am
@@ -6,11 +6,9 @@ AM_CFLAGS = $(DIX_CFLAGS) \
DDX_SRCS = \
ddxBeep.c \
ddxCtrls.c \
- ddxFakeMtn.c \
ddxLEDs.c \
ddxLoad.c \
- ddxList.c \
- ddxDevBtn.c
+ ddxList.c
DIX_SRCS = \
xkb.c \
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
deleted file mode 100644
index b8a1255..0000000
--- a/xkb/ddxDevBtn.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/************************************************************
-Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h"
-#include <xkbsrv.h>
-#include "mi.h"
-
-void
-XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
-{
- EventListPtr events;
- int nevents, i;
- DeviceIntPtr ptr;
-
- /* If dev is a slave device, and the SD is attached, do nothing. If we'd
- * post through the attached master pointer we'd get duplicate events.
- *
- * if dev is a master keyboard, post through the XTEST device
- *
- * if dev is a floating slave, post through the device itself.
- */
-
- if (IsMaster(dev))
- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
- else if (!dev->u.master)
- ptr = dev;
- else
- return;
-
- events = InitEventList(GetMaximumEventsNum());
- OsBlockSignals();
- nevents = GetPointerEvents(events, ptr,
- press ? ButtonPress : ButtonRelease, button,
- 0 /* flags */, 0 /* first */,
- 0 /* num_val */, NULL);
- OsReleaseSignals();
-
- for (i = 0; i < nevents; i++)
- mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
-
- FreeEventList(events, GetMaximumEventsNum());
-}
diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c
deleted file mode 100644
index b383716..0000000
--- a/xkb/ddxFakeMtn.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/************************************************************
-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h"
-#include <xkbsrv.h>
-#include "mi.h"
-
-void
-XkbDDXFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
-{
- EventListPtr events;
- int nevents, i;
- DeviceIntPtr ptr;
- int gpe_flags = 0;
-
- if (!dev->u.master)
- ptr = dev;
- else
- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
-
- if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
- gpe_flags = POINTER_ABSOLUTE;
- else
- gpe_flags = POINTER_RELATIVE;
-
- events = InitEventList(GetMaximumEventsNum());
- OsBlockSignals();
- nevents = GetPointerEvents(events, ptr,
- MotionNotify, 0,
- gpe_flags, 0, 2, (int[]){x, y});
- OsReleaseSignals();
-
- for (i = 0; i < nevents; i++)
- mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
-
- FreeEventList(events, GetMaximumEventsNum());
-}
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 663f033..8d70a55 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -40,11 +40,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h>
#include "xkb.h"
#include <ctype.h>
+#include "mi.h"
#define EXTENSION_EVENT_BASE 64
static int xkbDevicePrivateKeyIndex;
DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKeyIndex;
+static void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button);
+static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y);
+
void
xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
pointer data)
@@ -479,7 +483,7 @@ int dx,dy;
dx= xkbi->mouseKeysDX;
dy= xkbi->mouseKeysDY;
}
- XkbDDXFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy);
+ XkbFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy);
return xkbi->desc->ctrls->mk_interval;
}
@@ -507,7 +511,7 @@ Bool accel;
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
x= XkbPtrActionX(&pAction->ptr);
y= XkbPtrActionY(&pAction->ptr);
- XkbDDXFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y);
+ XkbFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y);
AccessXCancelRepeatKey(xkbi,keycode);
xkbi->mouseKeysAccel= accel&&
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
@@ -554,7 +558,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
((pAction->btn.flags&XkbSA_LockNoLock)==0)) {
xkbi->lockedPtrButtons|= (1<<button);
AccessXCancelRepeatKey(xkbi,keycode);
- XkbDDXFakeDeviceButton(xkbi->device, 1, button);
+ XkbFakeDeviceButton(xkbi->device, 1, button);
filter->upAction.type= XkbSA_NoAction;
}
break;
@@ -565,12 +569,12 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
if (pAction->btn.count>0) {
nClicks= pAction->btn.count;
for (i=0;i<nClicks;i++) {
- XkbDDXFakeDeviceButton(xkbi->device, 1, button);
- XkbDDXFakeDeviceButton(xkbi->device, 0, button);
+ XkbFakeDeviceButton(xkbi->device, 1, button);
+ XkbFakeDeviceButton(xkbi->device, 0, button);
}
filter->upAction.type= XkbSA_NoAction;
}
- else XkbDDXFakeDeviceButton(xkbi->device, 1, button);
+ else XkbFakeDeviceButton(xkbi->device, 1, button);
}
break;
case XkbSA_SetPtrDflt:
@@ -626,7 +630,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
}
xkbi->lockedPtrButtons&= ~(1<<button);
case XkbSA_PtrBtn:
- XkbDDXFakeDeviceButton(xkbi->device, 0, button);
+ XkbFakeDeviceButton(xkbi->device, 0, button);
break;
}
filter->active = 0;
@@ -964,7 +968,7 @@ int button;
if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
BitIsOn(dev->button->down, button))
return 0;
- XkbDDXFakeDeviceButton(dev,True,button);
+ XkbFakeDeviceButton(dev,TRUE,button);
filter->upAction.type= XkbSA_NoAction;
break;
case XkbSA_DeviceBtn:
@@ -972,12 +976,12 @@ int button;
int nClicks,i;
nClicks= pAction->btn.count;
for (i=0;i<nClicks;i++) {
- XkbDDXFakeDeviceButton(dev,True,button);
- XkbDDXFakeDeviceButton(dev,False,button);
+ XkbFakeDeviceButton(dev,TRUE,button);
+ XkbFakeDeviceButton(dev,FALSE,button);
}
filter->upAction.type= XkbSA_NoAction;
}
- else XkbDDXFakeDeviceButton(dev,True,button);
+ else XkbFakeDeviceButton(dev,TRUE,button);
break;
}
}
@@ -996,10 +1000,10 @@ int button;
if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
!BitIsOn(dev->button->down, button))
return 0;
- XkbDDXFakeDeviceButton(dev,False,button);
+ XkbFakeDeviceButton(dev,FALSE,button);
break;
case XkbSA_DeviceBtn:
- XkbDDXFakeDeviceButton(dev,False,button);
+ XkbFakeDeviceButton(dev,FALSE,button);
break;
}
filter->active = 0;
@@ -1317,3 +1321,70 @@ xkbStateNotify sn;
return;
}
+static void
+XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
+{
+ EventListPtr events;
+ int nevents, i;
+ DeviceIntPtr ptr;
+ int gpe_flags = 0;
+
+ if (!dev->u.master)
+ ptr = dev;
+ else
+ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+
+ if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
+ gpe_flags = POINTER_ABSOLUTE;
+ else
+ gpe_flags = POINTER_RELATIVE;
+
+ events = InitEventList(GetMaximumEventsNum());
+ OsBlockSignals();
+ nevents = GetPointerEvents(events, ptr,
+ MotionNotify, 0,
+ gpe_flags, 0, 2, (int[]){x, y});
+ OsReleaseSignals();
+
+ for (i = 0; i < nevents; i++)
+ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
+
+ FreeEventList(events, GetMaximumEventsNum());
+}
+
+static void
+XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
+{
+ EventListPtr events;
+ int nevents, i;
+ DeviceIntPtr ptr;
+
+ /* If dev is a slave device, and the SD is attached, do nothing. If we'd
+ * post through the attached master pointer we'd get duplicate events.
+ *
+ * if dev is a master keyboard, post through the XTEST device
+ *
+ * if dev is a floating slave, post through the device itself.
+ */
+
+ if (IsMaster(dev))
+ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+ else if (!dev->u.master)
+ ptr = dev;
+ else
+ return;
+
+ events = InitEventList(GetMaximumEventsNum());
+ OsBlockSignals();
+ nevents = GetPointerEvents(events, ptr,
+ press ? ButtonPress : ButtonRelease, button,
+ 0 /* flags */, 0 /* first */,
+ 0 /* num_val */, NULL);
+ OsReleaseSignals();
+
+
+ for (i = 0; i < nevents; i++)
+ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
+
+ FreeEventList(events, GetMaximumEventsNum());
+}
--
1.7.1
|