static qboolean multithreadedgl;
static qboolean mouse_avail = true;
static qboolean vid_usingmouse = false;
+static qboolean vid_usinghidecursor = false;
static qboolean vid_usingnoaccel = false;
static qboolean vid_isfullscreen = false;
*height = scr_height;
}
-void VID_GrabMouse(qboolean grab)
+void VID_SetMouse(qboolean fullscreengrab, qboolean relative, qboolean hidecursor)
{
- if (grab)
+ if (!mouse_avail || !window)
+ relative = hidecursor = false;
+
+ if (relative)
{
if(vid_usingmouse && (vid_usingnoaccel != !!apple_mouse_noaccel.integer))
- VID_GrabMouse(false); // ungrab first!
- if (!vid_usingmouse && mouse_avail && window)
+ VID_SetMouse(false, false, false); // ungrab first!
+ if (!vid_usingmouse)
{
Rect winBounds;
CGPoint winCenter;
SelectWindow(window);
- CGDisplayHideCursor(CGMainDisplayID());
// Put the mouse cursor at the center of the window
GetWindowBounds (window, kWindowContentRgn, &winBounds);
}
CGAssociateMouseAndMouseCursorPosition(true);
- CGDisplayShowCursor(CGMainDisplayID());
vid_usingmouse = false;
}
}
+
+ if (vid_usinghidecursor != hidecursor)
+ {
+ vid_usinghidecursor = hidecursor;
+ if (hidecursor)
+ CGDisplayHideCursor(CGMainDisplayID());
+ else
+ CGDisplayShowCursor(CGMainDisplayID());
+ }
}
#define GAMMA_TABLE_SIZE 256
if (r_render.integer)
{
CHECKGLERROR
- if (r_speeds.integer || gl_finish.integer)
+ if (r_speeds.integer == 2 || gl_finish.integer)
{
qglFinish();CHECKGLERROR
}
if (context == NULL && window == NULL)
return;
- VID_GrabMouse(false);
+ VID_SetMouse(false, false, false);
VID_RestoreSystemGamma();
if (context != NULL)
*attrib++ = AGL_NONE;
}
-int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer, int samples)
+int VID_InitMode(int fullscreen, int *width, int *height, int bpp, int refreshrate, int stereobuffer, int samples)
{
const EventTypeSpec winEvents[] =
{
// Create the window, a bit towards the center of the screen
windowBounds.left = 100;
windowBounds.top = 100;
- windowBounds.right = width + 100;
- windowBounds.bottom = height + 100;
+ windowBounds.right = *width + 100;
+ windowBounds.bottom = *height + 100;
carbonError = CreateNewWindow(kDocumentWindowClass, kWindowStandardFloatingAttributes | kWindowStandardHandlerAttribute, &windowBounds, &window);
if (carbonError != noErr || window == NULL)
{
// TOCHECK: not sure whether or not it's necessary to change the resolution
// "by hand", or if aglSetFullscreen does the job anyway
- refDisplayMode = CGDisplayBestModeForParametersAndRefreshRate(mainDisplay, bpp, width, height, refreshrate, NULL);
+ refDisplayMode = CGDisplayBestModeForParametersAndRefreshRate(mainDisplay, bpp, *width, *height, refreshrate, NULL);
CGDisplaySwitchToMode(mainDisplay, refDisplayMode);
DMGetGDeviceByDisplayID((DisplayIDType)mainDisplay, &gdhDisplay, false);
// Attempt fullscreen if requested
if (fullscreen)
{
- qaglSetFullScreen (context, width, height, refreshrate, 0);
+ qaglSetFullScreen (context, *width, *height, refreshrate, 0);
error = qaglGetError();
if (error != AGL_NO_ERROR)
{
}
}
- scr_width = width;
- scr_height = height;
+ scr_width = *width;
+ scr_height = *height;
if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
Sys_Error("glGetString not found in %s", gl_driver);
multithreadedgl = false;
vid_isfullscreen = fullscreen;
vid_usingmouse = false;
+ vid_usinghidecursor = false;
vid_hidden = false;
vid_activewindow = true;
sound_active = true;
GetEventParameter(theEvent, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(deltaPos), NULL, &deltaPos);
GetEventParameter(theEvent, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(windowPos), NULL, &windowPos);
- if (vid.mouseaim)
+ if (vid_usingmouse)
{
in_mouse_x += deltaPos.x;
in_mouse_y += deltaPos.y;