dmxinputinit.h
Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2002 Red Hat Inc., Durham, North Carolina.
    00003  *
    00004  * All Rights Reserved.
    00005  *
    00006  * Permission is hereby granted, free of charge, to any person obtaining
    00007  * a copy of this software and associated documentation files (the
    00008  * "Software"), to deal in the Software without restriction, including
    00009  * without limitation on the rights to use, copy, modify, merge,
    00010  * publish, distribute, sublicense, and/or sell copies of the Software,
    00011  * and to permit persons to whom the Software is furnished to do so,
    00012  * subject to the following conditions:
    00013  *
    00014  * The above copyright notice and this permission notice (including the
    00015  * next paragraph) shall be included in all copies or substantial
    00016  * portions of the Software.
    00017  *
    00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00019  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    00021  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
    00022  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    00023  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00024  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    00025  * SOFTWARE.
    00026  */
    00027
    00028 /*
    00029  * Authors:
    00030  *   Rickard E. (Rik) Faith <faith@redhat.com>
    00031  *
    00032  */
    00033
    00037 #ifndef _DMXINPUTINIT_H_
    00038 #define _DMXINPUTINIT_H_
    00039
    00040 #include "dmx.h"
    00041 #include "dmxinput.h"
    00042 #include "dmxlog.h"
    00043
    00044
    00045 #define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
    00046 #define DMX_LOCAL_DEFAULT_POINTER  "ps2"
    00047 #define DMX_MAX_BUTTONS            256
    00048 #define DMX_MOTION_SIZE            256
    00049 #define DMX_MAX_VALUATORS          32
    00050 #define DMX_MAX_AXES               32
    00051 #define DMX_MAX_XINPUT_EVENT_TYPES 100
    00052 #define DMX_MAP_ENTRIES            16 /* Must be a power of 2 */
    00053 #define DMX_MAP_MASK               (DMX_MAP_ENTRIES - 1)
    00054
    00055 typedef enum {
    00056     DMX_FUNCTION_GRAB,
    00057     DMX_FUNCTION_TERMINATE,
    00058     DMX_FUNCTION_FINE
    00059 } DMXFunctionType;
    00060
    00061 typedef enum {
    00062     DMX_LOCAL_HIGHLEVEL,
    00063     DMX_LOCAL_KEYBOARD,
    00064     DMX_LOCAL_MOUSE,
    00065     DMX_LOCAL_OTHER
    00066 } DMXLocalInputType;
    00067
    00068 typedef enum {
    00069     DMX_LOCAL_TYPE_LOCAL,
    00070     DMX_LOCAL_TYPE_CONSOLE,
    00071     DMX_LOCAL_TYPE_BACKEND,
    00072     DMX_LOCAL_TYPE_COMMON
    00073 } DMXLocalInputExtType;
    00074
    00075 typedef enum {
    00076     DMX_RELATIVE,
    00077     DMX_ABSOLUTE,
    00078     DMX_ABSOLUTE_CONFINED
    00079 } DMXMotionType;
    00080
    00083 typedef struct _DMXLocalInitInfo {
    00084     int                  keyboard;
    00086     int                  keyClass;
    00087     KeySymsRec           keySyms;
    00088     int                  freemap;
    00089     CARD8                modMap[MAP_LENGTH];
    00090     XkbDescPtr           xkb;
    00091     XkbComponentNamesRec names;
    00092     int                  freenames;
    00093     int                  force;
    00095     int                  buttonClass;
    00096     int                  numButtons;
    00097     unsigned char        map[DMX_MAX_BUTTONS];
    00099     int                  valuatorClass;
    00101     int                  numRelAxes;
    00102     int                  numAbsAxes;
    00103     int                  minval[DMX_MAX_AXES];
    00104     int                  maxval[DMX_MAX_AXES];
    00105     int                  res[DMX_MAX_AXES];
    00106     int                  minres[DMX_MAX_AXES];
    00107     int                  maxres[DMX_MAX_AXES];
    00109     int                  focusClass;
    00111     int                  proximityClass;
    00113     int                  kbdFeedbackClass;
    00115     int                  ptrFeedbackClass;
    00117     int                  ledFeedbackClass;
    00119     int                  belFeedbackClass;
    00121     int                  intFeedbackClass;
    00123     int                  strFeedbackClass;
    00126     int                  maxSymbols;
    00127     int                  maxSymbolsSupported;
    00128     KeySym               *symbols;
    00129 } DMXLocalInitInfo, *DMXLocalInitInfoPtr;
    00130
    00131 typedef pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
    00132 typedef void    (*dmxDestroyPrivateProcPtr)(pointer);
    00133
    00134 typedef void    (*dmxInitProcPtr)(DevicePtr);
    00135 typedef void    (*dmxReInitProcPtr)(DevicePtr);
    00136 typedef void    (*dmxLateReInitProcPtr)(DevicePtr);
    00137 typedef void    (*dmxGetInfoProcPtr)(DevicePtr, DMXLocalInitInfoPtr);
    00138 typedef int     (*dmxOnProcPtr)(DevicePtr);
    00139 typedef void    (*dmxOffProcPtr)(DevicePtr);
    00140 typedef void    (*dmxUpdatePositionProcPtr)(pointer, int x, int y);
    00141
    00142 typedef void    (*dmxVTPreSwitchProcPtr)(pointer);  /* Turn I/O Off */
    00143 typedef void    (*dmxVTPostSwitchProcPtr)(pointer); /* Turn I/O On */
    00144 typedef void    (*dmxVTSwitchReturnProcPtr)(pointer);
    00145 typedef int     (*dmxVTSwitchProcPtr)(pointer, int vt,
    00146                                       dmxVTSwitchReturnProcPtr, pointer);
    00147
    00148 typedef void    (*dmxMotionProcPtr)(DevicePtr,
    00149                                     int *valuators,
    00150                                     int firstAxis,
    00151                                     int axesCount,
    00152                                     DMXMotionType type,
    00153                                     DMXBlockType block);
    00154 typedef void    (*dmxEnqueueProcPtr)(DevicePtr, int type, int detail,
    00155                                      KeySym keySym, XEvent *e,
    00156                                      DMXBlockType block);
    00157 typedef int     (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
    00158 typedef void    (*dmxCollectEventsProcPtr)(DevicePtr,
    00159                                            dmxMotionProcPtr,
    00160                                            dmxEnqueueProcPtr,
    00161                                            dmxCheckSpecialProcPtr,
    00162                                            DMXBlockType);
    00163 typedef void    (*dmxProcessInputProcPtr)(pointer);
    00164 typedef void    (*dmxUpdateInfoProcPtr)(pointer, DMXUpdateType, WindowPtr);
    00165 typedef int     (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
    00166
    00167 typedef void    (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
    00168 typedef void    (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
    00169 typedef void    (*dmxKBBellProcPtr)(DevicePtr, int percent,
    00170                                     int volume, int pitch, int duration);
    00171
    00174 typedef struct _DMXEventMap {
    00175     int remote;
    00176     int server;
    00177 } DMXEventMap;
    00178
    00182 typedef struct _DMXLocalInputInfo {
    00183     const char               *name;
    00184     DMXLocalInputType        type;
    00185     DMXLocalInputExtType     extType;
    00186     int                      binding;
    00190                                 /* Low-level (e.g., keyboard/mouse drivers) */
    00191
    00192     dmxCreatePrivateProcPtr  create_private;
    00195     dmxDestroyPrivateProcPtr destroy_private;
    00198     dmxInitProcPtr           init;
    00199     dmxReInitProcPtr         reinit;
    00202     dmxLateReInitProcPtr     latereinit;
    00206     dmxGetInfoProcPtr        get_info;
    00207     dmxOnProcPtr             on;
    00208     dmxOffProcPtr            off;
    00209     dmxUpdatePositionProcPtr update_position;
    00212     dmxVTPreSwitchProcPtr    vt_pre_switch;
    00213     dmxVTPostSwitchProcPtr   vt_post_switch;
    00214     dmxVTSwitchProcPtr       vt_switch;
    00216     dmxCollectEventsProcPtr  collect_events;
    00219     dmxProcessInputProcPtr   process_input;
    00221     dmxFunctionsProcPtr      functions;
    00222     dmxUpdateInfoProcPtr     update_info;
    00225     dmxMCtrlProcPtr          mCtrl;
    00226     dmxKBCtrlProcPtr         kCtrl;
    00227     dmxKBBellProcPtr         kBell;
    00229     pointer                  private;
    00230     int                      isCore;
    00231     int                      sendsCore;
    00232     KeybdCtrl                kctrl;
    00233     PtrCtrl                  mctrl;
    00235     DeviceIntPtr             pDevice;
    00236     int                      inputIdx;
    00237     int                      lastX, lastY;
    00241     int                      head;
    00243     int                      tail;
    00245     unsigned long            *history;
    00246     int                      *valuators;
    00248                                 /* for XInput ChangePointerDevice */
    00249     int                      (*savedMotionProc)(DeviceIntPtr,
    00250                                                 xTimecoord *,
    00251                                                 unsigned long,
    00252                                                 unsigned long,
    00253                                                 ScreenPtr);
    00254     int                      savedMotionEvents;
    00255     int                      savedSendsCore;
    00257     DMXEventMap              map[DMX_MAP_ENTRIES];
    00258     int                      mapOptimize;
    00262     long                     deviceId;
    00264     const char               *deviceName;
    00266 } DMXLocalInputInfoRec;
    00267
    00268 extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
    00269
    00270 extern void                 dmxLocalInitInput(DMXInputInfo *dmxInput);
    00271 extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
    00272                                               DMXLocalInputInfoPtr s);
    00273
    00274 extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl);
    00275 extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
    00276 extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
    00277                                 pointer ctrl, int unknown);
    00278
    00279 extern int  dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name,
    00280                                           _Xconst char *reason);
    00281
    00282 extern int          dmxInputDetach(DMXInputInfo *dmxInput);
    00283 extern void         dmxInputDetachAll(DMXScreenInfo *dmxScreen);
    00284 extern int          dmxInputDetachId(int id);
    00285 extern DMXInputInfo *dmxInputLocateId(int id);
    00286 extern int          dmxInputAttachConsole(const char *name, int isCore,
    00287                                           int *id);
    00288 extern int          dmxInputAttachBackend(int physicalScreen, int isCore,
    00289                                           int *id);
    00290
    00291 #endif