static qboolean vid_wassuspended = false;
static qboolean vid_usingmouse = false;
static qboolean vid_usingvsync = false;
-static qboolean vid_usemouse = false;
static qboolean vid_usevsync = false;
static HICON hIcon;
//====================================
-static int window_x, window_y, window_width, window_height;
-static int window_center_x, window_center_y;
+static int window_x, window_y;
static void IN_Activate (qboolean grab);
static void IN_JoyMove (void);
static void IN_StartupMouse (void);
-/*
-================
-VID_UpdateWindowStatus
-================
-*/
-static void VID_UpdateWindowStatus (void)
-{
- window_center_x = window_x + window_width / 2;
- window_center_y = window_y + window_height / 2;
-
- if (mouseinitialized && vid_usingmouse && !dinput_acquired)
- {
- RECT window_rect;
- window_rect.left = window_x;
- window_rect.top = window_y;
- window_rect.right = window_x + window_width;
- window_rect.bottom = window_y + window_height;
- ClipCursor (&window_rect);
- }
-}
-
//====================================
-/*
-=================
-VID_GetWindowSize
-=================
-*/
-void VID_GetWindowSize (int *x, int *y, int *width, int *height)
-{
- *x = 0;
- *y = 0;
- *width = window_width;
- *height = window_height;
-}
-
-
void VID_Finish (void)
{
+ qboolean vid_usemouse;
+
vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
{
case WM_MOVE:
window_x = (int) LOWORD(lParam);
window_y = (int) HIWORD(lParam);
- VID_UpdateWindowStatus ();
+ IN_Activate(false);
break;
case WM_KEYDOWN:
// x and y may be changed by WM_MOVE messages
window_x = CenterX;
window_y = CenterY;
- window_width = width;
- window_height = height;
rect.left += CenterX;
rect.right += CenterX;
rect.top += CenterY;
ShowWindow (mainwindow, SW_SHOWDEFAULT);
UpdateWindow (mainwindow);
- VID_UpdateWindowStatus ();
-
// now we try to make sure we get the focus on the mode switch, because
// sometimes in some systems we don't. We grab the foreground, then
// finish setting up, pump all our messages, and sleep for a little while
vid_isfullscreen = false;
}
-
-/*
-===========
-IN_Activate
-===========
-*/
static void IN_Activate (qboolean grab)
{
if (!mouseinitialized)
RECT window_rect;
window_rect.left = window_x;
window_rect.top = window_y;
- window_rect.right = window_x + window_width;
- window_rect.bottom = window_y + window_height;
+ window_rect.right = window_x + vid.width;
+ window_rect.bottom = window_y + vid.height;
if (mouseparmsvalid)
restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
- SetCursorPos (window_center_x, window_center_y);
+ SetCursorPos ((window_x + vid.width / 2), (window_y + vid.height / 2));
SetCapture (mainwindow);
ClipCursor (&window_rect);
}
else
{
GetCursorPos (¤t_pos);
- mx = current_pos.x - window_center_x;
- my = current_pos.y - window_center_y;
+ mx = current_pos.x - (window_x + vid.width / 2);
+ my = current_pos.y - (window_y + vid.height / 2);
in_mouse_x = mx;
in_mouse_y = my;
// if the mouse has moved, force it to the center, so there's room to move
if (mx || my)
- SetCursorPos (window_center_x, window_center_y);
+ SetCursorPos ((window_x + vid.width / 2), (window_y + vid.height / 2));
}
}