| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vidc.c,v 1.10 2011/05/28 13:24:04 christos Exp $ */ | | 1 | /* $NetBSD: vidc.c,v 1.11 2011/05/30 15:31:56 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1999 Neil A. Carson & Mark Brinicombe | | 4 | * Copyright (c) 1999 Neil A. Carson & Mark Brinicombe |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -40,44 +40,58 @@ | | | @@ -40,44 +40,58 @@ |
40 | * | | 40 | * |
41 | * Some of this serves as a good example of how not to write code ;-)) | | 41 | * Some of this serves as a good example of how not to write code ;-)) |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <stdio.h> | | 44 | #include <stdio.h> |
45 | #include <signal.h> | | 45 | #include <signal.h> |
46 | #include <sys/types.h> | | 46 | #include <sys/types.h> |
47 | #include <sys/mman.h> | | 47 | #include <sys/mman.h> |
48 | #include <sys/ioctl.h> | | 48 | #include <sys/ioctl.h> |
49 | #include <fcntl.h> | | 49 | #include <fcntl.h> |
50 | #include <unistd.h> | | 50 | #include <unistd.h> |
51 | #include <errno.h> | | 51 | #include <errno.h> |
52 | | | 52 | |
| | | 53 | |
53 | /* X11 headers | | 54 | /* X11 headers |
54 | */ | | 55 | */ |
55 | #include "Xos.h" | | 56 | #include "Xos.h" |
56 | #include "X.h" | | 57 | #include "X.h" |
57 | #include "Xproto.h" | | 58 | #include "Xproto.h" |
58 | #include "mi.h" | | 59 | #include "Xmd.h" |
| | | 60 | #ifndef PSZ |
| | | 61 | #define PSZ 8 |
| | | 62 | #endif |
59 | #include "cfb.h" | | 63 | #include "cfb.h" |
60 | #include "screenint.h" | | 64 | #undef PSZ |
| | | 65 | #include "cfb16.h" |
| | | 66 | #include "cfb32.h" |
| | | 67 | #include "colormap.h" |
| | | 68 | #include "colormapst.h" |
| | | 69 | #include "cursor.h" |
| | | 70 | #include "dixfontstr.h" |
| | | 71 | #include "fontstruct.h" |
| | | 72 | #include "gcstruct.h" |
61 | #include "input.h" | | 73 | #include "input.h" |
62 | #include "inputstr.h" | | 74 | #include "inputstr.h" |
63 | #include "cursor.h" | | 75 | #include "mi.h" |
| | | 76 | #include "mifillarc.h" |
| | | 77 | #include "mipointer.h" |
64 | #include "misc.h" | | 78 | #include "misc.h" |
| | | 79 | #include "mistruct.h" |
| | | 80 | #include "pixmapstr.h" |
| | | 81 | #include "regionstr.h" |
| | | 82 | #include "resource.h" |
65 | #include "scrnintstr.h" | | 83 | #include "scrnintstr.h" |
66 | #include "servermd.h" | | 84 | #include "servermd.h" |
67 | #include "mipointer.h" | | | |
68 | #include "colormap.h" | | | |
69 | #include "colormapst.h" | | | |
70 | #include "resource.h" | | | |
71 | #include "wscons.h" | | 85 | #include "wscons.h" |
72 | | | 86 | |
73 | /* #define DEBUG */ | | 87 | /* #define DEBUG */ |
74 | | | 88 | |
75 | #ifdef DEBUG | | 89 | #ifdef DEBUG |
76 | #define DPRINTF(x) ErrorF x | | 90 | #define DPRINTF(x) ErrorF x |
77 | #else | | 91 | #else |
78 | #define DPRINTF(x) | | 92 | #define DPRINTF(x) |
79 | #endif | | 93 | #endif |
80 | | | 94 | |
81 | /* Keymap, from XFree86*/ | | 95 | /* Keymap, from XFree86*/ |
82 | #include "xf86_keymap.h" | | 96 | #include "xf86_keymap.h" |
83 | | | 97 | |
| @@ -472,27 +486,27 @@ void InitInput(int argc, char *argv[]) | | | @@ -472,27 +486,27 @@ void InitInput(int argc, char *argv[]) |
472 | | | 486 | |
473 | /* Add the input devices */ | | 487 | /* Add the input devices */ |
474 | mouse = AddInputDevice((DeviceProc) vidc_mouse, TRUE); | | 488 | mouse = AddInputDevice((DeviceProc) vidc_mouse, TRUE); |
475 | keyboard = AddInputDevice((DeviceProc) vidc_kbd, TRUE); | | 489 | keyboard = AddInputDevice((DeviceProc) vidc_kbd, TRUE); |
476 | if ((!mouse) || (!keyboard)) | | 490 | if ((!mouse) || (!keyboard)) |
477 | FatalError("failed to create input devices in InitInput\n"); | | 491 | FatalError("failed to create input devices in InitInput\n"); |
478 | private.mouse_dev = (DevicePtr) mouse; | | 492 | private.mouse_dev = (DevicePtr) mouse; |
479 | private.kbd_dev = (DevicePtr) keyboard; | | 493 | private.kbd_dev = (DevicePtr) keyboard; |
480 | | | 494 | |
481 | /* Register devices with the upper 'layers' (tangles) */ | | 495 | /* Register devices with the upper 'layers' (tangles) */ |
482 | RegisterPointerDevice(mouse); | | 496 | RegisterPointerDevice(mouse); |
483 | RegisterKeyboardDevice(keyboard); | | 497 | RegisterKeyboardDevice(keyboard); |
484 | miRegisterPointerDevice(screenInfo.screens[0], mouse); | | 498 | miRegisterPointerDevice(screenInfo.screens[0], mouse); |
485 | if (!mieqInit(keyboard, mouse)) | | 499 | if (!mieqInit((DevicePtr)keyboard, (DevicePtr)mouse)) |
486 | FatalError("mieqInit failed!!\n"); | | 500 | FatalError("mieqInit failed!!\n"); |
487 | | | 501 | |
488 | /* Start taking some SIGIOs on input device file descriptors. */ | | 502 | /* Start taking some SIGIOs on input device file descriptors. */ |
489 | #ifdef HAVE_BUSMOUSE | | 503 | #ifdef HAVE_BUSMOUSE |
490 | if (private.mouse_fd >= 0) | | 504 | if (private.mouse_fd >= 0) |
491 | fcntl(private.mouse_fd, F_SETFL, O_ASYNC | O_NONBLOCK); | | 505 | fcntl(private.mouse_fd, F_SETFL, O_ASYNC | O_NONBLOCK); |
492 | #endif /* HAVE_BUSMOUSE */ | | 506 | #endif /* HAVE_BUSMOUSE */ |
493 | if (private.wsmouse_fd >= 0) | | 507 | if (private.wsmouse_fd >= 0) |
494 | fcntl(private.wsmouse_fd, F_SETFL, O_ASYNC | O_NONBLOCK); | | 508 | fcntl(private.wsmouse_fd, F_SETFL, O_ASYNC | O_NONBLOCK); |
495 | #ifdef HAVE_KBD | | 509 | #ifdef HAVE_KBD |
496 | if (private.kbd_fd >= 0) | | 510 | if (private.kbd_fd >= 0) |
497 | fcntl(private.kbd_fd, F_SETFL, O_ASYNC | O_NONBLOCK); | | 511 | fcntl(private.kbd_fd, F_SETFL, O_ASYNC | O_NONBLOCK); |
498 | #endif | | 512 | #endif |