mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Reshuffling, formatting and shortening.
This commit is contained in:
+42
-47
@@ -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
|
||||
//========================================================================
|
||||
|
||||
Reference in New Issue
Block a user