summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2009-02-10 16:38:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-02-11 09:14:22 +1000
commitd12d2d2c789e8439ae6f2e63526c49c76c385c8e (patch)
tree3e4655d699bb7136f95432ab18c2842962ee9a2e
parent862314c8dfced80631b2c7a6e00799fd2956b6dc (diff)
Remove SpecialKey handling.
Are your keys really that special? Really? No. They aren't. Take it from me. Extracted into separate commits by Peter Hutterer. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/bsd_kbd.c47
-rw-r--r--src/hurd_kbd.c2
-rw-r--r--src/kbd.c68
-rw-r--r--src/lnx_kbd.c79
-rw-r--r--src/sco_kbd.c60
-rw-r--r--src/sun_kbd.c2
-rw-r--r--src/xf86OSKbd.h5
7 files changed, 0 insertions, 263 deletions
diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c
index ff20d92..02d992d 100644
--- a/src/bsd_kbd.c
+++ b/src/bsd_kbd.c
@@ -299,51 +299,6 @@ SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
}
}
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static
-Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- 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:
-#ifdef VT_ACTIVATE
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- return TRUE;
- }
-#endif
- case KEY_F11:
- case KEY_F12:
-#ifdef VT_ACTIVATE
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- return TRUE;
- }
-#endif
- }
- }
- }
-
- return FALSE;
-}
-
static void
stdReadInput(InputInfoPtr pInfo)
{
@@ -509,10 +464,8 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
pKbd->GetLeds = GetKbdLeds;
pKbd->SetKbdRepeat = SetKbdRepeat;
pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = NULL;
pKbd->OpenKeyboard = OpenKeyboard;
pKbd->vtSwitchSupported = FALSE;
diff --git a/src/hurd_kbd.c b/src/hurd_kbd.c
index 77f84ce..ef339b5 100644
--- a/src/hurd_kbd.c
+++ b/src/hurd_kbd.c
@@ -164,9 +164,7 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
pKbd->GetLeds = GetKbdLeds;
pKbd->SetKbdRepeat = SetKbdRepeat;
pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = NULL;
pKbd->RemapScanCode = ATScancode;
- pKbd->GetSpecialKey = NULL;
pKbd->OpenKeyboard = OpenKeyboard;
pKbd->vtSwitchSupported = FALSE;
pKbd->CustomKeycodes = FALSE;
diff --git a/src/kbd.c b/src/kbd.c
index 981012e..bbf0370 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -213,39 +213,6 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
}
}
-
-#define ModifierIsSet(k) ((modifiers & (k)) == (k))
-
-static Bool
-CommonSpecialKey(int key, Bool down, int modifiers)
-{
- if ((!ModifierIsSet(ShiftMask)) &&
- (((ModifierIsSet(ControlMask | AltMask)) ||
- (ModifierIsSet(ControlMask | AltLangMask))))) {
- switch (key) {
-
- case KEY_BackSpace:
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
- break;
-
- /*
- * The idea here is to pass the scancode down to a list of
- * registered routines. There should be some standard conventions
- * for processing certain keys.
- */
- case KEY_KP_Minus: /* Keypad - */
- if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- break;
-
- case KEY_KP_Plus: /* Keypad + */
- if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- break;
- }
- }
- return FALSE;
-}
-
-
static InputInfoPtr
KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
@@ -626,7 +593,6 @@ PostKbdEvent(InputInfoPtr pInfo, unsigned int scanCode, Bool down)
DeviceIntPtr device = pInfo->dev;
KeyClassRec *keyc = device->key;
KbdFeedbackClassRec *kbdfeed = device->kbdfeed;
- int specialkey = 0;
Bool UsePrefix = FALSE;
KeySym *keysym;
@@ -669,40 +635,6 @@ PostKbdEvent(InputInfoPtr pInfo, unsigned int scanCode, Bool down)
}
}
- /*
- * and now get some special keysequences
- */
-
- specialkey = scanCode;
-
- if (pKbd->GetSpecialKey != NULL) {
- specialkey = pKbd->GetSpecialKey(pInfo, scanCode);
- } else {
- if (pKbd->specialMap != NULL) {
- TransMapPtr map = pKbd->specialMap;
- if (scanCode >= map->begin && scanCode < map->end)
- specialkey = map->map[scanCode - map->begin];
- }
- }
-
-#ifndef TERMINATE_FALLBACK
-#define TERMINATE_FALLBACK 0
-#endif
-#ifdef XKB
- if (noXkbExtension
-#if TERMINATE_FALLBACK
- || specialkey == KEY_BackSpace
-#endif
- )
-#endif
- {
- if (CommonSpecialKey(specialkey, down, keyc->state))
- return;
- if (pKbd->SpecialKey != NULL)
- if (pKbd->SpecialKey(pInfo, specialkey, down, keyc->state))
- return;
- }
-
#ifndef __sparc64__
/*
* PC keyboards generate separate key codes for
diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c
index d3f29e5..46cc1e4 100644
--- a/src/lnx_kbd.c
+++ b/src/lnx_kbd.c
@@ -302,83 +302,6 @@ KbdOff(InputInfoPtr pInfo, int what)
return Success;
}
-static int
-GetSpecialKey(InputInfoPtr pInfo, int scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int specialkey = scanCode;
-
-#if defined (__sparc__)
- if (pKbd->sunKbd) {
- 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;
- }
- return specialkey;
- }
-#endif
-
- if (pKbd->CustomKeycodes) {
- specialkey = pKbd->specialMap->map[scanCode];
- }
- return specialkey;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static
-Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- 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:
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- return TRUE;
- }
- }
- }
- }
- return FALSE;
-}
-
static void
stdReadInput(InputInfoPtr pInfo)
{
@@ -455,10 +378,8 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
pKbd->GetLeds = GetKbdLeds;
pKbd->SetKbdRepeat = SetKbdRepeat;
pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = GetSpecialKey;
pKbd->OpenKeyboard = OpenKeyboard;
pKbd->vtSwitchSupported = FALSE;
diff --git a/src/sco_kbd.c b/src/sco_kbd.c
index b6731c7..dcdc93b 100644
--- a/src/sco_kbd.c
+++ b/src/sco_kbd.c
@@ -334,64 +334,6 @@ KbdOff(InputInfoPtr pInfo, int what)
return Success;
}
-static int
-GetSpecialKey(InputInfoPtr pInfo, int scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int specialkey = scanCode;
-
- if (pKbd->CustomKeycodes) {
- specialkey = pKbd->specialMap->map[scanCode];
- }
- return specialkey;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static Bool
-SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((!ModifierSet(ShiftMask)) && ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask)))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq) {
- switch (key) {
- 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:
- if (down) {
- int sts = key - KEY_F1;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_ACTIVATE, sts);
- }
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- int sts = key - KEY_F11 + 10;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_ACTIVATE, sts);
- }
- return TRUE;
- }
- }
- }
- }
- return FALSE;
-}
-
static void
stdReadInput(InputInfoPtr pInfo)
{
@@ -469,8 +411,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
pKbd->GetLeds = GetKbdLeds;
pKbd->SetKbdRepeat = SetKbdRepeat;
pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
- pKbd->GetSpecialKey = GetSpecialKey;
pKbd->OpenKeyboard = OpenKeyboard;
pKbd->RemapScanCode = ATScancode;
pKbd->vtSwitchSupported = FALSE;
diff --git a/src/sun_kbd.c b/src/sun_kbd.c
index 81e0f01..a222d38 100644
--- a/src/sun_kbd.c
+++ b/src/sun_kbd.c
@@ -420,8 +420,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
pKbd->KbdGetMapping = KbdGetMapping;
pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = NULL;
- pKbd->SpecialKey = NULL;
pKbd->OpenKeyboard = OpenKeyboard;
diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h
index 4ab722c..7c2d13d 100644
--- a/src/xf86OSKbd.h
+++ b/src/xf86OSKbd.h
@@ -43,9 +43,6 @@ typedef int (*GetLedsProc)(InputInfoPtr pInfo);
typedef void (*SetKbdRepeatProc)(InputInfoPtr pInfo, char rad);
typedef void (*KbdGetMappingProc)(InputInfoPtr pInfo,
KeySymsPtr pKeySyms, CARD8* pModMap);
-typedef int (*GetSpecialKeyProc)(InputInfoPtr pInfo, int scanCode);
-typedef Bool (*SpecialKeyProc)(InputInfoPtr pInfo,
- int key, Bool down, int modifiers);
typedef int (*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode);
typedef Bool (*OpenKeyboardProc)(InputInfoPtr pInfo);
typedef void (*PostEventProc)(InputInfoPtr pInfo,
@@ -66,8 +63,6 @@ typedef struct {
SetKbdRepeatProc SetKbdRepeat;
KbdGetMappingProc KbdGetMapping;
RemapScanCodeProc RemapScanCode;
- GetSpecialKeyProc GetSpecialKey;
- SpecialKeyProc SpecialKey;
OpenKeyboardProc OpenKeyboard;
PostEventProc PostEvent;