From c044bbcb4d3fdc65ac504702386efd614a501a17 Mon Sep 17 00:00:00 2001 From: Diego91b Date: Wed, 10 Jun 2015 02:31:50 -0500 Subject: [PATCH] Checking for error Using GetClientRect, ClientToScreen and ClipCursor return values. --- src/win32_window.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index eb2b117d7..894bda5fd 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -71,13 +71,18 @@ static getWindowExStyle(const _GLFWwindow* window) // Updates the cursor clip rect // -static void updateClipRect(_GLFWwindow* window) +static BOOL updateClipRect(_GLFWwindow* window) { RECT clipRect; - GetClientRect(window->win32.handle, &clipRect); - ClientToScreen(window->win32.handle, (POINT*) &clipRect.left); - ClientToScreen(window->win32.handle, (POINT*) &clipRect.right); - ClipCursor(&clipRect); + if (GetClientRect(window->win32.handle, &clipRect)) + { + if (ClientToScreen(window->win32.handle, (POINT*) &clipRect.left)) + { + if (ClientToScreen(window->win32.handle, (POINT*) &clipRect.right)) + return ClipCursor(&clipRect); + } + } + return FALSE; } // Hide the mouse cursor