#define I_NEED_OS2_H
#include "X.h"
#include "Xpoll.h"
#include "compiler.h"
#include <time.h>
#define INCL_DOSPROCESS
#define INCL_KBD
#define INCL_MOU
#define INCL_DOSDEVIOCTL
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
int os2MouseQueueQuery();
int os2KbdQueueQuery();
void os2RecoverFromPopup();
void os2CheckPopupPending();
extern BOOL os2PopupErrorPending;
int _select2 (int, fd_set *, fd_set *,fd_set *, struct timeval *);
void xf86SoundKbdBell(loudness, pitch, duration)
int loudness;
int pitch;
int duration;
{
DosBeep((ULONG)pitch, (ULONG)duration);
}
void xf86SetKbdLeds(leds)
int leds;
{
KBDINFO kinfo;
APIRET rc;
rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd);
if (!rc) {
kinfo.fsMask = 0x10;
kinfo.fsState &= ~0x70;
kinfo.fsState |= (leds&0x70);
KbdSetStatus(&kinfo,(HKBD)xf86Info.consoleFd);
}
}
int xf86GetKbdLeds()
{
KBDINFO kinfo;
APIRET rc;
rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd);
return rc ? 0 : kinfo.fsState & 0x70;
}
void xf86SetKbdRepeat(char rad)
{
int rc;
int delay = 250;
int rate = 30;
struct {
USHORT Delay;
USHORT Rate;
} rateDelay;
ULONG rateDelaySize = sizeof(rateDelay);
return;
if (xf86Info.kbdRate >= 0)
rate = xf86Info.kbdRate;
if (xf86Info.kbdDelay >= 0)
delay = xf86Info.kbdDelay;
rateDelay.Delay = delay;
rateDelay.Rate = rate;
xf86Msg(X_INFO,"Setting typematic rate: Delay=%d, Rate=%d\n",delay,rate);
rc = DosDevIOCtl( (HFILE) xf86Info.consoleFd,
IOCTL_KEYBOARD,
KBD_SETTYPAMATICRATE,
&rateDelay,
rateDelaySize,
&rateDelaySize,
NULL,
0,
NULL);
if (rc!=0) {
xf86Msg(X_ERROR,"xf86SetKbdRepeat: DosDevIOCtl returned %d\n",rc);
}
}
void xf86KbdInit()
{
}
USHORT OrigKbdState;
USHORT OrigKbdInterim;
typedef struct {
USHORT state;
UCHAR makeCode;
UCHAR breakCode;
USHORT keyID;
} HOTKEYPARAM;
int xf86KbdOn()
{
KBDINFO info;
APIRET rc;
int i,k;
ULONG len;
KbdGetStatus(&info,(HKBD)xf86Info.consoleFd);
OrigKbdState=info.fsMask;
OrigKbdInterim=info.fsInterim;
info.fsMask &= ~0x09;
info.fsMask |= 0x136;
info.fsInterim &= ~0x20;
KbdSetStatus(&info,(HKBD)xf86Info.consoleFd);
return -1;
}
int xf86KbdOff()
{
ULONG len;
APIRET rc;
KBDINFO info;
info.fsMask=OrigKbdState;
info.fsInterim=OrigKbdInterim;
KbdSetStatus(&info,(HKBD)xf86Info.consoleFd);
return -1;
}
#if 0
void xf86MouseInit(mouse)
MouseDevPtr mouse;
{
HMOU fd;
APIRET rc;
USHORT nbut;
if (serverGeneration == 1) {
rc = MouOpen((PSZ)NULL,(PHMOU)&fd);
if (rc != 0)
FatalError("Cannot open mouse, rc=%d\n", rc);
mouse->mseFd = fd;
}
MouFlushQue(fd);
rc = MouGetNumButtons(&nbut,fd);
if (rc == 0)
xf86Msg(X_INFO,"OsMouse has %d button(s).\n",nbut);
}
#endif
#if 0
int xf86MouseOn(mouse)
MouseDevPtr mouse;
{
#if 0
HMOU fd;
APIRET rc;
USHORT nbut;
#endif
xf86Msg (X_ERROR,
"Calling MouseOn, a bad thing.... Must be some bug in the code!\n");
#if 0
if (serverGeneration == 1) {
rc = MouOpen((PSZ)NULL,(PHMOU)&fd);
if (rc != 0)
FatalError("Cannot open mouse, rc=%d\n", rc);
mouse->mseFd = fd;
}
MouFlushQue(fd);
rc = MouGetNumButtons(&nbut,fd);
if (rc == 0)
xf86Msg(X_INFO,"OsMouse has %d button(s).\n",nbut);
return (mouse->mseFd);
#endif
}
#endif
#if 0
Bool xf86SupportedMouseTypes[] =
{
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
};
int xf86NumMouseTypes = sizeof(xf86SupportedMouseTypes) /
sizeof(xf86SupportedMouseTypes[0]);
#endif