summaryrefslogtreecommitdiff
path: root/hw/xnest
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2008-03-18 10:05:57 +0200
committerDaniel Stone <daniel@fooishbar.org>2009-01-22 15:06:25 +1100
commit40877c6680863bd6a8475f2bb0c54df55bcf0b0e (patch)
tree9f958934add153efc9f6e85900fd5ff9ab2320da /hw/xnest
parentf9da417163b6b2d6234d2542c1f375e33db7159a (diff)
XKB: Make XKB mandatory
No more #ifdef XKB, because you can't disable the build, and no more noXkbExtension either. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/xnest')
-rw-r--r--hw/xnest/Keyboard.c76
1 files changed, 34 insertions, 42 deletions
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index cedaa7a25..35be5212e 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -33,9 +33,8 @@ is" without express or implied warranty.
#include "Args.h"
#include "Events.h"
-#ifdef XKB
#include <X11/extensions/XKB.h>
-#include <xkbsrv.h>
+#include "xkbsrv.h"
#include <X11/extensions/XKBconfig.h>
extern Bool
@@ -59,7 +58,6 @@ extern Status XkbGetControls(
unsigned long /* which */,
XkbDescPtr /* desc */
);
-#endif
DeviceIntPtr xnestKeyboardDevice = NULL;
@@ -124,6 +122,10 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
CARD8 modmap[MAP_LENGTH];
int i, j;
XKeyboardState values;
+ XkbComponentNamesRec names;
+ XkbDescPtr xkb;
+ char *rules, *model, *layout, *variants, *options;
+ int op, event, error, major, minor;
switch (onoff)
{
@@ -168,50 +170,29 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
keySyms.mapWidth = mapWidth;
keySyms.map = keymap;
-#ifdef XKB
- if (noXkbExtension) {
-XkbError:
-#endif
- XGetKeyboardControl(xnestDisplay, &values);
-
- memmove((char *) defaultKeyboardControl.autoRepeats,
- (char *) values.auto_repeats, sizeof(values.auto_repeats));
-
- InitKeyboardDeviceStruct(&pDev->public, &keySyms, modmap,
- xnestBell, xnestChangeKeyboardControl);
-#ifdef XKB
- } else {
- XkbComponentNamesRec names;
- char *rules, *model, *layout, *variants, *options;
-
- XkbDescPtr xkb;
- int op, event, error, major, minor;
-
- if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) {
- ErrorF("Unable to initialize XKEYBOARD extension.\n");
+ if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) {
+ ErrorF("Unable to initialize XKEYBOARD extension.\n");
goto XkbError;
- }
- xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
- if (xkb == NULL || xkb->geom == NULL) {
+ }
+ xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
+ if (xkb == NULL || xkb->geom == NULL) {
ErrorF("Couldn't get keyboard.\n");
- goto XkbError;
- }
- XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
+ goto XkbError;
+ }
+ XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
- memset(&names, 0, sizeof(XkbComponentNamesRec));
- rules = XKB_DFLT_RULES;
- model = XKB_DFLT_MODEL;
- layout = XKB_DFLT_LAYOUT;
- variants = XKB_DFLT_VARIANT;
- options = XKB_DFLT_OPTIONS;
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+ rules = XKB_DFLT_RULES;
+ model = XKB_DFLT_MODEL;
+ layout = XKB_DFLT_LAYOUT;
+ variants = XKB_DFLT_VARIANT;
+ options = XKB_DFLT_OPTIONS;
- XkbSetRulesDflts(rules, model, layout, variants, options);
- XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modmap,
+ XkbSetRulesDflts(rules, model, layout, variants, options);
+ XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modmap,
xnestBell, xnestChangeKeyboardControl);
- XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
- XkbFreeKeyboard(xkb, 0, False);
- }
-#endif
+ XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
+ XkbFreeKeyboard(xkb, 0, False);
xfree(keymap);
break;
case DEVICE_ON:
@@ -228,6 +209,17 @@ XkbError:
break;
}
return Success;
+
+XkbError:
+ XGetKeyboardControl(xnestDisplay, &values);
+ memmove((char *)defaultKeyboardControl.autoRepeats,
+ (char *)values.auto_repeats,
+ sizeof(values.auto_repeats));
+
+ InitKeyboardDeviceStruct(&pDev->public, &keySyms,
+ xnestBell, xnestChangeKeyboardControl);
+ xfree(keymap);
+ return Success;
}
Bool