InitInput.c revision 35c4bbdf
105b261ecSmrg/* 205b261ecSmrg 305b261ecSmrg Copyright 1993, 1998 The Open Group 405b261ecSmrg 505b261ecSmrg Permission to use, copy, modify, distribute, and sell this software and its 605b261ecSmrg documentation for any purpose is hereby granted without fee, provided that 705b261ecSmrg the above copyright notice appear in all copies and that both that 805b261ecSmrg copyright notice and this permission notice appear in supporting 905b261ecSmrg documentation. 1005b261ecSmrg 1105b261ecSmrg The above copyright notice and this permission notice shall be included 1205b261ecSmrg in all copies or substantial portions of the Software. 1305b261ecSmrg 1405b261ecSmrg THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1505b261ecSmrg OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1605b261ecSmrg MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1705b261ecSmrg IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 1805b261ecSmrg OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1905b261ecSmrg ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2005b261ecSmrg OTHER DEALINGS IN THE SOFTWARE. 2105b261ecSmrg 2205b261ecSmrg Except as contained in this notice, the name of The Open Group shall 2305b261ecSmrg not be used in advertising or otherwise to promote the sale, use or 2405b261ecSmrg other dealings in this Software without prior written authorization 2505b261ecSmrg from The Open Group. 2605b261ecSmrg 2705b261ecSmrg*/ 2805b261ecSmrg 2905b261ecSmrg#ifdef HAVE_XWIN_CONFIG_H 3005b261ecSmrg#include <xwin-config.h> 3105b261ecSmrg#endif 3205b261ecSmrg#include "win.h" 3305b261ecSmrg#include "dixstruct.h" 346747b715Smrg#include "inputstr.h" 3505b261ecSmrg 3605b261ecSmrg/* 3705b261ecSmrg * Local function prototypes 3805b261ecSmrg */ 3905b261ecSmrg 4005b261ecSmrg#ifdef XWIN_CLIPBOARD 4135c4bbdfSmrgint winProcEstablishConnection(ClientPtr /* client */ ); 4205b261ecSmrg#endif 4305b261ecSmrg 4405b261ecSmrg/* 4505b261ecSmrg * Local global declarations 4605b261ecSmrg */ 4705b261ecSmrg 486747b715SmrgDeviceIntPtr g_pwinPointer; 496747b715SmrgDeviceIntPtr g_pwinKeyboard; 5005b261ecSmrg 5105b261ecSmrg/* Called from dix/devices.c */ 5205b261ecSmrg/* 5305b261ecSmrg * All of our keys generate up and down transition notifications, 5405b261ecSmrg * so all of our keys can be used as modifiers. 5535c4bbdfSmrg * 5605b261ecSmrg * An example of a modifier is mapping the A key to the Control key. 5705b261ecSmrg * A has to be a legal modifier. I think. 5805b261ecSmrg */ 5905b261ecSmrg 6005b261ecSmrgBool 6135c4bbdfSmrgLegalModifier(unsigned int uiKey, DeviceIntPtr pDevice) 6205b261ecSmrg{ 6335c4bbdfSmrg return TRUE; 6405b261ecSmrg} 6505b261ecSmrg 6605b261ecSmrg/* Called from dix/dispatch.c */ 6705b261ecSmrg/* 6805b261ecSmrg * Run through the Windows message queue(s) one more time. 6905b261ecSmrg * Tell mi to dequeue the events that we have sent it. 7005b261ecSmrg */ 7105b261ecSmrgvoid 7235c4bbdfSmrgProcessInputEvents(void) 7305b261ecSmrg{ 7405b261ecSmrg#if 0 7535c4bbdfSmrg ErrorF("ProcessInputEvents\n"); 7605b261ecSmrg#endif 7705b261ecSmrg 7835c4bbdfSmrg mieqProcessInputEvents(); 7905b261ecSmrg 8005b261ecSmrg#if 0 8135c4bbdfSmrg ErrorF("ProcessInputEvents - returning\n"); 8205b261ecSmrg#endif 8305b261ecSmrg} 8405b261ecSmrg 8535c4bbdfSmrgvoid 8635c4bbdfSmrgDDXRingBell(int volume, int pitch, int duration) 8705b261ecSmrg{ 8835c4bbdfSmrg /* winKeybdBell is used instead */ 8935c4bbdfSmrg return; 9005b261ecSmrg} 9105b261ecSmrg 9205b261ecSmrg/* See Porting Layer Definition - p. 17 */ 9305b261ecSmrgvoid 9435c4bbdfSmrgInitInput(int argc, char *argv[]) 9505b261ecSmrg{ 9605b261ecSmrg#if CYGDEBUG 9735c4bbdfSmrg winDebug("InitInput\n"); 9805b261ecSmrg#endif 9905b261ecSmrg 10005b261ecSmrg#ifdef XWIN_CLIPBOARD 10135c4bbdfSmrg /* 10235c4bbdfSmrg * Wrap some functions at every generation of the server. 10335c4bbdfSmrg */ 10435c4bbdfSmrg if (InitialVector[2] != winProcEstablishConnection) { 10535c4bbdfSmrg winProcEstablishConnectionOrig = InitialVector[2]; 10635c4bbdfSmrg InitialVector[2] = winProcEstablishConnection; 10705b261ecSmrg } 10805b261ecSmrg#endif 10905b261ecSmrg 11035c4bbdfSmrg if (AllocDevicePair(serverClient, "Windows", 11135c4bbdfSmrg &g_pwinPointer, &g_pwinKeyboard, 11235c4bbdfSmrg winMouseProc, winKeybdProc, 11335c4bbdfSmrg FALSE) != Success) 11435c4bbdfSmrg FatalError("InitInput - Failed to allocate slave devices.\n"); 11505b261ecSmrg 11635c4bbdfSmrg mieqInit(); 11705b261ecSmrg 11835c4bbdfSmrg /* Initialize the mode key states */ 11935c4bbdfSmrg winInitializeModeKeyStates(); 12005b261ecSmrg 12105b261ecSmrg#ifdef HAS_DEVWINDOWS 12235c4bbdfSmrg /* Only open the windows message queue device once */ 12335c4bbdfSmrg if (g_fdMessageQueue == WIN_FD_INVALID) { 12435c4bbdfSmrg /* Open a file descriptor for the Windows message queue */ 12535c4bbdfSmrg g_fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY); 12635c4bbdfSmrg 12735c4bbdfSmrg if (g_fdMessageQueue == -1) { 12835c4bbdfSmrg FatalError("InitInput - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); 12935c4bbdfSmrg } 13035c4bbdfSmrg 13135c4bbdfSmrg /* Add the message queue as a device to wait for in WaitForSomething */ 13235c4bbdfSmrg AddEnabledDevice(g_fdMessageQueue); 13305b261ecSmrg } 13405b261ecSmrg#endif 13505b261ecSmrg 13605b261ecSmrg#if CYGDEBUG 13735c4bbdfSmrg winDebug("InitInput - returning\n"); 13805b261ecSmrg#endif 13905b261ecSmrg} 1406747b715Smrg 1416747b715Smrgvoid 14235c4bbdfSmrgCloseInput(void) 1436747b715Smrg{ 14435c4bbdfSmrg mieqFini(); 1456747b715Smrg} 146