Date: Tue, 26 Apr 2005 11:49:07 +0800 From: Wilson Loi Subject: Win32 screen/keypad/mouse driver for microwindows Hi, Greg, Here is a Win32 scr/kbd/mou driver for microwindows.=20 I just test it in NONNETWORK mode.=20 Please update it to 0.92 version . Thanks.=20 BTW, We should=20 1)add the folowing code in srvmain.c file=20 2) move all win32xxxx.h header file to include/mwin should be better.=20 #if WIN32 static void HandleKeyMessage(MSG *msg, GR_EVENT_TYPE keyType) { int keystatus =3D -1; MWKEY mwkey =3D msg->wParam; // virtual-key code=20 MWKEYMOD modifiers =3D 0; unsigned char scanCode; int repeat, extended, context, previous; repeat =3D msg->lParam & 0xffff; scanCode =3D (msg->lParam >> 16) & 0xff; extended =3D msg->lParam & 1000000; context =3D msg->lParam & 20000000; previous =3D msg->lParam & 40000000; if (extended) { }=20 GsDeliverKeyboardEvent(0, keyType, mwkey, modifiers, scanCode); } #define MAX_MOUSEEVENTS 10 /* max number of mouse event to get in 1 select= =20 */ #define MAX_KEYBDEVENTS 10 /* max number of mouse event to get in 1 select= =20 */ extern HWND rootWindow; extern MSG *winMouseMsg; void=20 GsSelect(GR_TIMEOUT timeout) { MSG msg; int mouseevents =3D 0; int keybdevents =3D 0; GR_EVENT_GENERAL *gp; if (rootWindow =3D=3D NULL) { goto err_exit; } if (timeout =3D=3D 0) { if (!PeekMessage(&msg, rootWindow, 0, 0, PM_REMOVE)) { Sleep(20); return; } } else if (timeout =3D=3D -1) { if (GetMessage(&msg, rootWindow, 0, 0) < 0) { goto err_exit; } } else { while (1)=20 { if (PeekMessage(&msg, rootWindow, 0, 0, PM_REMOVE)) { break; } Sleep(20); if (timeout < 20) { /* Timeout has occured.=20 ** Currently return a timeout event regardless of whether client=20 ** has selected for it. */ if ((gp =3D (GR_EVENT_GENERAL *)GsAllocEvent(curclient)) !=3D NULL) { gp->type =3D GR_EVENT_TYPE_TIMEOUT; } return; } timeout -=3D20; }=20 } switch (msg.message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: HandleKeyMessage(&msg, GR_EVENT_TYPE_KEY_DOWN); break; case WM_KEYUP: case WM_SYSKEYUP: HandleKeyMessage(&msg, GR_EVENT_TYPE_KEY_UP); break; case WM_MOUSEMOVE: case WM_LBUTTONDOWN: case WM_LBUTTONUP:=20 case WM_LBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_RBUTTONDBLCLK: winMouseMsg =3D &msg; GsCheckMouseEvent(); winMouseMsg =3D NULL; break; }=20 TranslateMessage(&msg); DispatchMessage(&msg); return; err_exit: GsTerminate(); return; } #endif filename="win32drv.zip"