summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-07-21 15:23:37 -0400
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-07-21 15:23:37 -0400
commit60ea7b51fe2b8a19a08b63db48504971a7a50ee6 (patch)
tree2fa67d1b032ece292b835373489c5794bb3dd196
parentd32dc8bf19e1071fc30af2f0bc6a6699b351f39e (diff)
xorg ddx: move to new input API, remove old keyboard driver
Remove most of the rest of the old keyboard driver. Move to the new Get{Keyboard,Pointer}Events API, which is mostly complete at this stage: just missing the proximity events.
-rw-r--r--hw/xfree86/common/xf86Config.c9
-rw-r--r--hw/xfree86/common/xf86Cursor.c5
-rw-r--r--hw/xfree86/common/xf86DGA.c4
-rw-r--r--hw/xfree86/common/xf86Debug.c2
-rw-r--r--hw/xfree86/common/xf86Events.c758
-rw-r--r--hw/xfree86/common/xf86Globals.c3
-rw-r--r--hw/xfree86/common/xf86Helper.c13
-rw-r--r--hw/xfree86/common/xf86Init.c84
-rw-r--r--hw/xfree86/common/xf86Io.c310
-rw-r--r--hw/xfree86/common/xf86MiscExt.c2
-rw-r--r--hw/xfree86/common/xf86Priv.h3
-rw-r--r--hw/xfree86/common/xf86Privstr.h5
-rw-r--r--hw/xfree86/common/xf86Xinput.c1126
-rw-r--r--hw/xfree86/common/xf86Xinput.h17
-rw-r--r--hw/xfree86/loader/xf86sym.c6
15 files changed, 380 insertions, 1967 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index b932908d7..16591be7c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1136,7 +1136,6 @@ configInputKbd(IDevPtr inputp)
xf86Info.kbdDelay = 500;
xf86Info.kbdRate = 30;
- xf86Info.kbdProc = NULL;
xf86Info.vtinit = NULL;
xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
#if defined(SVR4) && defined(i386)
@@ -1172,8 +1171,6 @@ configInputKbd(IDevPtr inputp)
s = xf86SetStrOption(inputp->commonOptions, "Protocol", kbdproto);
if (xf86NameCmp(s, "standard") == 0) {
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86KbdEvents;
xfree(s);
} else if (xf86NameCmp(s, "xqueue") == 0) {
#ifdef __UNIXWARE__
@@ -1181,20 +1178,14 @@ configInputKbd(IDevPtr inputp)
* To retain compatibility with older config files, on UnixWare, we
* accept the xqueue protocol but use the normal keyboard procs.
*/
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86KbdEvents;
#else
#ifdef XQUEUE
- xf86Info.kbdProc = xf86XqueKbdProc;
- xf86Info.kbdEvents = xf86XqueEvents;
xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
#endif
#endif
xfree(s);
#ifdef WSCONS_SUPPORT
} else if (xf86NameCmp(s, "wskbd") == 0) {
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86WSKbdEvents;
xfree(s);
s = xf86SetStrOption(inputp->commonOptions, "Device", NULL);
xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n");
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 787c39de8..61ce57d2b 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -78,14 +78,9 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = {
xf86CursorOffScreen,
xf86CrossScreen,
xf86WarpCursor,
-#ifdef XINPUT
- xf86eqEnqueue,
- xf86eqSwitchScreen
-#else
/* let miPointerInitialize take care of these */
NULL,
NULL
-#endif
};
static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 53186ea3b..807a94c03 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -923,7 +923,7 @@ DGAStealKeyEvent(int index, xEvent *e)
de.u.u.type = e->u.u.type + *XDGAEventBase;
de.u.u.detail = e->u.u.detail;
de.u.event.time = e->u.keyButtonPointer.time;
- xf86eqEnqueue ((xEvent *) &de);
+ mieqEnqueue ((xEvent *) &de);
return TRUE;
}
@@ -960,7 +960,7 @@ DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
de.u.event.dy = dy;
de.u.event.pad1 = DGAMouseX;
de.u.event.pad2 = DGAMouseY;
- xf86eqEnqueue ((xEvent *) &de);
+ mieqEnqueue ((xEvent *) &de);
return TRUE;
}
diff --git a/hw/xfree86/common/xf86Debug.c b/hw/xfree86/common/xf86Debug.c
index 5579cde5b..e624e7122 100644
--- a/hw/xfree86/common/xf86Debug.c
+++ b/hw/xfree86/common/xf86Debug.c
@@ -164,6 +164,7 @@ void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v)
}
+#if 0
_X_EXPORT void
xf86STimestamp(xf86TsPtr* timestamp)
{
@@ -195,3 +196,4 @@ xf86SPTimestamp(xf86TsPtr* timestamp, char *str)
gettimeofday((struct timeval*)*timestamp,NULL);
}
}
+#endif
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 831c68ad8..cc2ce9b4b 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -104,11 +104,7 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
-#ifdef XINPUT
-#define __EqEnqueue(ev) xf86eqEnqueue(ev)
-#else
#define __EqEnqueue(ev) mieqEnqueue(ev)
-#endif
#define EqEnqueue(ev) { \
int __sigstate = xf86BlockSIGIO (); \
@@ -253,11 +249,7 @@ ProcessInputEvents ()
xf86Info.inputPending = FALSE;
-#ifdef XINPUT
- xf86eqProcessInputEvents();
-#else
mieqProcessInputEvents();
-#endif
miPointerUpdate();
miPointerPosition(&x, &y);
@@ -403,679 +395,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
}
}
-/*
- * xf86PostKbdEvent --
- * Translate the raw hardware KbdEvent into an XEvent, and tell DIX
- * about it. Scancode preprocessing and so on is done ...
- *
- * OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c
- * as some things differ, and I did not want to scatter this routine with
- * ifdefs further (hv).
- */
-
-#ifdef __linux__
-extern u_char SpecialServerMap[];
-#endif
-
-#if !defined(__UNIXOS2__)
-void
-xf86PostKbdEvent(unsigned key)
-{
- int scanCode = (key & 0x7f);
- int specialkey = 0;
- Bool down = (key & 0x80 ? FALSE : TRUE);
- KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
- Bool updateLeds = FALSE;
- Bool UsePrefix = FALSE;
- Bool Direction = FALSE;
- xEvent kevent;
- KeySym *keysym;
- int keycode;
- static int lockkeys = 0;
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- static Bool first_time = TRUE;
-#endif
-#if defined(__sparc__) && defined(__linux__)
- static int kbdSun = -1;
-#endif
- /* Disable any keyboard processing while in suspend */
- if (xf86inSuspend)
- return;
-
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- if (first_time)
- {
- first_time = FALSE;
- VTSwitchEnabled = (xf86Info.consType == SYSCONS)
- || (xf86Info.consType == PCVT);
- }
-#endif
-
-#if defined (__sparc__) && defined(__linux__)
- if (kbdSun == -1) {
- if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
- || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
- kbdSun = 1;
- else
- kbdSun = 0;
- }
- if (kbdSun)
- goto special;
-#endif /* __sparc__ && __linux__ */
-
-#ifdef __linux__
- if (xf86Info.kbdCustomKeycodes) {
- specialkey = SpecialServerMap[scanCode];
- goto customkeycodes;
- }
-#endif
-
- /*
- * First do some special scancode remapping ...
- */
- if (xf86Info.scanPrefix == 0) {
-
- switch (scanCode) {
- case KEY_Prefix0:
- case KEY_Prefix1:
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT
-#ifdef WSCONS_SUPPORT
- || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents)
-#endif
- ) {
-#endif
- xf86Info.scanPrefix = scanCode; /* special prefixes */
- return;
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- }
- break;
-#endif
- }
-#if defined (i386) && defined (SVR4)
- /*
- * PANIX returns DICOP standards based keycodes in using 106jp
- * keyboard. We need to remap some keys.
- */
- if(xf86Info.panix106 == TRUE){
- switch (scanCode) {
- case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */
- case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/
- case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */
- case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */
- case 0x6B: scanCode = KEY_Left; break; /* Cur Left */
- case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */
- case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */
- case 0x73: scanCode = KEY_RCtrl; break; /* not needed */
- }
- } else
-#endif /* i386 && SVR4 */
- {
- switch (scanCode) {
- case 0x59: scanCode = KEY_0x59; break;
- case 0x5a: scanCode = KEY_0x5A; break;
- case 0x5b: scanCode = KEY_0x5B; break;
- case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */
- case 0x5d: scanCode = KEY_0x5D; break;
- case 0x5e: scanCode = KEY_0x5E; break;
- case 0x5f: scanCode = KEY_0x5F; break;
- case 0x62: scanCode = KEY_0x62; break;
- case 0x63: scanCode = KEY_0x63; break;
- case 0x64: scanCode = KEY_0x64; break;
- case 0x65: scanCode = KEY_0x65; break;
- case 0x66: scanCode = KEY_0x66; break;
- case 0x67: scanCode = KEY_0x67; break;
- case 0x68: scanCode = KEY_0x68; break;
- case 0x69: scanCode = KEY_0x69; break;
- case 0x6a: scanCode = KEY_0x6A; break;
- case 0x6b: scanCode = KEY_0x6B; break;
- case 0x6c: scanCode = KEY_0x6C; break;
- case 0x6d: scanCode = KEY_0x6D; break;
- case 0x6e: scanCode = KEY_0x6E; break;
- case 0x6f: scanCode = KEY_0x6F; break;
- case 0x70: scanCode = KEY_0x70; break;
- case 0x71: scanCode = KEY_0x71; break;
- case 0x72: scanCode = KEY_0x72; break;
- case 0x73: scanCode = KEY_0x73; break;
- case 0x74: scanCode = KEY_0x74; break;
- case 0x75: scanCode = KEY_0x75; break;
- case 0x76: scanCode = KEY_0x76; break;
- }
- }
- }
-
- else if (
-#ifdef CSRG_BASED
- (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT
-#ifdef WSCONS_SUPPORT
- || (xf86Info.consType == WSCONS && xf86Info.kbdEvents !=
- xf86WSKbdEvents)
-#endif
- ) &&
-#endif
- (xf86Info.scanPrefix == KEY_Prefix0)) {
- xf86Info.scanPrefix = 0;
-
- switch (scanCode) {
- case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */
- case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */
- case 0x5b: scanCode = KEY_LMeta; break;
- case 0x5c: scanCode = KEY_RMeta; break;
- case 0x5d: scanCode = KEY_Menu; break;
- case KEY_F3: scanCode = KEY_F13; break;
- case KEY_F4: scanCode = KEY_F14; break;
- case KEY_F5: scanCode = KEY_F15; break;
- case KEY_F6: scanCode = KEY_F16; break;
- case KEY_F7: scanCode = KEY_F17; break;
- case KEY_KP_Plus: scanCode = KEY_KP_DEC; break;
- /*
- * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
- */
- case 0x2A:
- case 0x36:
- return;
- default:
- xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
- scanCode);
- /*
- * "Internet" keyboards are generating lots of new codes. Let them
- * pass. There is little consistency between them, so don't bother
- * with symbolic names at this level.
- */
- scanCode += 0x78;
- }
- }
-
- else if (xf86Info.scanPrefix == KEY_Prefix1)
- {
- xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
- return;
- }
-
- else if (xf86Info.scanPrefix == KEY_LCtrl)
- {
- xf86Info.scanPrefix = 0;
- if (scanCode != KEY_NumLock) return;
- scanCode = KEY_Pause; /* pause */
- }
-
-#ifndef __sparc64__
- /*
- * PC keyboards generate separate key codes for
- * Alt+Print and Control+Pause but in the X keyboard model
- * they need to get the same key code as the base key on the same
- * physical keyboard key.
- */
- if (scanCode == KEY_SysReqest)
- scanCode = KEY_Print;
- else if (scanCode == KEY_Break)
- scanCode = KEY_Pause;
-#endif
-
- /*
- * and now get some special keysequences
- */
-
- specialkey = scanCode;
-
-#ifdef __linux__
-customkeycodes:
-#endif
-#if defined(i386) || defined(__i386__)
- if (xf86IsPc98()) {
- switch (scanCode) {
- case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */
- case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */
- case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */
-
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
-
- case 0x62: specialkey = 0x3b; break; /* KEY_F1 */
- case 0x63: specialkey = 0x3c; break; /* KEY_F2 */
- case 0x64: specialkey = 0x3d; break; /* KEY_F3 */
- case 0x65: specialkey = 0x3e; break; /* KEY_F4 */
- case 0x66: specialkey = 0x3f; break; /* KEY_F5 */
- case 0x67: specialkey = 0x40; break; /* KEY_F6 */
- case 0x68: specialkey = 0x41; break; /* KEY_F7 */
- case 0x69: specialkey = 0x42; break; /* KEY_F8 */
- case 0x6a: specialkey = 0x43; break; /* KEY_F9 */
- case 0x6b: specialkey = 0x44; break; /* KEY_F10 */
- /* case 0x73: specialkey = 0x38; break; KEY_Alt */
- /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */
- default: specialkey = 0x00; break;
- }
- }
-#endif
-#if defined (__sparc__) && defined(__linux__)
-special:
- if (kbdSun) {
- switch (scanCode) {
- case 0x2b: specialkey = KEY_BackSpace; break;
- case 0x47: specialkey = KEY_KP_Minus; break;
- case 0x7d: specialkey = KEY_KP_Plus; break;
-
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
-
- case 0x05: specialkey = KEY_F1; break;
- case 0x06: specialkey = KEY_F2; break;
- case 0x08: specialkey = KEY_F3; break;
- case 0x0a: specialkey = KEY_F4; break;
- case 0x0c: specialkey = KEY_F5; break;
- case 0x0e: specialkey = KEY_F6; break;
- case 0x10: specialkey = KEY_F7; break;
- case 0x11: specialkey = KEY_F8; break;
- case 0x12: specialkey = KEY_F9; break;
- case 0x07: specialkey = KEY_F10; break;
- case 0x09: specialkey = KEY_F11; break;
- case 0x0b: specialkey = KEY_F12; break;
- default: specialkey = 0; break;
- }
- /*
- * XXX XXX XXX:
- *
- * I really don't know what's wrong here, but passing the real
- * scanCode offsets by one from XKB's point of view.
- *
- * (ecd@skynet.be, 980405)
- */
- scanCode--;
- }
-#endif /* defined (__sparc__) && defined(__linux__) */
-
-#ifdef XKB
- if ((xf86Info.ddxSpecialKeys == SKWhenNeeded &&
- !xf86Info.ActionKeyBindingsSet) ||
- noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) {
-#endif
- if (!(ModifierDown(ShiftMask)) &&
- ((ModifierDown(ControlMask | AltMask)) ||
- (ModifierDown(ControlMask | AltLangMask))))
- {
- switch (specialkey) {
-
- case KEY_BackSpace:
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
- break;
-
- /*
- * Check grabs
- */
- case KEY_KP_Divide:
- xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
- break;
- case KEY_KP_Multiply:
- xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
- break;
-
- /*
- * Video mode switches
- */
- case KEY_KP_Minus: /* Keypad - */
- if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- case KEY_KP_Plus: /* Keypad + */
- if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- /* Under QNX4, we set the vtPending flag for VT switching and
- * let the VT switch function do the rest...
- * This is a little different from the other OS'es.
- */
-#if defined(QNX4)
- case KEY_1:
- case KEY_2:
- case KEY_3:
- case KEY_4:
- case KEY_5:
- case KEY_6:
- case KEY_7:
- case KEY_8:
- case KEY_9:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
- if (down) {
- int vtno = specialkey - KEY_1 + 1;
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- }
- return;
- }
- break;
-#endif
-
-#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(__SCO__) || defined(__UNIXWARE__)
- /*
- * Under Linux, the raw keycodes are consumed before the kernel
- * does any processing on them, so we must emulate the vt switching
- * we want ourselves.
- */
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- case KEY_F11:
- case KEY_F12:
- if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
-#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)))
- && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
-#endif
- ) {
- int vtno = specialkey - KEY_F1 + 1;
- if (specialkey == KEY_F11 || specialkey == KEY_F12)
- vtno = specialkey - KEY_F11 + 11;
- if (down)
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- return;
- }
- break;
-#endif /* linux || BSD with VTs */
-
- /* just worth mentioning here: any 386bsd keyboard driver
- * (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC
- * before any application (e.g. XF86) will see it
- * OBS: syscons does not, nor does pcvt !
- */
- }
- }
-
- /*
- * Start of actual Solaris VT switching code.
- * This should pretty much emulate standard SVR4 switching keys.
- *
- * DWH 12/2/93
- */
-
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
- {
- switch (specialkey)
- {
- /*
- * syscons on *BSD doesn't have a VT #0 -- don't think Linux does
- * either
- */
-#if defined (sun) && defined (i386) && defined (SVR4)
- case KEY_H:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL);
- VTSysreqToggle = 0;
- return;
- }
- break;
-
- /*
- * Yah, I know the N, and P keys seem backwards, however that's
- * how they work under Solaris
- * XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1)
- */
-
- case KEY_N:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
- case KEY_P:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-#endif
-
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down)
- { int vtno = specialkey - KEY_F1 + 1;
- if (specialkey == KEY_F11 || specialkey == KEY_F12)
- vtno = specialkey - KEY_F11 + 11;
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
-
- case KEY_SysReqest:
- if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask)))
- VTSysreqToggle = TRUE;
- break;
-
- default:
- if (VTSysreqToggle)
- {
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- VTSysreqToggle = FALSE;
-
- }
- }
- }
-
-#endif /* USE_VT_SYSREQ */
-
-#ifdef __SCO__
- /*
- * With the console in raw mode, SCO will not switch consoles,
- * you get around this by activating the next console along, if
- * this fails then go back to console 0, if there is only one
- * then it doesn't matter, switching to yourself is a nop as far
- * as the console driver is concerned.
- * We could do something similar to linux here but SCO ODT uses
- * Ctrl-PrintScrn, so why change?
- */
- if (specialkey == KEY_Print && ModifierDown(ControlMask)) {
- if (down)
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- return;
- }
-#endif /* __SCO__ */
-#ifdef XKB
- }
-#endif
-
- /*
- * Now map the scancodes to real X-keycodes ...
- */
- keycode = scanCode + MIN_KEYCODE;
- keysym = (keyc->curKeySyms.map +
- keyc->curKeySyms.mapWidth *
- (keycode - keyc->curKeySyms.minKeyCode));
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- /*
- * Filter autorepeated caps/num/scroll lock keycodes.
- */
-#define CAPSFLAG 0x01
-#define NUMFLAG 0x02
-#define SCROLLFLAG 0x04
-#define MODEFLAG 0x08
- if( down ) {
- switch( keysym[0] ) {
- case XK_Caps_Lock :
- if (lockkeys & CAPSFLAG)
- return;
- else
- lockkeys |= CAPSFLAG;
- break;
-
- case XK_Num_Lock :
- if (lockkeys & NUMFLAG)
- return;
- else
- lockkeys |= NUMFLAG;
- break;
-
- case XK_Scroll_Lock :
- if (lockkeys & SCROLLFLAG)
- return;
- else
- lockkeys |= SCROLLFLAG;
- break;
- }
- if (keysym[1] == XF86XK_ModeLock)
- {
- if (lockkeys & MODEFLAG)
- return;
- else
- lockkeys |= MODEFLAG;
- }
-
- }
- else {
- switch( keysym[0] ) {
- case XK_Caps_Lock :
- lockkeys &= ~CAPSFLAG;
- break;
-
- case XK_Num_Lock :
- lockkeys &= ~NUMFLAG;
- break;
-
- case XK_Scroll_Lock :
- lockkeys &= ~SCROLLFLAG;
- break;
- }
- if (keysym[1] == XF86XK_ModeLock)
- lockkeys &= ~MODEFLAG;
- }
-
- /*
- * LockKey special handling:
- * ignore releases, toggle on & off on presses.
- * Don't deal with the Caps_Lock keysym directly, but check the lock modifier
- */
- if (keyc->modifierMap[keycode] & LockMask ||
- keysym[0] == XK_Scroll_Lock ||
- keysym[1] == XF86XK_ModeLock ||
- keysym[0] == XK_Num_Lock)
- {
- Bool flag;
-
- if (!down) return;
- if (KeyPressed(keycode)) {
- down = !down;
- flag = FALSE;
- }
- else
- flag = TRUE;
-
- if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag;
- if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag;
- if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag;
- if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag;
- updateLeds = TRUE;
- }
-
- if (!xf86Info.kbdCustomKeycodes) {
- /*
- * normal, non-keypad keys
- */
- if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
-#if !defined(CSRG_BASED) && \
- !defined(__GNU__) && \
- defined(KB_84)
- /*
- * magic ALT_L key on AT84 keyboards for multilingual support
- */
- if (xf86Info.kbdType == KB_84 &&
- ModifierDown(AltMask) &&
- keysym[2] != NoSymbol)
- {
- UsePrefix = TRUE;
- Direction = TRUE;
- }
-#endif /* !CSRG_BASED && ... */
- }
- }
- if (updateLeds) xf86UpdateKbdLeds();
-#ifdef XKB
- }
-#endif
-
- /*
- * check for an autorepeat-event
- */
- if (down && KeyPressed(keycode)) {
- KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed;
- if ((xf86Info.autoRepeat != AutoRepeatModeOn) ||
- keyc->modifierMap[keycode] ||
- (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) ))))
- return;
- }
-
-
- xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis();
- /*
- * And now send these prefixes ...
- * NOTE: There cannot be multiple Mode_Switch keys !!!!
- */
- if (UsePrefix)
- {
- ENQUEUE(&kevent,
- keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
- (Direction ? KeyPress : KeyRelease),
- XE_KEYBOARD);
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
- ENQUEUE(&kevent,
- keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
- (Direction ? KeyRelease : KeyPress),
- XE_KEYBOARD);
- }
- else
- {
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
- }
-}
-#endif /* !__UNIXOS2__ */
-
#define ModifierIsSet(k) ((modifiers & (k)) == (k))
_X_EXPORT Bool
@@ -1137,8 +456,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
if (XFD_ANYSET(&devicesWithInput)) {
- if (xf86Info.kbdEvents)
- (xf86Info.kbdEvents)();
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0 &&
@@ -1161,8 +478,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
InputInfoPtr pInfo;
- (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */
-
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0) {
@@ -1470,6 +785,67 @@ xf86SigMemDebug(int signo)
}
#endif
+static void
+xf86ReleaseKeys(DeviceIntPtr pDev)
+{
+ KeyClassPtr keyc = NULL;
+ KeySym *map = NULL;
+ xEvent *events = NULL, ke;
+ int i = 0, j = 0, nevents = 0;
+
+ ErrorF("releasekeys: called on device %s (%d)\n", pDev->name, pDev->id);
+
+ if (!pDev || !pDev->key)
+ return;
+
+ keyc = pDev->key;
+ map = keyc->curKeySyms.map;
+
+ /*
+ * Hmm... here is the biggest hack of every time !
+ * It may be possible that a switch-vt procedure has finished BEFORE
+ * you released all keys neccessary to do this. That peculiar behavior
+ * can fool the X-server pretty much, cause it assumes that some keys
+ * were not released. TWM may stuck alsmost completly....
+ * OK, what we are doing here is after returning from the vt-switch
+ * exeplicitely unrelease all keyboard keys before the input-devices
+ * are reenabled.
+ */
+
+ for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
+ i < keyc->curKeySyms.maxKeyCode;
+ i++, map += keyc->curKeySyms.mapWidth) {
+ ErrorF("key %d: pressed is %s\n", i, KeyPressed(i) ? "true" : "false");
+ if (KeyPressed(i)) {
+ switch (*map) {
+ /* Don't release the lock keys */
+ case XK_Caps_Lock:
+ case XK_Shift_Lock:
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Kana_Lock:
+ break;
+ default:
+ if (pDev == inputInfo.keyboard) {
+ ke.u.keyButtonPointer.time = GetTimeInMillis();
+ ke.u.keyButtonPointer.rootX = 0;
+ ke.u.keyButtonPointer.rootY = 0;
+ ke.u.u.type = KeyRelease;
+ ke.u.u.detail = i;
+ (*pDev->public.processInputProc) (&ke, pDev, 1);
+ }
+ else {
+ nevents = GetKeyboardEvents(&events, pDev, KeyRelease, i);
+ ErrorF("device %s: got %d events for %d key\n", pDev->name, nevents, i);
+ for (j = 0; j < nevents; j++)
+ mieqEnqueue(events++);
+ }
+ break;
+ }
+ }
+ }
+}
+
/*
* xf86VTSwitch --
* Handle requests for switching the vt.
@@ -1515,7 +891,6 @@ xf86VTSwitch()
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
- DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);
@@ -1556,12 +931,14 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
#if !defined(__UNIXOS2__)
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86ReleaseKeys(pInfo->dev);
EnableDevice(pInfo->dev);
pInfo = pInfo->next;
}
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -1618,12 +995,14 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
#if !defined(__UNIXOS2__)
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86ReleaseKeys(pInfo->dev);
EnableDevice(pInfo->dev);
pInfo = pInfo->next;
}
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
@@ -1745,9 +1124,6 @@ xf86ReloadInputDevs(int sig)
signal(sig, (void(*)(int))xf86ReloadInputDevs);
- DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
-
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 1e0ac7996..ab73c6c92 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -94,9 +94,6 @@ InputInfoPtr xf86InputDevs = NULL;
/* Globals that video drivers may not access */
xf86InfoRec xf86Info = {
- NULL, /* pKeyboard */
- NULL, /* kbdProc */
- NULL, /* kbdEvents */
-1, /* consoleFd */
-1, /* kbdFd */
-1, /* vtno */
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 05ac5709c..6c2cefbab 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -155,6 +155,19 @@ xf86LookupInputDriver(const char *name)
return NULL;
}
+InputInfoPtr
+xf86LookupInput(const char *name)
+{
+ InputInfoPtr p;
+
+ for (p = xf86InputDevs; p != NULL; p = p->next) {
+ if (strcmp(name, p->name) == 0)
+ return p;
+ }
+
+ return NULL;
+}
+
_X_EXPORT void
xf86AddModuleInfo(ModuleInfoPtr info, pointer module)
{
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 6defa9465..e2622e346 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1006,18 +1006,6 @@ InitInput(argc, argv)
if (serverGeneration == 1) {
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* XXX The keyboard driver is a special case for now. */
- if (!xf86NameCmp(pDev->driver, "keyboard")) {
- xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n");
- xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n");
- xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n",
- pDev->identifier);
-
- continue;
- }
-#endif
-
if ((pDrv = xf86LookupInputDriver(pDev->driver)) == NULL) {
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
/* XXX For now, just continue. */
@@ -1040,80 +1028,18 @@ InitInput(argc, argv)
xf86DeleteInput(pInfo, 0);
continue;
}
- if (pInfo->flags & XI86_CORE_KEYBOARD) {
- if (coreKeyboard) {
- xf86Msg(X_ERROR,
- "Attempt to register more than one core keyboard (%s)\n",
- pInfo->name);
- pInfo->flags &= ~XI86_CORE_KEYBOARD;
- } else {
- if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
- /* XXX just a warning for now */
- xf86Msg(X_WARNING,
- "%s: does not have core keyboard capabilities\n",
- pInfo->name);
- }
- coreKeyboard = pInfo;
- }
- }
- if (pInfo->flags & XI86_CORE_POINTER) {
- if (corePointer) {
- xf86Msg(X_ERROR,
- "Attempt to register more than one core pointer (%s)\n",
- pInfo->name);
- pInfo->flags &= ~XI86_CORE_POINTER;
- } else {
- if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
- /* XXX just a warning for now */
- xf86Msg(X_WARNING,
- "%s: does not have core pointer capabilities\n",
- pInfo->name);
- }
- corePointer = pInfo;
- }
- }
- }
- if (!corePointer) {
- xf86Msg(X_WARNING, "No core pointer registered\n");
- /* XXX register a dummy core pointer */
- }
-#ifdef NEW_KBD
- if (!coreKeyboard) {
- xf86Msg(X_WARNING, "No core keyboard registered\n");
- /* XXX register a dummy core keyboard */
}
-#endif
}
/* Initialise all input devices. */
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86Msg(X_INFO, "evaluating device (%s)\n", pInfo->name);
xf86ActivateDevice(pInfo);
pInfo = pInfo->next;
}
- if (coreKeyboard) {
- xf86Info.pKeyboard = coreKeyboard->dev;
- xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/
- }
- else {
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* Only set this if we're allowing the old driver. */
- if (xf86Info.kbdProc != NULL)
- xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
-#endif
- }
- if (corePointer)
- xf86Info.pMouse = corePointer->dev;
- if (xf86Info.pKeyboard)
- RegisterKeyboardDevice(xf86Info.pKeyboard);
-
- miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
-#ifdef XINPUT
- xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
-#else
- mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
-#endif
+ mieqInit();
}
#ifndef SET_STDERR_NONBLOCKING
@@ -1233,12 +1159,6 @@ AbortDDX()
int i;
/*
- * try to deinitialize all input devices
- */
- if (xf86Info.kbdProc && xf86Info.pKeyboard)
- (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
-
- /*
* try to restore the original video state
*/
#ifdef HAS_USL_VTS
diff --git a/hw/xfree86/common/xf86Io.c b/hw/xfree86/common/xf86Io.c
index 318b24584..d10ad4352 100644
--- a/hw/xfree86/common/xf86Io.c
+++ b/hw/xfree86/common/xf86Io.c
@@ -160,313 +160,3 @@ xf86KbdLeds ()
xf86SetKbdLeds(real_leds);
(void)leds;
}
-
-/*
- * xf86KbdCtrl --
- * Alter some of the keyboard control parameters. All special protocol
- * values are handled by dix (ProgChangeKeyboardControl)
- */
-
-void
-xf86KbdCtrl (pKeyboard, ctrl)
- DevicePtr pKeyboard; /* Keyboard to alter */
- KeybdCtrl *ctrl;
-{
- int leds;
- xf86Info.bell_pitch = ctrl->bell_pitch;
- xf86Info.bell_duration = ctrl->bell_duration;
- xf86Info.autoRepeat = ctrl->autoRepeat;
-
- xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE;
-
- leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds);
-#ifdef XKB
- } else {
- xf86Info.leds = leds;
- }
-#endif
-
- xf86KbdLeds();
-}
-
-/*
- * xf86InitKBD --
- * Reinitialize the keyboard. Only set Lockkeys according to ours leds.
- * Depress all other keys.
- */
-
-void
-xf86InitKBD(init)
-Bool init;
-{
- char leds = 0, rad;
- unsigned int i;
- xEvent kevent;
- DeviceIntPtr pKeyboard = xf86Info.pKeyboard;
- KeyClassRec *keyc = xf86Info.pKeyboard->key;
- KeySym *map = keyc->curKeySyms.map;
-
- kevent.u.keyButtonPointer.time = GetTimeInMillis();
- kevent.u.keyButtonPointer.rootX = 0;
- kevent.u.keyButtonPointer.rootY = 0;
-
- /*
- * Hmm... here is the biggest hack of every time !
- * It may be possible that a switch-vt procedure has finished BEFORE
- * you released all keys neccessary to do this. That peculiar behavior
- * can fool the X-server pretty much, cause it assumes that some keys
- * were not released. TWM may stuck alsmost completly....
- * OK, what we are doing here is after returning from the vt-switch
- * exeplicitely unrelease all keyboard keys before the input-devices
- * are reenabled.
- */
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth)
- if (KeyPressed(i))
- {
- switch (*map) {
- /* Don't release the lock keys */
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- break;
- default:
- kevent.u.u.detail = i;
- kevent.u.u.type = KeyRelease;
- (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1);
- }
- }
-
- xf86Info.scanPrefix = 0;
-
- if (init)
- {
- /*
- * we must deal here with the fact, that on some cases the numlock or
- * capslock key are enabled BEFORE the server is started up. So look
- * here at the state on the according LEDS to determine whether a
- * lock-key is already set.
- */
-
- xf86Info.capsLock = FALSE;
- xf86Info.numLock = FALSE;
- xf86Info.scrollLock = FALSE;
- xf86Info.modeSwitchLock = FALSE;
- xf86Info.composeLock = FALSE;
-
-#ifdef LED_CAP
-#ifdef INHERIT_LOCK_STATE
- leds = xf86Info.leds;
-
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth)
-
- switch(*map) {
-
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- if (leds & LED_CAP)
- {
- xf86InitialCaps = i;
- xf86Info.capsLock = TRUE;
- }
- break;
-
- case XK_Num_Lock:
- if (leds & LED_NUM)
- {
- xf86InitialNum = i;
- xf86Info.numLock = TRUE;
- }
- break;
-
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- if (leds & LED_SCR)
- {
- xf86InitialScroll = i;
- xf86Info.scrollLock = TRUE;
- }
- break;
- }
-#endif /* INHERIT_LOCK_STATE */
- xf86SetKbdLeds(leds);
-#endif /* LED_CAP */
- (void)leds;
-
- if (xf86Info.kbdDelay <= 375) rad = 0x00;
- else if (xf86Info.kbdDelay <= 625) rad = 0x20;
- else if (xf86Info.kbdDelay <= 875) rad = 0x40;
- else rad = 0x60;
-
- if (xf86Info.kbdRate <= 2) rad |= 0x1F;
- else if (xf86Info.kbdRate >= 30) rad |= 0x00;
- else rad |= ((58 / xf86Info.kbdRate) - 2);
-
- xf86SetKbdRepeat(rad);
- }
-}
-
-/*
- * xf86KbdProc --
- * Handle the initialization, etc. of a keyboard.
- */
-
-int
-xf86KbdProc (pKeyboard, what)
- DeviceIntPtr pKeyboard; /* Keyboard to manipulate */
- int what; /* What to do to it */
-{
- KeySymsRec keySyms;
- CARD8 modMap[MAP_LENGTH];
- int kbdFd;
-
- switch (what) {
-
- case DEVICE_INIT:
- /*
- * First open and find the current state of the keyboard.
- */
-
- xf86KbdInit();
-
- xf86KbdGetMapping(&keySyms, modMap);
-
-
-#ifndef XKB
- defaultKeyboardControl.leds = xf86GetKbdLeds();
-#else
- defaultKeyboardControl.leds = 0;
-#endif
-
- /*
- * Perform final initialization of the system private keyboard
- * structure and fill in various slots in the device record
- * itself which couldn't be filled in before.
- */
-
- pKeyboard->public.on = FALSE;
-
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-#ifdef XKB
- } else {
- XkbComponentNamesRec names;
- XkbDescPtr desc;
- Bool foundTerminate = FALSE;
- int keyc;
- if (xf86Info.xkbkeymap) {
- names.keymap = xf86Info.xkbkeymap;
- names.keycodes = NULL;
- names.types = NULL;
- names.compat = NULL;
- names.symbols = NULL;
- names.geometry = NULL;
- } else {
- names.keymap = NULL;
- names.keycodes = xf86Info.xkbkeycodes;
- names.types = xf86Info.xkbtypes;
- names.compat = xf86Info.xkbcompat;
- names.symbols = xf86Info.xkbsymbols;
- names.geometry = xf86Info.xkbgeometry;
- }
- if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
- && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
- xf86Info.xkbrules = NULL;
- }
- XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
- xf86Info.xkblayout, xf86Info.xkbvariant,
- xf86Info.xkboptions);
-
- XkbInitKeyboardDeviceStruct(pKeyboard,
- &names,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-
- /* Search keymap for Terminate action */
- desc = pKeyboard->key->xkbInfo->desc;
- for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) {
- int i;
- for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) {
- if (XkbKeyAction(desc, keyc, i)
- && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) {
- foundTerminate = TRUE;
- goto searchdone;
- }
- }
- }
-searchdone:
- xf86Info.ActionKeyBindingsSet = foundTerminate;
- if (!foundTerminate)
- xf86Msg(X_INFO, "Server_Terminate keybinding not found\n");
- }
-#endif
-
- xf86InitKBD(TRUE);
- break;
-
- case DEVICE_ON:
- /*
- * Set the keyboard into "direct" mode and turn on
- * event translation.
- */
-
- kbdFd = xf86KbdOn();
- /*
- * Discard any pending input after a VT switch to prevent the server
- * passing on parts of the VT switch sequence.
- */
- sleep(1);
-#if defined(WSCONS_SUPPORT)
- if (xf86Info.consType != WSCONS) {
-#endif
- if (kbdFd != -1) {
- char buf[16];
- read(kbdFd, buf, 16);
- }
-#if defined(WSCONS_SUPPORT)
- }
-#endif
-
-#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */
- if (kbdFd != -1)
- AddEnabledDevice(kbdFd);
-#endif /* __UNIXOS2__ */
-
- pKeyboard->public.on = TRUE;
- xf86InitKBD(FALSE);
- break;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- /*
- * Restore original keyboard directness and translation.
- */
-
- kbdFd = xf86KbdOff();
-
- if (kbdFd != -1)
- RemoveEnabledDevice(kbdFd);
-
- pKeyboard->public.on = FALSE;
- break;
-
- }
- return (Success);
-}
diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c
index bdb02cef0..3e741bae9 100644
--- a/hw/xfree86/common/xf86MiscExt.c
+++ b/hw/xfree86/common/xf86MiscExt.c
@@ -366,7 +366,7 @@ MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
InputInfoPtr pInfo = xf86InputDevs;
while (pInfo) {
- if (xf86IsCorePointer(pInfo->dev))
+ if (pInfo->dev == inputInfo.pointer)
break;
pInfo = pInfo->next;
}
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index f97bbb352..b4e531c9d 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -200,9 +200,6 @@ void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl,
int unused);
void xf86KbdLeds(void);
void xf86UpdateKbdLeds(void);
-void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl);
-void xf86InitKBD(Bool init);
-int xf86KbdProc(DeviceIntPtr pKeyboard, int what);
/* xf86Kbd.c */
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index a35de2065..c26e28867 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -68,11 +68,6 @@ typedef enum {
*/
typedef struct {
-
- /* keyboard part */
- DeviceIntPtr pKeyboard;
- DeviceProc kbdProc; /* procedure for initializing */
- void (* kbdEvents)(void); /* proc for processing events */
int consoleFd;
int kbdFd;
int vtno;
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 329dcba98..7c27e1f13 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -39,7 +39,6 @@
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
@@ -65,6 +64,7 @@
#include "xf86Xinput.h"
#ifdef XINPUT
#include "XIstubs.h"
+#include "xf86Optrec.h"
#endif
#include "mipointer.h"
#include "xf86InPriv.h"
@@ -75,10 +75,6 @@
#include "dpmsproc.h"
#endif
-#ifdef XFreeXDGA
-#include "dgaproc.h"
-#endif
-
#include "exevents.h" /* AddInputDevice */
#include "exglobals.h"
@@ -114,82 +110,17 @@ static int debug_level = 0;
#define DBG(lvl, f)
#endif
-/******************************************************************************
- * macros
- *****************************************************************************/
-#define ENQUEUE(e) xf86eqEnqueue((e))
-
-/***********************************************************************
- *
- * xf86AlwaysCoreControl --
- *
- * Control proc for the integer feedback that controls the always
- * core feature.
- *
- ***********************************************************************
- */
-static void
-xf86AlwaysCoreControl(DeviceIntPtr device,
- IntegerCtrl *control)
-{
-}
-
-/***********************************************************************
- *
- * Core devices functions --
- *
- * Test if device is the core device by checking the
- * value of always core feedback and the inputInfo struct.
- *
- ***********************************************************************
- */
-_X_EXPORT int
-xf86IsCorePointer(DeviceIntPtr device)
-{
- return(device == inputInfo.pointer);
-}
-
-static int
-xf86ShareCorePointer(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- return((local->always_core_feedback &&
- local->always_core_feedback->ctrl.integer_displayed));
-}
-
static Bool
xf86SendDragEvents(DeviceIntPtr device)
{
LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
if (inputInfo.pointer->button->buttonsDown > 0)
- return (local->flags & XI86_SEND_DRAG_EVENTS);
+ return (local->flags & XI86_SEND_DRAG_EVENTS);
else
- return (TRUE);
+ return (TRUE);
}
-int
-xf86IsCoreKeyboard(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- return((local->flags & XI86_ALWAYS_CORE) ||
- (device == inputInfo.keyboard));
-}
-
-_X_EXPORT void
-xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always)
-{
- if (always) {
- local->flags |= XI86_ALWAYS_CORE;
- } else {
- local->flags &= ~XI86_ALWAYS_CORE;
- }
-}
-
-static int xf86CoreButtonState;
-
/***********************************************************************
*
* xf86CheckButton --
@@ -201,23 +132,26 @@ static int xf86CoreButtonState;
*/
Bool
xf86CheckButton(int button,
- int down)
+ int down)
{
int check;
int bit = (1 << (button - 1));
+ /* XXX FIXME VERDAMMT */
+#if 0
check = xf86CoreButtonState & bit;
DBG(5, ErrorF("xf86CheckButton "
- "button=%d down=%d state=%d check=%d returns ",
- button, down, xf86CoreButtonState, check));
+ "button=%d down=%d state=%d check=%d returns ",
+ button, down, xf86CoreButtonState, check));
if ((check && down) || (!check && !down)) {
- DBG(5, ErrorF("FALSE\n"));
- return FALSE;
+ DBG(5, ErrorF("FALSE\n"));
+ return FALSE;
}
xf86CoreButtonState ^= bit;
DBG(5, ErrorF("TRUE\n"));
+#endif
return TRUE;
}
@@ -231,38 +165,35 @@ xf86CheckButton(int button,
*/
_X_EXPORT void
xf86ProcessCommonOptions(LocalDevicePtr local,
- pointer list)
+ pointer list)
{
- if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
- xf86SetBoolOption(list, "SendCoreEvents", 0)) {
- local->flags |= XI86_ALWAYS_CORE;
- xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
- }
-
- if (xf86SetBoolOption(list, "CorePointer", 0)) {
- local->flags |= XI86_CORE_POINTER;
- xf86Msg(X_CONFIG, "%s: Core Pointer\n", local->name);
- }
-
- if (xf86SetBoolOption(list, "CoreKeyboard", 0)) {
- local->flags |= XI86_CORE_KEYBOARD;
- xf86Msg(X_CONFIG, "%s: Core Keyboard\n", local->name);
+ if (!xf86SetBoolOption(list, "AlwaysCore", 0) ||
+ xf86SetBoolOption(list, "SendCoreEvents", 0) ||
+ xf86SetBoolOption(list, "CorePointer", 0) ||
+ xf86SetBoolOption(list, "CoreKeyboard", 0)) {
+ local->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
}
if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
- local->flags |= XI86_SEND_DRAG_EVENTS;
+ local->flags |= XI86_SEND_DRAG_EVENTS;
} else {
- xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
}
local->history_size = xf86SetIntOption(list, "HistorySize", 0);
if (local->history_size > 0) {
- xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
- local->history_size);
+ xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
+ local->history_size);
}
}
+void
+xf86AlwaysCoreControl(DeviceIntPtr pDev, IntegerCtrl *control)
+{
+}
+
/***********************************************************************
*
* xf86XinputFinalizeInit --
@@ -277,14 +208,11 @@ xf86XinputFinalizeInit(DeviceIntPtr dev)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- local->dxremaind = 0.0;
- local->dyremaind = 0.0;
-
if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) {
- ErrorF("Unable to init integer feedback for always core feature\n");
+ ErrorF("Unable to init integer feedback for always core feature\n");
} else {
- local->always_core_feedback = dev->intfeed;
- dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
+ local->always_core_feedback = dev->intfeed;
+ dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
}
}
@@ -302,42 +230,33 @@ xf86ActivateDevice(LocalDevicePtr local)
DeviceIntPtr dev;
if (local->flags & XI86_CONFIGURED) {
- int open_on_init;
-
- open_on_init = local->flags &
- (XI86_OPEN_ON_INIT |
- XI86_ALWAYS_CORE | XI86_CORE_POINTER | XI86_CORE_KEYBOARD);
-
- dev = AddInputDevice(local->device_control,
- open_on_init);
- if (dev == NULL)
- FatalError("Too many input devices");
-
- local->atom = MakeAtom(local->type_name,
- strlen(local->type_name),
- TRUE);
- AssignTypeAndName (dev, local->atom, local->name);
- dev->public.devicePrivate = (pointer) local;
- local->dev = dev;
-
- xf86XinputFinalizeInit(dev);
-
- /*
- * XXX Can a single device instance be both core keyboard and
- * core pointer? If so, this should be changed.
- */
- if (local->flags & XI86_CORE_POINTER)
- RegisterPointerDevice(dev);
- else if (local->flags & XI86_CORE_KEYBOARD)
- RegisterKeyboardDevice(dev);
-#ifdef XINPUT
- else
- RegisterOtherDevice(dev);
+ int open_on_init;
+
+ open_on_init = local->flags & (XI86_OPEN_ON_INIT | XI86_ALWAYS_CORE);
+
+ dev = AddInputDevice(local->device_control,
+ open_on_init);
+#ifdef DEBUG
+ ErrorF("activated device %d: %s\n", dev->id, local->name);
#endif
-
- if (serverGeneration == 1)
- xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
- local->name, local->type_name);
+ if (dev == NULL)
+ FatalError("Too many input devices");
+
+ local->atom = MakeAtom(local->type_name,
+ strlen(local->type_name),
+ TRUE);
+ AssignTypeAndName(dev, local->atom, local->name);
+ dev->public.devicePrivate = (pointer) local;
+ local->dev = dev;
+
+ xf86XinputFinalizeInit(dev);
+
+ dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
+ RegisterOtherDevice(dev);
+
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ local->name, local->type_name);
}
}
@@ -368,20 +287,20 @@ xf86ActivateDevice(LocalDevicePtr local)
void
OpenInputDevice(DeviceIntPtr dev,
- ClientPtr client,
- int *status)
+ ClientPtr client,
+ int *status)
{
if (!dev->inited) {
- *status = BadDevice;
+ *status = BadDevice;
} else {
- if (!dev->public.on) {
- if (!EnableDevice(dev)) {
- *status = BadDevice;
- } else {
- /* to prevent ProcXOpenDevice to call EnableDevice again */
- dev->startup = FALSE;
- }
- }
+ if (!dev->public.on) {
+ if (EnableDevice(dev)) {
+ /* to prevent ProcXOpenDevice to call EnableDevice again */
+ dev->startup = FALSE;
+ } else {
+ *status = BadDevice;
+ }
+ }
}
}
@@ -515,7 +434,6 @@ ChangePointerDevice (
void
CloseInputDevice (DeviceIntPtr d, ClientPtr client)
{
- ErrorF("ProcXCloseDevice to close or not ?\n");
}
@@ -593,7 +511,7 @@ SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
int
SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
- int first_valuator, int num_valuators)
+ int first_valuator, int num_valuators)
{
return BadMatch;
}
@@ -698,724 +616,246 @@ NewInputDeviceRequest (InputOption *options)
return Success;
}
-/*
- * adapted from mieq.c to support extended events
- *
- */
-#define QUEUE_SIZE 256
-
-typedef struct _Event {
- xEvent event;
-#ifdef XINPUT
- deviceValuator val;
-#endif
- ScreenPtr pScreen;
-} EventRec, *EventPtr;
-
-typedef struct _EventQueue {
- HWEventQueueType head, tail;
- CARD32 lastEventTime; /* to avoid time running backwards */
- Bool lastMotion;
- EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
-} EventQueueRec, *EventQueuePtr;
-
-static EventQueueRec xf86EventQueue;
-
-Bool
-xf86eqInit (DevicePtr pKbd, DevicePtr pPtr)
-{
- xf86EventQueue.head = xf86EventQueue.tail = 0;
- xf86EventQueue.lastEventTime = GetTimeInMillis ();
- xf86EventQueue.pKbd = pKbd;
- xf86EventQueue.pPtr = pPtr;
- xf86EventQueue.lastMotion = FALSE;
- xf86EventQueue.pEnqueueScreen = screenInfo.screens[0];
- xf86EventQueue.pDequeueScreen = xf86EventQueue.pEnqueueScreen;
- SetInputCheck (&xf86EventQueue.head, &xf86EventQueue.tail);
- return TRUE;
-}
-
-/*
- * Must be reentrant with ProcessInputEvents. Assumption: xf86eqEnqueue
- * will never be interrupted. If this is called from both signal
- * handlers and regular code, make sure the signal is suspended when
- * called from regular code.
+/*
+ * convenient functions to post events
*/
_X_EXPORT void
-xf86eqEnqueue (xEvent *e)
-{
- int oldtail, newtail;
- Bool isMotion;
-#ifdef XINPUT
- int count;
-
- xf86AssertBlockedSIGIO ("xf86eqEnqueue");
- switch (e->u.u.type) {
- case KeyPress:
- case KeyRelease:
-#ifdef XFreeXDGA
- /* we do this here, because nobody seems to be calling
- xf86PostKeyEvent(). We can't steal MotionNotify events here
- because the motion-relative information has been lost already. */
- if(DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, e))
- return;
-#endif
- /* fall through */
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- count = 1;
- break;
- default:
-#ifdef XFreeXDGA
- if (DGAIsDgaEvent (e))
- {
- count = 1;
- break;
- }
-#endif
- if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS) {
- count = 1;
- }
- else {
- count = 2;
- }
- break;
- }
-#endif
-
- oldtail = xf86EventQueue.tail;
- isMotion = e->u.u.type == MotionNotify;
- if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head) {
- if (oldtail == 0)
- oldtail = QUEUE_SIZE;
- oldtail = oldtail - 1;
- }
- else {
- newtail = oldtail + 1;
- if (newtail == QUEUE_SIZE)
- newtail = 0;
- /* Toss events which come in late */
- if (newtail == xf86EventQueue.head)
- return;
- xf86EventQueue.tail = newtail;
- }
-
- xf86EventQueue.lastMotion = isMotion;
- xf86EventQueue.events[oldtail].event = *e;
-#ifdef XINPUT
- if (count == 2) {
- xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1));
- }
-#endif
- /*
- * Make sure that event times don't go backwards - this
- * is "unnecessary", but very useful
- */
- if (e->u.keyButtonPointer.time < xf86EventQueue.lastEventTime &&
- xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) {
-
- xf86EventQueue.events[oldtail].event.u.keyButtonPointer.time =
- xf86EventQueue.lastEventTime;
- }
- xf86EventQueue.events[oldtail].pScreen = xf86EventQueue.pEnqueueScreen;
-}
-
-/*
- * Call this from ProcessInputEvents()
- */
-void
-xf86eqProcessInputEvents ()
+xf86PostMotionEvent(DeviceIntPtr device,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
{
- EventRec *e;
- int x, y;
- struct {
- xEvent event;
-#ifdef XINPUT
- deviceValuator val;
-#endif
- } xe;
-#ifdef XINPUT
- DeviceIntPtr dev;
- int id, count;
- deviceKeyButtonPointer *dev_xe;
-#endif
-
- while (xf86EventQueue.head != xf86EventQueue.tail) {
- if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-#ifdef DPMSExtension
- else if (DPMSPowerLevel != DPMSModeOn)
- SetScreenSaverTimer();
+ va_list var;
+ int i = 0, nevents = 0;
+ Bool drag = xf86SendDragEvents(device);
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+ xEvent *xE = NULL;
+ int *valuators = NULL;
+ int flags = 0;
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+#ifdef DEBUG
+ ErrorF("xf8PostMotionEvent enter: is_absolute %s\n",
+ is_absolute ? "yes" : "no");
#endif
+ if (is_absolute)
+ flags = POINTER_ABSOLUTE;
+ else
+ flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+
+ valuators = xcalloc(sizeof(int), num_valuators);
- e = &xf86EventQueue.events[xf86EventQueue.head];
- /*
- * Assumption - screen switching can only occur on motion events
- */
- if (e->pScreen != xf86EventQueue.pDequeueScreen) {
- xf86EventQueue.pDequeueScreen = e->pScreen;
- x = e->event.u.keyButtonPointer.rootX;
- y = e->event.u.keyButtonPointer.rootY;
- if (xf86EventQueue.head == QUEUE_SIZE - 1)
- xf86EventQueue.head = 0;
- else
- ++xf86EventQueue.head;
- NewCurrentScreen (xf86EventQueue.pDequeueScreen, x, y);
- }
- else {
- xe.event = e->event;
- xe.val = e->val;
- if (xf86EventQueue.head == QUEUE_SIZE - 1)
- xf86EventQueue.head = 0;
- else
- ++xf86EventQueue.head;
- switch (xe.event.u.u.type) {
- case KeyPress:
- case KeyRelease:
- (*xf86EventQueue.pKbd->processInputProc)
- (&xe.event, (DeviceIntPtr)xf86EventQueue.pKbd, 1);
- break;
-#ifdef XINPUT
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- (*(inputInfo.pointer->public.processInputProc))
- (&xe.event, (DeviceIntPtr)inputInfo.pointer, 1);
- break;
-
- default:
-#ifdef XFreeXDGA
- if (DGADeliverEvent (xf86EventQueue.pDequeueScreen, &xe.event))
- break;
-#endif
- dev_xe = (deviceKeyButtonPointer *) &xe.event;
- id = dev_xe->deviceid & DEVICE_BITS;
- if (!(dev_xe->deviceid & MORE_EVENTS)) {
- count = 1;
- }
- else {
- count = 2;
- }
- dev = LookupDeviceIntRec(id);
- if (dev == NULL) {
- ErrorF("LookupDeviceIntRec id=0x%x not found\n", id);
-/* FatalError("xf86eqProcessInputEvents : device not found.\n");
- */
- break;
- }
- if (!dev->public.processInputProc) {
- FatalError("xf86eqProcessInputEvents : device has no input proc.\n");
- break;
- }
- (*dev->public.processInputProc)(&xe.event, dev, count);
-#else
- default:
- (*xf86EventQueue.pPtr->processInputProc)
- (&xe.event, (DeviceIntPtr)xf86EventQueue.pPtr, 1);
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++) {
+ valuators[i] = va_arg(var, int);
+#ifdef DEBUG
+ ErrorF("valuator %d: %d\n", i, valuators[i]);
#endif
- break;
- }
- }
}
-}
-
-void
-xf86eqSwitchScreen(ScreenPtr pScreen,
- Bool fromDIX)
-{
- xf86EventQueue.pEnqueueScreen = pScreen;
-
- if (fromDIX)
- xf86EventQueue.pDequeueScreen = pScreen;
-}
-/*
- * convenient functions to post events
- */
+ nevents = GetPointerEvents(&xE, device, MotionNotify, 0,
+ flags, num_valuators, valuators);
-_X_EXPORT void
-xf86PostMotionEvent(DeviceIntPtr device,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- char *buff = 0;
- Time current;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_shared = xf86ShareCorePointer(device);
- Bool drag = xf86SendDragEvents(device);
- ValuatorClassPtr val = device->valuator;
- int valuator[6];
- int oldaxis[6];
- int *axisvals;
- int dx = 0, dy = 0;
- float mult;
- int x, y;
- int loop_start;
- int i;
- int num;
-
- DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) is_core=%s is_shared=%s is_absolute=%s\n",
- device, device->name,
- is_core ? "True" : "False",
- is_shared ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- xf86Info.lastEventTime = xev->time = current = GetTimeInMillis();
-
- if (!is_core) {
- if (HAS_MOTION_HISTORY(local)) {
- buff = ((char *)local->motion_history +
- (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
- }
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
+ for (i = 0; i < nevents; i++) {
+ if (xE->u.keyButtonPointer.time > xf86Info.lastEventTime)
+ xf86Info.lastEventTime = xE->u.keyButtonPointer.time;
+ mieqEnqueue(xE++);
}
-
- axisvals = val->axisVal;
- va_start(var, num_valuators);
-
- loop_start = first_valuator;
- for(loop=0; loop<num_valuators; loop++) {
-
- valuator[loop%6] = va_arg(var,int);
-
- if (loop % 6 == 5 || loop == num_valuators - 1) {
- num = loop % 6 + 1;
- /*
- * Adjust first two relative valuators
- */
- if (!is_absolute && num_valuators >= 2 && loop_start == 0) {
-
- dx = valuator[0];
- dy = valuator[1];
-
- /*
- * Accelerate
- */
- if (device->ptrfeed && device->ptrfeed->ctrl.num) {
- /* modeled from xf86Events.c */
- if (device->ptrfeed->ctrl.threshold) {
- if ((abs(dx) + abs(dy)) >= device->ptrfeed->ctrl.threshold) {
- local->dxremaind = ((float)dx * (float)(device->ptrfeed->ctrl.num)) /
- (float)(device->ptrfeed->ctrl.den) + local->dxremaind;
- valuator[0] = (int)local->dxremaind;
- local->dxremaind = local->dxremaind - (float)valuator[0];
-
- local->dyremaind = ((float)dy * (float)(device->ptrfeed->ctrl.num)) /
- (float)(device->ptrfeed->ctrl.den) + local->dyremaind;
- valuator[1] = (int)local->dyremaind;
- local->dyremaind = local->dyremaind - (float)valuator[1];
- }
- }
- else if (dx || dy) {
- mult = pow((float)(dx*dx+dy*dy),
- ((float)(device->ptrfeed->ctrl.num) /
- (float)(device->ptrfeed->ctrl.den) - 1.0) /
- 2.0) / 2.0;
- if (dx) {
- local->dxremaind = mult * (float)dx + local->dxremaind;
- valuator[0] = (int)local->dxremaind;
- local->dxremaind = local->dxremaind - (float)valuator[0];
- }
- if (dy) {
- local->dyremaind = mult * (float)dy + local->dyremaind;
- valuator[1] = (int)local->dyremaind;
- local->dyremaind = local->dyremaind - (float)valuator[1];
- }
- }
- DBG(6, ErrorF("xf86PostMotionEvent acceleration v0=%d v1=%d\n",
- valuator[0], valuator[1]));
- }
-
- /*
- * Map current position back to device space in case
- * the cursor was warped
- */
- if (is_core || is_shared)
- {
- miPointerPosition (&x, &y);
- if (local->reverse_conversion_proc)
- (*local->reverse_conversion_proc)(local, x, y, axisvals);
- else
- {
- axisvals[0] = x;
- axisvals[1] = y;
- }
- }
- }
-
- /*
- * Update axes
- */
- for (i = 0; i < num; i++)
- {
- oldaxis[i] = axisvals[loop_start + i];
- if (is_absolute)
- axisvals[loop_start + i] = valuator[i];
- else
- axisvals[loop_start + i] += valuator[i];
- }
-
- /*
- * Deliver extension event
- */
- if (!is_core) {
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
-
- xv->device_state = 0;
- xv->num_valuators = num;
- xv->first_valuator = loop_start;
- memcpy (&xv->valuator0, &axisvals[loop_start],
- sizeof(INT32)*xv->num_valuators);
-
- if (HAS_MOTION_HISTORY(local)) {
- *(Time*)buff = current;
- memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator,
- &axisvals[loop_start],
- sizeof(INT32)*xv->num_valuators);
- }
- ENQUEUE(xE);
- }
-
- /*
- * Deliver core event
- */
- if (is_core ||
- (is_shared && num_valuators >= 2 && loop_start == 0)) {
-#ifdef XFreeXDGA
- /*
- * Let DGA peek at the event and steal it
- */
- xev->type = MotionNotify;
- xev->detail = 0;
- if (is_absolute)
- {
- dx = axisvals[0] - oldaxis[0];
- dy = axisvals[1] - oldaxis[1];
- }
- if (DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum,
- xE, dx, dy))
- continue;
-#endif
- if (!(*local->conversion_proc)(local, loop_start, num,
- axisvals[0], axisvals[1],
- axisvals[2], axisvals[3],
- axisvals[4], axisvals[5],
- &x, &y))
- continue;
-
- if (drag)
- miPointerAbsoluteCursor (x, y, current);
- /*
- * Retrieve the position
- */
- miPointerPosition (&x, &y);
- if (local->reverse_conversion_proc)
- (*local->reverse_conversion_proc)(local, x, y, axisvals);
- else
- {
- axisvals[0] = x;
- axisvals[1] = y;
- }
- }
- loop_start += 6;
- }
+#if 0
+ if (HAS_MOTION_HISTORY(local)) {
+ buff = ((char *)local->motion_history +
+ (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
}
- va_end(var);
+
if (HAS_MOTION_HISTORY(local)) {
- local->last = (local->last + 1) % device->valuator->numMotionEvents;
- if (local->last == local->first)
- local->first = (local->first + 1) % device->valuator->numMotionEvents;
+ local->last = (local->last + 1) % device->valuator->numMotionEvents;
+ if (local->last == local->first)
+ local->first = (local->first + 1) % device->valuator->numMotionEvents;
}
- DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) is_core=%s is_shared=%s\n",
- device, device->name,
- is_core ? "True" : "False",
- is_shared ? "True" : "False"));
+#endif
}
_X_EXPORT void
xf86PostProximityEvent(DeviceIntPtr device,
- int is_in,
- int first_valuator,
- int num_valuators,
- ...)
+ int is_in,
+ int first_valuator,
+ int num_valuators,
+ ...)
{
va_list var;
int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- ValuatorClassPtr val = device->valuator;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_absolute = val && ((val->mode & 1) == Relative);
+ Bool is_core = device->coreEvents;
+
+#ifdef DEBUG
+ ErrorF("xf86PostProximityEvent enter\n");
+#endif
+#if 0
DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
+ device, device->name, is_in ? "true" : "false",
+ is_core ? "True" : "False",
+ is_absolute ? "True" : "False"));
if (is_core) {
- return;
+ return;
}
if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
}
xev->type = is_in ? ProximityIn : ProximityOut;
xev->detail = 0;
xev->deviceid = device->id | MORE_EVENTS;
-
+
xv->type = DeviceValuator;
xv->deviceid = device->id;
xv->device_state = 0;
if ((device->valuator->mode & 1) == Relative) {
- num_valuators = 0;
+ num_valuators = 0;
}
if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
-
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- ENQUEUE(xE);
- }
- }
- va_end(var);
+ int *axisvals = val->axisVal;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 1:
+ xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 2:
+ xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 3:
+ xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 4:
+ xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 5:
+ xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ }
+ if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+
+ xv->num_valuators = (loop % 6) + 1;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+ mieqEnqueue(xE);
+ }
+ }
+ va_end(var);
}
else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ /* no valuator */
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- ENQUEUE(xE);
+ xv->num_valuators = 0;
+ xv->first_valuator = 0;
+ mieqEnqueue(xE);
}
DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-
+ device, device->name, is_in ? "true" : "false",
+ is_core ? "True" : "False",
+ is_absolute ? "True" : "False"));
+#endif
}
_X_EXPORT void
xf86PostButtonEvent(DeviceIntPtr device,
- int is_absolute,
- int button,
- int is_down,
- int first_valuator,
- int num_valuators,
- ...)
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators,
+ ...)
{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- ValuatorClassPtr val = device->valuator;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_shared = xf86ShareCorePointer(device);
-
- DBG(5, ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_core=%s is_shared=%s is_absolute=%s\n",
- device, device->name, button,
- is_down ? "True" : "False",
- is_core ? "True" : "False",
- is_shared ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- /* Check the core pointer button state not to send an inconsistent
- * event. This can happen with the AlwaysCore feature.
- */
- if ((is_core || is_shared) &&
- !xf86CheckButton(device->button->map[button], is_down))
- {
- return;
- }
+ va_list var;
+ int *valuators = NULL;
+ int i = 0, nevents = 0;
+ xEvent *events = NULL;
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+#ifdef DEBUG
+ ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_absolute=%s\n",
+ device, device->name, button,
+ is_down ? "True" : "False",
+ is_absolute ? "True" : "False");
+#endif
- if (!is_core) {
- xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease;
- xev->detail = button;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
-
- if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- ENQUEUE(xE);
-
- }
- }
- va_end(var);
- }
- else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- ENQUEUE(xE);
- }
- }
+ valuators = xcalloc(sizeof(int), num_valuators);
- /* removed rootX/rootY as DIX sets these fields */
- if (is_core || is_shared) {
- xE->u.u.type = is_down ? ButtonPress : ButtonRelease;
- xE->u.u.detail = device->button->map[button];
- xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis();
-
-#ifdef XFreeXDGA
- if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, 0, 0))
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++) {
+#ifdef DEBUG
+ ErrorF("valuator %d: %d\n", i, valuators[i]);
#endif
- ENQUEUE(xE);
+ valuators[i] = va_arg(var, int);
+ }
+
+ nevents = GetPointerEvents(&events, device,
+ is_down ? ButtonPress : ButtonRelease, button,
+ is_absolute ? POINTER_ABSOLUTE :
+ POINTER_RELATIVE,
+ num_valuators, valuators);
+
+ for (i = 0; i < nevents; i++) {
+ if (events->u.keyButtonPointer.time > xf86Info.lastEventTime)
+ xf86Info.lastEventTime = events->u.keyButtonPointer.time;
+ mieqEnqueue(events++);
}
- DBG(5, ErrorF("xf86PostButtonEvent END\n"));
}
_X_EXPORT void
xf86PostKeyEvent(DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
-
- va_start(var, num_valuators);
+ va_list var;
+ int i = 0, nevents = 0, *valuators = NULL;
+ xEvent *events = NULL;
+
+ /* instil confidence in the user */
+ ErrorF("this function has never been tested properly. if things go quite "
+ "badly south after this message, then xf86PostKeyEvent is "
+ "broken.\n");
+
+ /* the spec says that dkp/dkr events should only get valuators in
+ * absolute mode. the spec knows all. BOW BEFORE etc. */
+ if (is_absolute) {
+ nevents = GetKeyboardValuatorEvents(&events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code, num_valuators,
+ valuators);
+ valuators = xcalloc(sizeof(int), num_valuators);
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+ }
+ else {
+ nevents = GetKeyboardEvents(&events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code);
+ }
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = va_arg(var, int);
- break;
- case 1:
- xv->valuator1 = va_arg(var, int);
- break;
- case 2:
- xv->valuator2 = va_arg(var, int);
- break;
- case 3:
- xv->valuator3 = va_arg(var, int);
- break;
- case 4:
- xv->valuator4 = va_arg(var, int);
- break;
- case 5:
- xv->valuator5 = va_arg(var, int);
- break;
- }
- if (((loop % 6 == 5) || (loop == num_valuators - 1))) {
- xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
- xev->detail = key_code;
-
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
- /* if the device is in the relative mode we don't have to send valuators */
- xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
-
- ENQUEUE(xE);
- /* if the device is in the relative mode only one event is needed */
- if (!is_absolute) break;
- }
+ for (i = 0; i < nevents; i++) {
+ if (events->u.keyButtonPointer.time > xf86Info.lastEventTime)
+ xf86Info.lastEventTime = events->u.keyButtonPointer.time;
+ mieqEnqueue(events++);
}
- va_end(var);
}
_X_EXPORT void
@@ -1423,21 +863,22 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
unsigned int key_code,
int is_down)
{
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
+ xEvent *events = NULL;
+ int nevents = 0, i = 0;
- if (xf86IsCoreKeyboard(device)) {
- xev->type = is_down ? KeyPress : KeyRelease;
- } else {
- xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
- }
- xev->detail = key_code;
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
-
-#ifdef XFreeXDGA
- /* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */
+#ifdef DEBUG
+ ErrorF("xf86PKE enter: keycode %d is %s, device %d\n", key_code,
+ is_down ? "down" : "up", device->id);
#endif
- ENQUEUE(xE);
+
+ nevents = GetKeyboardEvents(&events, device,
+ is_down ? KeyPress : KeyRelease, key_code);
+
+ for (i = 0; i < nevents; i++) {
+ if (events->u.keyButtonPointer.time > xf86Info.lastEventTime)
+ xf86Info.lastEventTime = events->u.keyButtonPointer.time;
+ mieqEnqueue(events++);
+ }
}
/*
@@ -1450,20 +891,20 @@ xf86MotionHistoryAllocate(LocalDevicePtr local)
ValuatorClassPtr valuator = local->dev->valuator;
if (!HAS_MOTION_HISTORY(local))
- return;
+ return;
if (local->motion_history) xfree(local->motion_history);
local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
- * valuator->numMotionEvents);
+ * valuator->numMotionEvents);
local->first = 0;
local->last = 0;
}
_X_EXPORT int
xf86GetMotionEvents(DeviceIntPtr dev,
- xTimecoord *buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
+ xTimecoord *buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
ValuatorClassPtr valuator = dev->valuator;
@@ -1473,20 +914,20 @@ xf86GetMotionEvents(DeviceIntPtr dev,
Time current;
if (!HAS_MOTION_HISTORY(local))
- return 0;
+ return 0;
size = (sizeof(INT32) * valuator->numAxes + sizeof(Time));
while (loop != local->last) {
- current = *(Time*)(((char *)local->motion_history)+loop*size);
- if (current > stop)
- return num;
- if (current >= start) {
- memcpy(((char *)buff)+size*num,
- ((char *)local->motion_history)+loop*size, size);
- num++;
- }
- loop = (loop + 1) % valuator->numMotionEvents;
+ current = *(Time*)(((char *)local->motion_history)+loop*size);
+ if (current > stop)
+ return num;
+ if (current >= start) {
+ memcpy(((char *)buff)+size*num,
+ ((char *)local->motion_history)+loop*size, size);
+ num++;
+ }
+ loop = (loop + 1) % valuator->numMotionEvents;
}
return num;
}
@@ -1512,10 +953,10 @@ xf86FirstLocalDevice()
_X_EXPORT int
xf86ScaleAxis(int Cx,
- int Sxhigh,
- int Sxlow,
- int Rxhigh,
- int Rxlow )
+ int Sxhigh,
+ int Sxlow,
+ int Rxhigh,
+ int Rxlow )
{
int X;
int dSx = Sxhigh - Sxlow;
@@ -1550,7 +991,7 @@ xf86XInputSetScreen(LocalDevicePtr local,
int x,
int y)
{
- if ((xf86IsCorePointer(local->dev) || xf86ShareCorePointer(local->dev)) &&
+ if (local->dev->coreEvents &&
(miPointerCurrentScreen() != screenInfo.screens[screen_number])) {
miPointerSetNewScreen (screen_number, x, y);
}
@@ -1562,6 +1003,9 @@ xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res)
{
#ifdef XINPUT
+ if (!dev || !dev->valuator)
+ return;
+
if (maxval == -1) {
if (axnum == 0)
maxval = screenInfo.screens[0]->width - 1;
@@ -1582,10 +1026,14 @@ _X_EXPORT void
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
#ifdef XINPUT
- if (axnum == 0)
+ if (axnum == 0) {
dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
- else if (axnum == 1)
+ dev->valuator->lastx = dev->valuator->axisVal[0];
+ }
+ else if (axnum == 1) {
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
+ dev->valuator->lasty = dev->valuator->axisVal[1];
+ }
#endif
}
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 9fb30413a..d4fa43f43 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -147,8 +147,6 @@ typedef struct _LocalDeviceRec {
unsigned int last;
int old_x;
int old_y;
- float dxremaind;
- float dyremaind;
char * type_name;
IntegerFeedbackPtr always_core_feedback;
IDevPtr conf_idev;
@@ -167,16 +165,7 @@ typedef struct _DeviceAssocRec
extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
-int xf86IsCorePointer(DeviceIntPtr dev);
-int xf86IsCoreKeyboard(DeviceIntPtr dev);
-void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
-#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
-
void InitExtInput(void);
-Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
-void xf86eqEnqueue(struct _xEvent *event);
-void xf86eqProcessInputEvents (void);
-void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, ...);
void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
@@ -212,10 +201,16 @@ void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
void xf86DeleteInputDriver(int drvIndex);
InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+InputDriverPtr xf86LookupInputDriver(const char *name);
+InputInfoPtr xf86LookupInput(const char *name);
void xf86DeleteInput(InputInfoPtr pInp, int flags);
/* xf86Option.c */
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts);
+/* Legacy hatred */
+#define SendCoreEvents 59
+#define DontSendCoreEvents 60
+
#endif /* _xf86Xinput_h */
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index ad4f77353..f9d11e87d 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -293,7 +293,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86SoundKbdBell)
SYMFUNC(xf86GARTCloseScreen)
#ifdef XINPUT
- /* XISB routines (Merged from Metrolink tree) */
SYMFUNC(XisbNew)
SYMFUNC(XisbFree)
SYMFUNC(XisbRead)
@@ -695,7 +694,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
/* xf86Xinput.c */
#ifdef XINPUT
SYMFUNC(xf86ProcessCommonOptions)
- SYMFUNC(xf86IsCorePointer)
SYMFUNC(xf86PostMotionEvent)
SYMFUNC(xf86PostProximityEvent)
SYMFUNC(xf86PostButtonEvent)
@@ -704,13 +702,9 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86GetMotionEvents)
SYMFUNC(xf86MotionHistoryAllocate)
SYMFUNC(xf86FirstLocalDevice)
- SYMFUNC(xf86eqEnqueue)
SYMFUNC(xf86ActivateDevice)
-/* The following segment merged from Metrolink tree */
SYMFUNC(xf86XInputSetScreen)
SYMFUNC(xf86ScaleAxis)
- SYMFUNC(xf86XInputSetSendCoreEvents)
-/* End merged segment */
#endif
#ifdef DPMSExtension
SYMFUNC(DPMSGet)