Reshuffling, formatting and shortening.

This commit is contained in:
Camilla Berglund
2011-10-06 23:28:56 +02:00
parent 29a4eca87d
commit 9738728298
13 changed files with 194 additions and 161 deletions
+42 -47
View File
@@ -33,9 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
void showMouseCursor(_GLFWwindow* window);
void captureMouseCursor(_GLFWwindow* window);
//========================================================================
// Convert BPP to RGB bits based on "best guess"
//========================================================================
@@ -148,6 +145,48 @@ static void setForegroundWindow(HWND hWnd)
}
//========================================================================
// Hide mouse cursor (lock it)
//========================================================================
static void hideMouseCursor(_GLFWwindow* window)
{
ShowCursor(FALSE);
}
//========================================================================
// Show mouse cursor (unlock it)
//========================================================================
static void showMouseCursor(_GLFWwindow* window)
{
// Un-capture cursor
ReleaseCapture();
// Release the cursor from the window
ClipCursor(NULL);
ShowCursor(TRUE);
}
//========================================================================
// Capture mouse cursor
//========================================================================
static void captureMouseCursor(_GLFWwindow* window)
{
RECT ClipWindowRect;
// Clip cursor to the window
if (GetWindowRect(window->Win32.handle, &ClipWindowRect))
ClipCursor(&ClipWindowRect);
// Capture cursor to user window
SetCapture(window->Win32.handle);
}
//========================================================================
// Returns the specified attribute of the specified pixel format
// NOTE: Do not call this unless we have found WGL_ARB_pixel_format
@@ -1848,50 +1887,6 @@ void _glfwPlatformWaitEvents(void)
}
//========================================================================
// Hide mouse cursor (lock it)
//========================================================================
void hideMouseCursor(_GLFWwindow* window)
{
ShowCursor(FALSE);
captureMouseCursor(window);
}
//========================================================================
// Show mouse cursor (unlock it)
//========================================================================
void showMouseCursor(_GLFWwindow* window)
{
// Un-capture cursor
ReleaseCapture();
// Release the cursor from the window
ClipCursor(NULL);
ShowCursor(TRUE);
}
//========================================================================
// Capture mouse cursor
//========================================================================
static void captureMouseCursor(_GLFWwindow* window)
{
RECT ClipWindowRect;
// Clip cursor to the window
if (GetWindowRect(window->Win32.handle, &ClipWindowRect))
ClipCursor(&ClipWindowRect);
// Capture cursor to user window
SetCapture(window->Win32.handle);
}
//========================================================================
// Set physical mouse cursor position
//========================================================================