InitInput.c revision 35c4bbdf
1/* 2 3 Copyright 1993, 1998 The Open Group 4 5 Permission to use, copy, modify, distribute, and sell this software and its 6 documentation for any purpose is hereby granted without fee, provided that 7 the above copyright notice appear in all copies and that both that 8 copyright notice and this permission notice appear in supporting 9 documentation. 10 11 The above copyright notice and this permission notice shall be included 12 in all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 OTHER DEALINGS IN THE SOFTWARE. 21 22 Except as contained in this notice, the name of The Open Group shall 23 not be used in advertising or otherwise to promote the sale, use or 24 other dealings in this Software without prior written authorization 25 from The Open Group. 26 27*/ 28 29#ifdef HAVE_XWIN_CONFIG_H 30#include <xwin-config.h> 31#endif 32#include "win.h" 33#include "dixstruct.h" 34#include "inputstr.h" 35 36/* 37 * Local function prototypes 38 */ 39 40#ifdef XWIN_CLIPBOARD 41int winProcEstablishConnection(ClientPtr /* client */ ); 42#endif 43 44/* 45 * Local global declarations 46 */ 47 48DeviceIntPtr g_pwinPointer; 49DeviceIntPtr g_pwinKeyboard; 50 51/* Called from dix/devices.c */ 52/* 53 * All of our keys generate up and down transition notifications, 54 * so all of our keys can be used as modifiers. 55 * 56 * An example of a modifier is mapping the A key to the Control key. 57 * A has to be a legal modifier. I think. 58 */ 59 60Bool 61LegalModifier(unsigned int uiKey, DeviceIntPtr pDevice) 62{ 63 return TRUE; 64} 65 66/* Called from dix/dispatch.c */ 67/* 68 * Run through the Windows message queue(s) one more time. 69 * Tell mi to dequeue the events that we have sent it. 70 */ 71void 72ProcessInputEvents(void) 73{ 74#if 0 75 ErrorF("ProcessInputEvents\n"); 76#endif 77 78 mieqProcessInputEvents(); 79 80#if 0 81 ErrorF("ProcessInputEvents - returning\n"); 82#endif 83} 84 85void 86DDXRingBell(int volume, int pitch, int duration) 87{ 88 /* winKeybdBell is used instead */ 89 return; 90} 91 92/* See Porting Layer Definition - p. 17 */ 93void 94InitInput(int argc, char *argv[]) 95{ 96#if CYGDEBUG 97 winDebug("InitInput\n"); 98#endif 99 100#ifdef XWIN_CLIPBOARD 101 /* 102 * Wrap some functions at every generation of the server. 103 */ 104 if (InitialVector[2] != winProcEstablishConnection) { 105 winProcEstablishConnectionOrig = InitialVector[2]; 106 InitialVector[2] = winProcEstablishConnection; 107 } 108#endif 109 110 if (AllocDevicePair(serverClient, "Windows", 111 &g_pwinPointer, &g_pwinKeyboard, 112 winMouseProc, winKeybdProc, 113 FALSE) != Success) 114 FatalError("InitInput - Failed to allocate slave devices.\n"); 115 116 mieqInit(); 117 118 /* Initialize the mode key states */ 119 winInitializeModeKeyStates(); 120 121#ifdef HAS_DEVWINDOWS 122 /* Only open the windows message queue device once */ 123 if (g_fdMessageQueue == WIN_FD_INVALID) { 124 /* Open a file descriptor for the Windows message queue */ 125 g_fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY); 126 127 if (g_fdMessageQueue == -1) { 128 FatalError("InitInput - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); 129 } 130 131 /* Add the message queue as a device to wait for in WaitForSomething */ 132 AddEnabledDevice(g_fdMessageQueue); 133 } 134#endif 135 136#if CYGDEBUG 137 winDebug("InitInput - returning\n"); 138#endif 139} 140 141void 142CloseInput(void) 143{ 144 mieqFini(); 145} 146