Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xfree86 / dixmods / xkbPrivate.c
1
2 #ifdef HAVE_DIX_CONFIG_H
3 #include <dix-config.h>
4 #endif
5
6 #ifdef HAVE_XORG_CONFIG_H
7 #include <xorg-config.h>
8 #endif
9
10 #include <stdio.h>
11 #include <X11/X.h>
12 #include "windowstr.h"
13 #define XKBSRV_NEED_FILE_FUNCS
14 #include <xkbsrv.h>
15
16 #include "dixgrabs.h"
17 #include "os.h"
18 #include "xf86.h"
19
20 int
21 XkbDDXPrivate(DeviceIntPtr dev, KeyCode key, XkbAction *act)
22 {
23 XkbAnyAction *xf86act = &(act->any);
24 char msgbuf[XkbAnyActionDataSize + 1];
25
26 if (xf86act->type == XkbSA_XFree86Private) {
27 memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize);
28 msgbuf[XkbAnyActionDataSize] = '\0';
29 if (strcasecmp(msgbuf, "-vmode") == 0)
30 xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
31 else if (strcasecmp(msgbuf, "+vmode") == 0)
32 xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
33 else if (strcasecmp(msgbuf, "prgrbs") == 0) {
34 DeviceIntPtr tmp;
35
36 xf86Msg(X_INFO, "Printing all currently active device grabs:\n");
37 for (tmp = inputInfo.devices; tmp; tmp = tmp->next)
38 if (tmp->deviceGrab.grab)
39 PrintDeviceGrabInfo(tmp);
40 xf86Msg(X_INFO, "End list of active device grabs\n");
41 }
42 else if (strcasecmp(msgbuf, "ungrab") == 0)
43 UngrabAllDevices(FALSE);
44 else if (strcasecmp(msgbuf, "clsgrb") == 0)
45 UngrabAllDevices(TRUE);
46 else if (strcasecmp(msgbuf, "prwins") == 0)
47 PrintWindowTree();
48 }
49
50 return 0;
51 }