Jelajahi Sumber

Cleanup

Related to #842.
Camilla Löwy 8 tahun lalu
induk
melakukan
5a74b5008d
8 mengubah file dengan 24 tambahan dan 15 penghapusan
  1. 3 2
      README.md
  2. 7 0
      docs/news.dox
  3. 5 4
      docs/window.dox
  4. 4 0
      include/GLFW/glfw3.h
  5. 1 1
      src/cocoa_window.m
  6. 0 2
      src/win32_window.c
  7. 3 3
      src/window.c
  8. 1 3
      src/x11_window.c

+ 3 - 2
README.md

@@ -129,6 +129,8 @@ information on what to include when reporting a bug.
 - Added `glfwSetWindowAttrib` function for changing window attributes (#537)
 - Added headless [OSMesa](http://mesa3d.org/osmesa.html) backend (#281,#850)
 - Added definition of `GLAPIENTRY` to public header
+- Added `GLFW_CENTER_CURSOR` window hint for controlling cursor centering
+  (#749,#842)
 - Added macOS specific `GLFW_COCOA_RETINA_FRAMEBUFFER` window hint
 - Added macOS specific `GLFW_COCOA_FRAME_AUTOSAVE` window hint (#195)
 - Added `GLFW_INCLUDE_ES32` for including the OpenGL ES 3.2 header
@@ -159,7 +161,6 @@ information on what to include when reporting a bug.
 - [Cocoa] Bugfix: Windows created after the first were not cascaded (#195)
 - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871)
 - [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid
-- Added 'GLFW_CENTER_CURSOR' window hint for controlling cursor centering
 
 
 ## Contact
@@ -247,6 +248,7 @@ skills.
  - Bryce Mehring
  - Jonathan Mercier
  - Marcel Metz
+ - Liam Middlebrook
  - Jonathan Miller
  - Kenneth Miller
  - Bruce Mitchener
@@ -308,7 +310,6 @@ skills.
  - Santi Zupancic
  - Jonas Ådahl
  - Lasse Öörni
- - Liam Middlebrook
  - All the unmentioned and anonymous contributors in the GLFW community, for bug
    reports, patches, feedback, testing and encouragement
 

+ 7 - 0
docs/news.dox

@@ -25,6 +25,13 @@ GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
 windows with @ref glfwSetWindowAttrib.
 
 
+@subsection news_33_centercursor Cursor centering window hint
+
+GLFW now supports controlling whether the cursor is centered over newly created
+full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint)
+window hint.
+
+
 @subsection news_33_moltenvk Support for Vulkan on macOS via MoltenVK
 
 GLFW now supports the `VK_MVK_macos_surface` window surface creation extension

+ 5 - 4
docs/window.dox

@@ -212,6 +212,11 @@ full screen windows.  This hint is ignored for full screen windows.
 __GLFW_MAXIMIZED__ specifies whether the windowed mode window will be maximized
 when created.  This hint is ignored for full screen windows.
 
+@anchor GLFW_CENTER_CURSOR_hint
+__GLFW_CENTER_CURSOR__ specifies whether the cursor should be centered over
+newly created full screen windows.  This hint is ignored for windowed mode
+windows.
+
 
 @subsubsection window_hints_fb Framebuffer related hints
 
@@ -1042,10 +1047,6 @@ __GLFW_MAXIMIZED__ indicates whether the specified window is maximized.  See
 __GLFW_VISIBLE__ indicates whether the specified window is visible.  See @ref
 window_hide for details.
 
-`GLFW_CENTER_CURSOR` indicates whether the cursor should be moved to the center
-of the full screen window during creation. This is ignored for windowed mode
-windows.
-
 @anchor GLFW_RESIZABLE_attrib
 __GLFW_RESIZABLE__ indicates whether the specified window is resizable _by the
 user_.  This can be set before creation with the

+ 4 - 0
include/GLFW/glfw3.h

@@ -686,6 +686,10 @@ extern "C" {
  *  [window attribute](@ref GLFW_MAXIMIZED_attrib).
  */
 #define GLFW_MAXIMIZED              0x00020008
+/*! @brief Cursor centering window hint
+ *
+ *  Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
+ */
 #define GLFW_CENTER_CURSOR          0x00020009
 
 /*! @brief Framebuffer bit depth hint.

+ 1 - 1
src/cocoa_window.m

@@ -1096,7 +1096,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
         if (!acquireMonitor(window))
             return GLFW_FALSE;
 
-    if (wndconfig->centerCursor)
+        if (wndconfig->centerCursor)
             centerCursor(window);
     }
 

+ 0 - 2
src/win32_window.c

@@ -1038,9 +1038,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
             return GLFW_FALSE;
 
         if (wndconfig->centerCursor)
-        {
             centerCursor(window);
-        }
     }
 
     return GLFW_TRUE;

+ 3 - 3
src/window.c

@@ -345,9 +345,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
         case GLFW_COCOA_FRAME_AUTOSAVE:
             _glfw.hints.window.ns.frame = value ? GLFW_TRUE : GLFW_FALSE;
             break;
-	case GLFW_CENTER_CURSOR:
-	    _glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
-	    break;
+        case GLFW_CENTER_CURSOR:
+            _glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
+            break;
         case GLFW_CLIENT_API:
             _glfw.hints.context.client = value;
             break;

+ 1 - 3
src/x11_window.c

@@ -1597,10 +1597,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
         if (!acquireMonitor(window))
             return GLFW_FALSE;
 
-        if(wndconfig->centerCursor)
-        {
+        if (wndconfig->centerCursor)
             centerCursor(window);
-        }
     }
 
     XFlush(_glfw.x11.display);