InitInput.c revision 706f2543
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/*
38 * Local function prototypes
39 */
40
41#ifdef XWIN_CLIPBOARD
42int winProcEstablishConnection(ClientPtr /* client */);
43int winProcQueryTree(ClientPtr /* client */);
44int winProcSetSelectionOwner(ClientPtr /* client */);
45#endif
46
47
48/*
49 * Local global declarations
50 */
51
52DeviceIntPtr g_pwinPointer;
53DeviceIntPtr g_pwinKeyboard;
54
55/* Called from dix/devices.c */
56/*
57 * All of our keys generate up and down transition notifications,
58 * so all of our keys can be used as modifiers.
59 *
60 * An example of a modifier is mapping the A key to the Control key.
61 * A has to be a legal modifier.  I think.
62 */
63
64Bool
65LegalModifier (unsigned int uiKey, DeviceIntPtr pDevice)
66{
67  return TRUE;
68}
69
70
71/* Called from dix/dispatch.c */
72/*
73 * Run through the Windows message queue(s) one more time.
74 * Tell mi to dequeue the events that we have sent it.
75 */
76void
77ProcessInputEvents (void)
78{
79#if 0
80  ErrorF ("ProcessInputEvents\n");
81#endif
82
83  mieqProcessInputEvents ();
84
85#if 0
86  ErrorF ("ProcessInputEvents - returning\n");
87#endif
88}
89
90
91void DDXRingBell(int volume, int pitch, int duration)
92{
93  /* winKeybdBell is used instead */
94  return;
95}
96
97
98/* See Porting Layer Definition - p. 17 */
99void
100InitInput (int argc, char *argv[])
101{
102#if CYGDEBUG
103  winDebug ("InitInput\n");
104#endif
105
106#ifdef XWIN_CLIPBOARD
107  /*
108   * Wrap some functions at every generation of the server.
109   */
110  if (InitialVector[2] != winProcEstablishConnection)
111    {
112      winProcEstablishConnectionOrig = InitialVector[2];
113      InitialVector[2] = winProcEstablishConnection;
114    }
115  if (g_fXdmcpEnabled
116      && ProcVector[X_QueryTree] != winProcQueryTree)
117    {
118      winProcQueryTreeOrig = ProcVector[X_QueryTree];
119      ProcVector[X_QueryTree] = winProcQueryTree;
120    }
121#endif
122
123  g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE);
124  g_pwinKeyboard = AddInputDevice (serverClient, winKeybdProc, TRUE);
125  g_pwinPointer->name = strdup("Windows mouse");
126  g_pwinKeyboard->name = strdup("Windows keyboard");
127
128  mieqInit ();
129
130  /* Initialize the mode key states */
131  winInitializeModeKeyStates ();
132
133#ifdef HAS_DEVWINDOWS
134  /* Only open the windows message queue device once */
135  if (g_fdMessageQueue == WIN_FD_INVALID)
136    {
137      /* Open a file descriptor for the Windows message queue */
138      g_fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
139
140      if (g_fdMessageQueue == -1)
141	{
142	  FatalError ("InitInput - Failed opening %s\n",
143		      WIN_MSG_QUEUE_FNAME);
144	}
145
146      /* Add the message queue as a device to wait for in WaitForSomething */
147      AddEnabledDevice (g_fdMessageQueue);
148    }
149#endif
150
151#if CYGDEBUG
152  winDebug ("InitInput - returning\n");
153#endif
154}
155
156void
157CloseInput (void)
158{
159}
160