From 58cc4b2c5c2c9a245e09451437dd6f5af4d60c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 6 Feb 2018 14:32:43 +0100 Subject: [PATCH] Move full screen cursor centering to shared code --- src/cocoa_window.m | 3 --- src/win32_window.c | 3 --- src/window.c | 11 ++++++++++- src/x11_window.c | 3 --- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 7de194ab..e1bbce1c 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1178,9 +1178,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformShowWindow(window); _glfwPlatformFocusWindow(window); acquireMonitor(window); - - if (wndconfig->centerCursor) - centerCursor(window); } return GLFW_TRUE; diff --git a/src/win32_window.c b/src/win32_window.c index 1eea316e..4506c8a7 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1244,9 +1244,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformFocusWindow(window); acquireMonitor(window); fitToMonitor(window); - - if (wndconfig->centerCursor) - centerCursor(window); } return GLFW_TRUE; diff --git a/src/window.c b/src/window.c index 44c2c241..38a8982b 100644 --- a/src/window.c +++ b/src/window.c @@ -226,7 +226,16 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, } } - if (!window->monitor) + if (window->monitor) + { + if (wndconfig.centerCursor) + { + int width, height; + _glfwPlatformGetWindowSize(window, &width, &height); + _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0); + } + } + else { if (wndconfig.visible) { diff --git a/src/x11_window.c b/src/x11_window.c index 749b07f8..f3014ec9 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1975,9 +1975,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformShowWindow(window); updateWindowMode(window); acquireMonitor(window); - - if (wndconfig->centerCursor) - centerCursor(window); } XFlush(_glfw.x11.display);