diff --git a/include/QF/vid.h b/include/QF/vid.h index c7e9201ef..8b4987b1b 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -130,9 +130,6 @@ void VID_SetCaption (const char *text); void VID_GetWindowSize (int def_w, int def_h); -int VID_ForceUnlockedAndReturnState (void); -void VID_ForceLockState (int lk); - void VID_InitGamma (unsigned char *); double VID_GetGamma (void); qboolean VID_SetGamma (double); diff --git a/include/in_win.h b/include/in_win.h index 5c7a43a8e..a0a2e3184 100644 --- a/include/in_win.h +++ b/include/in_win.h @@ -32,19 +32,14 @@ extern qboolean mouseactive; extern float mouse_x, mouse_y; -extern unsigned int uiWheelMessage; extern void IN_UpdateClipCursor (void); extern void IN_ShowMouse (void); extern void IN_HideMouse (void); extern void IN_ActivateMouse (void); -extern void IN_SetQuakeMouseState (void); extern void IN_DeactivateMouse (void); -extern void IN_RestoreOriginalMouseState (void); extern void IN_Init (void); extern void IN_Shutdown (void); -extern void IN_MouseEvent (int mstate); -//extern void IN_MouseMove (usercmd_t *cmd); extern void IN_Move (void); extern void IN_Accumulate (void); extern void IN_Commands (void); diff --git a/include/winquake.h b/include/winquake.h index c04af5fe5..fea159a52 100644 --- a/include/winquake.h +++ b/include/winquake.h @@ -120,7 +120,6 @@ extern qboolean ActiveApp, Minimized; extern qboolean WinNT; -int VID_ForceUnlockedAndReturnState (void); void VID_ForceLockState (int lk); extern qboolean winsock_lib_initialized; @@ -135,9 +134,6 @@ extern HWND hwnd_dialog; extern HANDLE hinput, houtput; -void IN_UpdateClipCursor (void); -void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify); - void S_BlockSound (void); void S_UnblockSound (void); @@ -145,8 +141,6 @@ DWORD *DSOUND_LockBuffer(qboolean lockit); void DSOUND_ClearBuffer(int clear); void DSOUND_Restore(void); -void VID_SetDefaultMode (void); - extern int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData); extern int (PASCAL FAR *pWSACleanup)(void); extern int (PASCAL FAR *pWSAGetLastError)(void); @@ -160,6 +154,11 @@ extern int (PASCAL FAR *pgethostname)(char FAR * name, int namelen); extern struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name); extern struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr, int len, int type); extern int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name, int FAR * namelen); + +HWND WINAPI InitializeWindow (HINSTANCE hInstance, int nCmdShow); +LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +void AppActivate (BOOL fActive, BOOL minimize); #endif /* _WIN32 */ #endif /* _WINQUAKE_H */ diff --git a/libs/video/targets/in_win.c b/libs/video/targets/in_win.c index 6de4d5bca..16ef377e2 100644 --- a/libs/video/targets/in_win.c +++ b/libs/video/targets/in_win.c @@ -61,10 +61,8 @@ HRESULT (WINAPI * pDirectInputCreate) (HINSTANCE hinst, DWORD dwVersion, extern qboolean win_canalttab; extern DEVMODE win_gdevmode; -// mouse public variables -unsigned int uiWheelMessage; - // mouse local variables +static unsigned int uiWheelMessage; static int mouse_buttons; static int mouse_oldbuttonstate; static POINT current_pos; @@ -129,7 +127,6 @@ static DIDATAFORMAT df = { void IN_UpdateClipCursor (void) { - if (mouseinitialized && in_mouse_avail && !dinput) { ClipCursor (&window_rect); } @@ -138,7 +135,6 @@ IN_UpdateClipCursor (void) void IN_ShowMouse (void) { - if (!mouseshowtoggle) { ShowCursor (TRUE); mouseshowtoggle = 1; @@ -148,7 +144,6 @@ IN_ShowMouse (void) void IN_HideMouse (void) { - if (mouseshowtoggle) { ShowCursor (FALSE); mouseshowtoggle = 0; @@ -158,7 +153,6 @@ IN_HideMouse (void) void IN_ActivateMouse (void) { - mouseactivatetoggle = true; if (mouseinitialized) { @@ -185,13 +179,6 @@ IN_ActivateMouse (void) } } -void -IN_SetQuakeMouseState (void) -{ - if (mouseactivatetoggle) - IN_ActivateMouse (); -} - void IN_DeactivateMouse (void) { @@ -218,19 +205,6 @@ IN_DeactivateMouse (void) } } -void -IN_RestoreOriginalMouseState (void) -{ - if (mouseactivatetoggle) { - IN_DeactivateMouse (); - mouseactivatetoggle = true; - } - // try to redraw the cursor so it gets reinitialized, because sometimes it - // has garbage after the mode switch - ShowCursor (TRUE); - ShowCursor (FALSE); -} - static qboolean IN_InitDInput (void) { @@ -412,7 +386,7 @@ IN_LL_Shutdown (void) } } -void +static void IN_MouseEvent (int mstate) { int i; @@ -446,7 +420,6 @@ IN_LL_Ungrab_Input (void) void IN_LL_ClearStates (void) { - if (in_mouse_avail) { mx_accum = 0; my_accum = 0; @@ -456,7 +429,7 @@ IN_LL_ClearStates (void) void IN_LL_SendKeyEvents (void) -{ +{ MSG msg; int mx, my; // HDC hdc; @@ -561,7 +534,7 @@ IN_LL_SendKeyEvents (void) //========================================================================== -unsigned short scantokey[128] = { +static unsigned short scantokey[128] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0, 27, '1', '2', '3', '4', '5', '6', @@ -582,7 +555,7 @@ unsigned short scantokey[128] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned short shift_scantokey[128] = { +static unsigned short shift_scantokey[128] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0, 27, '!', '@', '#', '$', '%', '^', @@ -603,7 +576,7 @@ unsigned short shift_scantokey[128] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned short ext_scantokey[128] = { +static unsigned short ext_scantokey[128] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0, 27, '1', '2', '3', '4', '5', '6', // 0 @@ -624,7 +597,7 @@ unsigned short ext_scantokey[128] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned short shift_ext_scantokey[128] = { +static unsigned short shift_ext_scantokey[128] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0, 27, '!', '@', '#', '$', '%', '^', @@ -652,7 +625,7 @@ unsigned short shift_ext_scantokey[128] = { Map from windows to quake keynums */ -void +static void MapKey (unsigned int keycode, int press, int *k, int *u) { int extended; diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index a384ffb03..b48c76de6 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -57,11 +57,19 @@ static const char rcsid[] = extern const char *gl_renderer; -HGLRC (GLAPIENTRY *qf_wglCreateContext) (HDC); -BOOL (GLAPIENTRY *qf_wglDeleteContext) (HGLRC); -HGLRC (GLAPIENTRY *qf_wglGetCurrentContext) (void); -HDC (GLAPIENTRY *qf_wglGetCurrentDC) (void); -BOOL (GLAPIENTRY *qf_wglMakeCurrent) (HDC, HGLRC); +HWND mainwindow; +qboolean win_canalttab = false; +modestate_t modestate = MS_UNINIT; +RECT window_rect; +DEVMODE win_gdevmode; +int window_center_x, window_center_y, window_x, window_y, window_width, + window_height; + +static HGLRC (GLAPIENTRY *qf_wglCreateContext) (HDC); +static BOOL (GLAPIENTRY *qf_wglDeleteContext) (HGLRC); +static HGLRC (GLAPIENTRY *qf_wglGetCurrentContext) (void); +static HDC (GLAPIENTRY *qf_wglGetCurrentDC) (void); +static BOOL (GLAPIENTRY *qf_wglMakeCurrent) (HDC, HGLRC); #define MAX_MODE_LIST 30 #define VID_ROW_SIZE 3 @@ -93,7 +101,7 @@ typedef struct { int height; } lmode_t; -lmode_t lowresmodes[] = { +static lmode_t lowresmodes[] = { {320, 200}, {320, 240}, {400, 300}, @@ -104,38 +112,27 @@ static int nummodes; static vmode_t modelist[MAX_MODE_LIST]; static vmode_t badmode; -DEVMODE win_gdevmode; -qboolean win_canalttab = false; static qboolean windowed, leavecurrentmode; static int windowed_mouse; static HICON hIcon; -RECT WindowRect; -DWORD WindowStyle, ExWindowStyle; +static RECT WindowRect; +static DWORD WindowStyle; -HWND mainwindow; - -int vid_modenum = NO_MODE; -int vid_realmode; -int vid_default = MODE_WINDOWED; +static int vid_modenum = NO_MODE; +static int vid_realmode; +static int vid_default = MODE_WINDOWED; static int windowed_default; -unsigned char vid_curpal[256 * 3]; static qboolean fullsbardraw = true; -HDC maindc; - -HWND WINAPI InitializeWindow (HINSTANCE hInstance, int nCmdShow); -LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - -modestate_t modestate = MS_UNINIT; - -LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -void AppActivate (BOOL fActive, BOOL minimize); -char *VID_GetModeDescription (int mode); -void GL_Init (void); +static HDC maindc; -void * (WINAPI *glGetProcAddress) (const char *symbol) = NULL; + +static char *VID_GetModeDescription (int mode); +static void GL_Init (void); + +static void * (WINAPI *glGetProcAddress) (const char *symbol) = NULL; void * QFGL_GetProcAddress (void *handle, const char *name) @@ -163,23 +160,9 @@ QFGL_LoadLibrary (void) //==================================== -int window_center_x, window_center_y, window_x, window_y, window_width, - window_height; -RECT window_rect; -void -VID_ForceLockState (int lk) -{ -} - -int -VID_ForceUnlockedAndReturnState (void) -{ - return 0; -} - -void +static void CenterWindow (HWND hWndCenter, int width, int height, BOOL lefttopjustify) { int CenterX, CenterY; @@ -194,7 +177,7 @@ CenterWindow (HWND hWndCenter, int width, int height, BOOL lefttopjustify) SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_DRAWFRAME); } -qboolean +static qboolean VID_SetWindowedMode (int modenum) { HDC hdc; @@ -262,7 +245,7 @@ VID_SetWindowedMode (int modenum) return true; } -qboolean +static qboolean VID_SetFullDIBMode (int modenum) { HDC hdc; @@ -350,7 +333,7 @@ VID_SetFullDIBMode (int modenum) return true; } -int +static int VID_SetMode (int modenum, unsigned char *palette) { int original_mode; @@ -447,7 +430,7 @@ VID_UpdateWindowStatus (int w_x, int w_y) IN_UpdateClipCursor (); } -void +static void GL_Init (void) { GL_Init_Common (); @@ -486,12 +469,6 @@ GL_EndRendering (void) Sbar_Changed (); } -void -VID_SetDefaultMode (void) -{ - IN_DeactivateMouse (); -} - void VID_Shutdown (void) { @@ -534,7 +511,7 @@ VID_Shutdown (void) //========================================================================== -BOOL +static BOOL bSetupPixelFormat (HDC hDC) { PIXELFORMATDESCRIPTOR pfd ; @@ -566,13 +543,13 @@ bSetupPixelFormat (HDC hDC) return TRUE; } -int +static int VID_NumModes (void) { return nummodes; } -vmode_t * +static vmode_t * VID_GetModePtr (int modenum) { if ((modenum >= 0) && (modenum < nummodes)) @@ -581,7 +558,7 @@ VID_GetModePtr (int modenum) return &badmode; } -char * +static char * VID_GetModeDescription (int mode) { char *pinfo; @@ -606,7 +583,7 @@ VID_GetModeDescription (int mode) // KJB: Added this to return the mode driver name in description for console -char * +static char * VID_GetExtModeDescription (int mode) { static char pinfo[40]; @@ -634,58 +611,8 @@ VID_GetExtModeDescription (int mode) return pinfo; } -void -VID_DescribeCurrentMode_f (void) -{ - Con_Printf ("%s\n", VID_GetExtModeDescription (vid_modenum)); -} -void -VID_NumModes_f (void) -{ - if (nummodes == 1) - Con_Printf ("%d video mode is available\n", nummodes); - else - Con_Printf ("%d video modes are available\n", nummodes); -} - -void -VID_DescribeMode_f (void) -{ - int t, modenum; - - modenum = atoi (Cmd_Argv (1)); - - t = leavecurrentmode; - leavecurrentmode = 0; - - Con_Printf ("%s\n", VID_GetExtModeDescription (modenum)); - - leavecurrentmode = t; -} - -void -VID_DescribeModes_f (void) -{ - int i, lnummodes, t; - char *pinfo; - vmode_t *pv; - - lnummodes = VID_NumModes (); - - t = leavecurrentmode; - leavecurrentmode = 0; - - for (i = 1; i < lnummodes; i++) { - pv = VID_GetModePtr (i); - pinfo = VID_GetExtModeDescription (i); - Con_Printf ("%2d: %s\n", i, pinfo); - } - - leavecurrentmode = t; -} - -void +static void VID_InitDIB (HINSTANCE hInstance) { WNDCLASS wc; @@ -735,7 +662,7 @@ VID_InitDIB (HINSTANCE hInstance) nummodes = 1; } -void +static void VID_InitFullDIB (HINSTANCE hInstance) { DEVMODE devmode; @@ -889,16 +816,6 @@ VID_Init (unsigned char *palette) memset (&devmode, 0, sizeof (devmode)); - Cmd_AddCommand ("vid_nummodes", VID_NumModes_f, "Reports the total number " - "of video modes available"); - Cmd_AddCommand ("vid_describecurrentmode", VID_DescribeCurrentMode_f, - "Report current video mode."); - Cmd_AddCommand ("vid_describemode", VID_DescribeMode_f, "Report " - "information on specified video mode, default is " - "current.\n(vid_describemode (mode))"); - Cmd_AddCommand ("vid_describemodes", VID_DescribeModes_f, "Report " - "information on all video modes."); - hIcon = LoadIcon (global_hInstance, MAKEINTRESOURCE (IDI_ICON1)); // FIXME: If you put these back, remember commctrl.h @@ -1161,7 +1078,7 @@ VID_SetGamma (double gamma) return i; } -void +static void VID_SaveGamma (void) { HDC hdc = GetDC (NULL); @@ -1170,7 +1087,7 @@ VID_SaveGamma (void) ReleaseDC (NULL, hdc); } -void +static void VID_RestoreGamma (void) { HDC hdc = GetDC (NULL); diff --git a/nq/source/sys_win.c b/nq/source/sys_win.c index 7d486c27e..da7aa6946 100644 --- a/nq/source/sys_win.c +++ b/nq/source/sys_win.c @@ -135,9 +135,6 @@ startup (void) static void shutdown (void) { - - VID_ForceUnlockedAndReturnState (); - if (tevent) CloseHandle (tevent); diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index e2c3728f2..5caaecf8c 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -117,8 +117,6 @@ startup (void) static void shutdown (void) { - VID_ForceUnlockedAndReturnState (); - if (tevent) CloseHandle (tevent);