@@ -76,9 +76,9 @@ static NSUInteger getStyleMask(_GLFWwindow* window)
|
|||||||
return styleMask;
|
return styleMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether the cursor is in the client area of the specified window
|
// Returns whether the cursor is in the content area of the specified window
|
||||||
//
|
//
|
||||||
static GLFWbool cursorInClientArea(_GLFWwindow* window)
|
static GLFWbool cursorInContentArea(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream];
|
const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream];
|
||||||
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
|
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
|
||||||
@@ -133,7 +133,7 @@ static void updateCursorMode(_GLFWwindow* window)
|
|||||||
_glfwPlatformGetCursorPos(window,
|
_glfwPlatformGetCursorPos(window,
|
||||||
&_glfw.ns.restoreCursorPosX,
|
&_glfw.ns.restoreCursorPosX,
|
||||||
&_glfw.ns.restoreCursorPosY);
|
&_glfw.ns.restoreCursorPosY);
|
||||||
_glfwCenterCursor(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
}
|
}
|
||||||
else if (_glfw.ns.disabledCursorWindow == window)
|
else if (_glfw.ns.disabledCursorWindow == window)
|
||||||
@@ -145,7 +145,7 @@ static void updateCursorMode(_GLFWwindow* window)
|
|||||||
_glfw.ns.restoreCursorPosY);
|
_glfw.ns.restoreCursorPosY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorInClientArea(window))
|
if (cursorInContentArea(window))
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
_glfwCenterCursor(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
|
|
||||||
const int maximized = [window->ns.object isZoomed];
|
const int maximized = [window->ns.object isZoomed];
|
||||||
if (window->ns.maximized != maximized)
|
if (window->ns.maximized != maximized)
|
||||||
@@ -418,7 +418,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
[window->context.nsgl.object update];
|
[window->context.nsgl.object update];
|
||||||
|
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
_glfwCenterCursor(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
_glfwPlatformGetWindowPos(window, &x, &y);
|
_glfwPlatformGetWindowPos(window, &x, &y);
|
||||||
@@ -444,12 +444,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (_glfw.ns.disabledCursorWindow == window)
|
if (_glfw.ns.disabledCursorWindow == window)
|
||||||
_glfwCenterCursor(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
|
|
||||||
_glfwInputWindowFocus(window, GLFW_TRUE);
|
_glfwInputWindowFocus(window, GLFW_TRUE);
|
||||||
updateCursorMode(window);
|
updateCursorMode(window);
|
||||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN) hideCursor(window);
|
if (window->cursorMode == GLFW_CURSOR_HIDDEN) hideCursor(window);
|
||||||
if (_glfw.ns.disabledCursorWindow != window && cursorInClientArea(window))
|
if (_glfw.ns.disabledCursorWindow != window && cursorInContentArea(window))
|
||||||
{
|
{
|
||||||
double x = 0, y = 0;
|
double x = 0, y = 0;
|
||||||
_glfwPlatformGetCursorPos(window, &x, &y);
|
_glfwPlatformGetCursorPos(window, &x, &y);
|
||||||
@@ -1943,7 +1943,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
|||||||
|
|
||||||
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||||
{
|
{
|
||||||
if (cursorInClientArea(window))
|
if (cursorInContentArea(window))
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
84
glfw/glfw3.h
vendored
84
glfw/glfw3.h
vendored
@@ -1166,9 +1166,9 @@ typedef void (* GLFWerrorfun)(int,const char*);
|
|||||||
*
|
*
|
||||||
* @param[in] window The window that was moved.
|
* @param[in] window The window that was moved.
|
||||||
* @param[in] xpos The new x-coordinate, in screen coordinates, of the
|
* @param[in] xpos The new x-coordinate, in screen coordinates, of the
|
||||||
* upper-left corner of the client area of the window.
|
* upper-left corner of the content area of the window.
|
||||||
* @param[in] ypos The new y-coordinate, in screen coordinates, of the
|
* @param[in] ypos The new y-coordinate, in screen coordinates, of the
|
||||||
* upper-left corner of the client area of the window.
|
* upper-left corner of the content area of the window.
|
||||||
*
|
*
|
||||||
* @sa @ref window_pos
|
* @sa @ref window_pos
|
||||||
* @sa @ref glfwSetWindowPosCallback
|
* @sa @ref glfwSetWindowPosCallback
|
||||||
@@ -1345,9 +1345,9 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
|||||||
*
|
*
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
* @param[in] xpos The new cursor x-coordinate, relative to the left edge of
|
* @param[in] xpos The new cursor x-coordinate, relative to the left edge of
|
||||||
* the client area.
|
* the content area.
|
||||||
* @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
|
* @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
|
||||||
* client area.
|
* content area.
|
||||||
*
|
*
|
||||||
* @sa @ref cursor_pos
|
* @sa @ref cursor_pos
|
||||||
* @sa @ref glfwSetCursorPosCallback
|
* @sa @ref glfwSetCursorPosCallback
|
||||||
@@ -2618,19 +2618,19 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
|
GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
|
||||||
|
|
||||||
/*! @brief Retrieves the position of the client area of the specified window.
|
/*! @brief Retrieves the position of the content area of the specified window.
|
||||||
*
|
*
|
||||||
* This function retrieves the position, in screen coordinates, of the
|
* This function retrieves the position, in screen coordinates, of the
|
||||||
* upper-left corner of the client area of the specified window.
|
* upper-left corner of the content area of the specified window.
|
||||||
*
|
*
|
||||||
* Any or all of the position arguments may be `NULL`. If an error occurs, all
|
* Any or all of the position arguments may be `NULL`. If an error occurs, all
|
||||||
* non-`NULL` position arguments will be set to zero.
|
* non-`NULL` position arguments will be set to zero.
|
||||||
*
|
*
|
||||||
* @param[in] window The window to query.
|
* @param[in] window The window to query.
|
||||||
* @param[out] xpos Where to store the x-coordinate of the upper-left corner of
|
* @param[out] xpos Where to store the x-coordinate of the upper-left corner of
|
||||||
* the client area, or `NULL`.
|
* the content area, or `NULL`.
|
||||||
* @param[out] ypos Where to store the y-coordinate of the upper-left corner of
|
* @param[out] ypos Where to store the y-coordinate of the upper-left corner of
|
||||||
* the client area, or `NULL`.
|
* the content area, or `NULL`.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
@@ -2650,10 +2650,10 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
||||||
|
|
||||||
/*! @brief Sets the position of the client area of the specified window.
|
/*! @brief Sets the position of the content area of the specified window.
|
||||||
*
|
*
|
||||||
* This function sets the position, in screen coordinates, of the upper-left
|
* This function sets the position, in screen coordinates, of the upper-left
|
||||||
* corner of the client area of the specified windowed mode window. If the
|
* corner of the content area of the specified windowed mode window. If the
|
||||||
* window is a full screen window, this function does nothing.
|
* window is a full screen window, this function does nothing.
|
||||||
*
|
*
|
||||||
* __Do not use this function__ to move an already visible window unless you
|
* __Do not use this function__ to move an already visible window unless you
|
||||||
@@ -2663,8 +2663,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
|||||||
* cannot and should not override these limits.
|
* cannot and should not override these limits.
|
||||||
*
|
*
|
||||||
* @param[in] window The window to query.
|
* @param[in] window The window to query.
|
||||||
* @param[in] xpos The x-coordinate of the upper-left corner of the client area.
|
* @param[in] xpos The x-coordinate of the upper-left corner of the content area.
|
||||||
* @param[in] ypos The y-coordinate of the upper-left corner of the client area.
|
* @param[in] ypos The y-coordinate of the upper-left corner of the content area.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
@@ -2685,9 +2685,9 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
|
GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
|
||||||
|
|
||||||
/*! @brief Retrieves the size of the client area of the specified window.
|
/*! @brief Retrieves the size of the content area of the specified window.
|
||||||
*
|
*
|
||||||
* This function retrieves the size, in screen coordinates, of the client area
|
* This function retrieves the size, in screen coordinates, of the content area
|
||||||
* of the specified window. If you wish to retrieve the size of the
|
* of the specified window. If you wish to retrieve the size of the
|
||||||
* framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
|
* framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
|
||||||
*
|
*
|
||||||
@@ -2696,9 +2696,9 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
|
|||||||
*
|
*
|
||||||
* @param[in] window The window whose size to retrieve.
|
* @param[in] window The window whose size to retrieve.
|
||||||
* @param[out] width Where to store the width, in screen coordinates, of the
|
* @param[out] width Where to store the width, in screen coordinates, of the
|
||||||
* client area, or `NULL`.
|
* content area, or `NULL`.
|
||||||
* @param[out] height Where to store the height, in screen coordinates, of the
|
* @param[out] height Where to store the height, in screen coordinates, of the
|
||||||
* client area, or `NULL`.
|
* content area, or `NULL`.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
@@ -2717,7 +2717,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
|
|||||||
|
|
||||||
/*! @brief Sets the size limits of the specified window.
|
/*! @brief Sets the size limits of the specified window.
|
||||||
*
|
*
|
||||||
* This function sets the size limits of the client area of the specified
|
* This function sets the size limits of the content area of the specified
|
||||||
* window. If the window is full screen, the size limits only take effect
|
* window. If the window is full screen, the size limits only take effect
|
||||||
* once it is made windowed. If the window is not resizable, this function
|
* once it is made windowed. If the window is not resizable, this function
|
||||||
* does nothing.
|
* does nothing.
|
||||||
@@ -2732,11 +2732,11 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
|
|||||||
* @param[in] minwidth The minimum width, in screen coordinates, of the client
|
* @param[in] minwidth The minimum width, in screen coordinates, of the client
|
||||||
* area, or `GLFW_DONT_CARE`.
|
* area, or `GLFW_DONT_CARE`.
|
||||||
* @param[in] minheight The minimum height, in screen coordinates, of the
|
* @param[in] minheight The minimum height, in screen coordinates, of the
|
||||||
* client area, or `GLFW_DONT_CARE`.
|
* content area, or `GLFW_DONT_CARE`.
|
||||||
* @param[in] maxwidth The maximum width, in screen coordinates, of the client
|
* @param[in] maxwidth The maximum width, in screen coordinates, of the client
|
||||||
* area, or `GLFW_DONT_CARE`.
|
* area, or `GLFW_DONT_CARE`.
|
||||||
* @param[in] maxheight The maximum height, in screen coordinates, of the
|
* @param[in] maxheight The maximum height, in screen coordinates, of the
|
||||||
* client area, or `GLFW_DONT_CARE`.
|
* content area, or `GLFW_DONT_CARE`.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
||||||
@@ -2760,7 +2760,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minhe
|
|||||||
|
|
||||||
/*! @brief Sets the aspect ratio of the specified window.
|
/*! @brief Sets the aspect ratio of the specified window.
|
||||||
*
|
*
|
||||||
* This function sets the required aspect ratio of the client area of the
|
* This function sets the required aspect ratio of the content area of the
|
||||||
* specified window. If the window is full screen, the aspect ratio only takes
|
* specified window. If the window is full screen, the aspect ratio only takes
|
||||||
* effect once it is made windowed. If the window is not resizable, this
|
* effect once it is made windowed. If the window is not resizable, this
|
||||||
* function does nothing.
|
* function does nothing.
|
||||||
@@ -2801,9 +2801,9 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minhe
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
|
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
|
||||||
|
|
||||||
/*! @brief Sets the size of the client area of the specified window.
|
/*! @brief Sets the size of the content area of the specified window.
|
||||||
*
|
*
|
||||||
* This function sets the size, in screen coordinates, of the client area of
|
* This function sets the size, in screen coordinates, of the content area of
|
||||||
* the specified window.
|
* the specified window.
|
||||||
*
|
*
|
||||||
* For full screen windows, this function updates the resolution of its desired
|
* For full screen windows, this function updates the resolution of its desired
|
||||||
@@ -2819,9 +2819,9 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
|
|||||||
*
|
*
|
||||||
* @param[in] window The window to resize.
|
* @param[in] window The window to resize.
|
||||||
* @param[in] width The desired width, in screen coordinates, of the window
|
* @param[in] width The desired width, in screen coordinates, of the window
|
||||||
* client area.
|
* content area.
|
||||||
* @param[in] height The desired height, in screen coordinates, of the window
|
* @param[in] height The desired height, in screen coordinates, of the window
|
||||||
* client area.
|
* content area.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
@@ -3274,7 +3274,7 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
|
|||||||
* The window position is ignored when setting a monitor.
|
* The window position is ignored when setting a monitor.
|
||||||
*
|
*
|
||||||
* When the monitor is `NULL`, the position, width and height are used to
|
* When the monitor is `NULL`, the position, width and height are used to
|
||||||
* place the window client area. The refresh rate is ignored when no monitor
|
* place the window content area. The refresh rate is ignored when no monitor
|
||||||
* is specified.
|
* is specified.
|
||||||
*
|
*
|
||||||
* If you only wish to update the resolution of a full screen window or the
|
* If you only wish to update the resolution of a full screen window or the
|
||||||
@@ -3287,10 +3287,10 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
|
|||||||
* @param[in] window The window whose monitor, size or video mode to set.
|
* @param[in] window The window whose monitor, size or video mode to set.
|
||||||
* @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
|
* @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
|
||||||
* @param[in] xpos The desired x-coordinate of the upper-left corner of the
|
* @param[in] xpos The desired x-coordinate of the upper-left corner of the
|
||||||
* client area.
|
* content area.
|
||||||
* @param[in] ypos The desired y-coordinate of the upper-left corner of the
|
* @param[in] ypos The desired y-coordinate of the upper-left corner of the
|
||||||
* client area.
|
* content area.
|
||||||
* @param[in] width The desired with, in screen coordinates, of the client area
|
* @param[in] width The desired with, in screen coordinates, of the content area
|
||||||
* or video mode.
|
* or video mode.
|
||||||
* @param[in] height The desired height, in screen coordinates, of the client
|
* @param[in] height The desired height, in screen coordinates, of the client
|
||||||
* area or video mode.
|
* area or video mode.
|
||||||
@@ -3442,7 +3442,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
|
|||||||
*
|
*
|
||||||
* This function sets the position callback of the specified window, which is
|
* This function sets the position callback of the specified window, which is
|
||||||
* called when the window is moved. The callback is provided with the
|
* called when the window is moved. The callback is provided with the
|
||||||
* position, in screen coordinates, of the upper-left corner of the client area
|
* position, in screen coordinates, of the upper-left corner of the content area
|
||||||
* of the window.
|
* of the window.
|
||||||
*
|
*
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@@ -3470,7 +3470,7 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow
|
|||||||
*
|
*
|
||||||
* This function sets the size callback of the specified window, which is
|
* This function sets the size callback of the specified window, which is
|
||||||
* called when the window is resized. The callback is provided with the size,
|
* called when the window is resized. The callback is provided with the size,
|
||||||
* in screen coordinates, of the client area of the window.
|
* in screen coordinates, of the content area of the window.
|
||||||
*
|
*
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
||||||
@@ -3527,7 +3527,7 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi
|
|||||||
/*! @brief Sets the refresh callback for the specified window.
|
/*! @brief Sets the refresh callback for the specified window.
|
||||||
*
|
*
|
||||||
* This function sets the refresh callback of the specified window, which is
|
* This function sets the refresh callback of the specified window, which is
|
||||||
* called when the client area of the window needs to be redrawn, for example
|
* called when the content area of the window needs to be redrawn, for example
|
||||||
* if the window has been exposed after having been covered by another window.
|
* if the window has been exposed after having been covered by another window.
|
||||||
*
|
*
|
||||||
* On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
|
* On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
|
||||||
@@ -4062,11 +4062,11 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
||||||
|
|
||||||
/*! @brief Retrieves the position of the cursor relative to the client area of
|
/*! @brief Retrieves the position of the cursor relative to the content area of
|
||||||
* the window.
|
* the window.
|
||||||
*
|
*
|
||||||
* This function returns the position of the cursor, in screen coordinates,
|
* This function returns the position of the cursor, in screen coordinates,
|
||||||
* relative to the upper-left corner of the client area of the specified
|
* relative to the upper-left corner of the content area of the specified
|
||||||
* window.
|
* window.
|
||||||
*
|
*
|
||||||
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
|
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
|
||||||
@@ -4082,9 +4082,9 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
|||||||
*
|
*
|
||||||
* @param[in] window The desired window.
|
* @param[in] window The desired window.
|
||||||
* @param[out] xpos Where to store the cursor x-coordinate, relative to the
|
* @param[out] xpos Where to store the cursor x-coordinate, relative to the
|
||||||
* left edge of the client area, or `NULL`.
|
* left edge of the content area, or `NULL`.
|
||||||
* @param[out] ypos Where to store the cursor y-coordinate, relative to the to
|
* @param[out] ypos Where to store the cursor y-coordinate, relative to the to
|
||||||
* top edge of the client area, or `NULL`.
|
* top edge of the content area, or `NULL`.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
@@ -4100,11 +4100,11 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
||||||
|
|
||||||
/*! @brief Sets the position of the cursor, relative to the client area of the
|
/*! @brief Sets the position of the cursor, relative to the content area of the
|
||||||
* window.
|
* window.
|
||||||
*
|
*
|
||||||
* This function sets the position, in screen coordinates, of the cursor
|
* This function sets the position, in screen coordinates, of the cursor
|
||||||
* relative to the upper-left corner of the client area of the specified
|
* relative to the upper-left corner of the content area of the specified
|
||||||
* window. The window must have input focus. If the window does not have
|
* window. The window must have input focus. If the window does not have
|
||||||
* input focus when this function is called, it fails silently.
|
* input focus when this function is called, it fails silently.
|
||||||
*
|
*
|
||||||
@@ -4119,9 +4119,9 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
|||||||
*
|
*
|
||||||
* @param[in] window The desired window.
|
* @param[in] window The desired window.
|
||||||
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
|
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
|
||||||
* client area.
|
* content area.
|
||||||
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
|
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
|
||||||
* client area.
|
* content area.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
@@ -4232,7 +4232,7 @@ GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
|
|||||||
/*! @brief Sets the cursor for the window.
|
/*! @brief Sets the cursor for the window.
|
||||||
*
|
*
|
||||||
* This function sets the cursor image to be used when the cursor is over the
|
* This function sets the cursor image to be used when the cursor is over the
|
||||||
* client area of the specified window. The set cursor will only be visible
|
* content area of the specified window. The set cursor will only be visible
|
||||||
* when the [cursor mode](@ref cursor_mode) of the window is
|
* when the [cursor mode](@ref cursor_mode) of the window is
|
||||||
* `GLFW_CURSOR_NORMAL`.
|
* `GLFW_CURSOR_NORMAL`.
|
||||||
*
|
*
|
||||||
@@ -4314,7 +4314,7 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmo
|
|||||||
* This function sets the cursor position callback of the specified window,
|
* This function sets the cursor position callback of the specified window,
|
||||||
* which is called when the cursor is moved. The callback is provided with the
|
* which is called when the cursor is moved. The callback is provided with the
|
||||||
* position, in screen coordinates, relative to the upper-left corner of the
|
* position, in screen coordinates, relative to the upper-left corner of the
|
||||||
* client area of the window.
|
* content area of the window.
|
||||||
*
|
*
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
||||||
@@ -4337,7 +4337,7 @@ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursor
|
|||||||
/*! @brief Sets the cursor enter/exit callback.
|
/*! @brief Sets the cursor enter/exit callback.
|
||||||
*
|
*
|
||||||
* This function sets the cursor boundary crossing callback of the specified
|
* This function sets the cursor boundary crossing callback of the specified
|
||||||
* window, which is called when the cursor enters or leaves the client area of
|
* window, which is called when the cursor enters or leaves the content area of
|
||||||
* the window.
|
* the window.
|
||||||
*
|
*
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
|
|||||||
6
glfw/input.c
vendored
6
glfw/input.c
vendored
@@ -312,7 +312,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notifies shared code of a cursor motion event
|
// Notifies shared code of a cursor motion event
|
||||||
// The position is specified in client-area relative screen coordinates
|
// The position is specified in content area relative screen coordinates
|
||||||
//
|
//
|
||||||
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
||||||
{
|
{
|
||||||
@@ -565,9 +565,9 @@ const char* _glfwGetKeyName(int key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center the cursor in the middle of the window
|
// Center the cursor in the middle of the content area of the specified window
|
||||||
//
|
//
|
||||||
void _glfwCenterCursor(_GLFWwindow* window)
|
void _glfwCenterCursorInContentArea(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||||
|
|||||||
2
glfw/internal.h
vendored
2
glfw/internal.h
vendored
@@ -773,7 +773,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
int hatCount);
|
int hatCount);
|
||||||
void _glfwFreeJoystick(_GLFWjoystick* js);
|
void _glfwFreeJoystick(_GLFWjoystick* js);
|
||||||
const char* _glfwGetKeyName(int key);
|
const char* _glfwGetKeyName(int key);
|
||||||
void _glfwCenterCursor(_GLFWwindow* window);
|
void _glfwCenterCursorInContentArea(_GLFWwindow* window);
|
||||||
|
|
||||||
GLFWbool _glfwInitVulkan(int mode);
|
GLFWbool _glfwInitVulkan(int mode);
|
||||||
void _glfwTerminateVulkan(void);
|
void _glfwTerminateVulkan(void);
|
||||||
|
|||||||
4
glfw/window.c
vendored
4
glfw/window.c
vendored
@@ -89,7 +89,7 @@ _GLFWwindow* _glfwWindowForId(GLFWid id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notifies shared code that a window has moved
|
// Notifies shared code that a window has moved
|
||||||
// The position is specified in client-area relative screen coordinates
|
// The position is specified in content area relative screen coordinates
|
||||||
//
|
//
|
||||||
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
@@ -254,7 +254,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
if (wndconfig.centerCursor)
|
if (wndconfig.centerCursor)
|
||||||
_glfwCenterCursor(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
2
glfw/x11_window.c
vendored
2
glfw/x11_window.c
vendored
@@ -446,7 +446,7 @@ static void disableCursor(_GLFWwindow* window)
|
|||||||
&_glfw.x11.restoreCursorPosX,
|
&_glfw.x11.restoreCursorPosX,
|
||||||
&_glfw.x11.restoreCursorPosY);
|
&_glfw.x11.restoreCursorPosY);
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
_glfwCenterCursor(window);
|
_glfwCenterCursorInContentArea(window);
|
||||||
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
|
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
|
||||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||||
GrabModeAsync, GrabModeAsync,
|
GrabModeAsync, GrabModeAsync,
|
||||||
|
|||||||
Reference in New Issue
Block a user