mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Add window hints for initial position
This adds window hints for the initial position, in screen coordinates, of a window. The special value GLFW_ANY_POSITION means the window manager will be allowed to position the window. It is not possible to set window positions on Wayland and GLFW will always behave as if these hints are set to GLFW_ANY_POSITION. Fixes #1603 Fixes #1747
This commit is contained in:
@@ -76,6 +76,14 @@ function pointers corresponding to the standard library functions `malloc`,
|
||||
For more information see @ref init_allocator.
|
||||
|
||||
|
||||
@subsubsection features_34_position_hint Window hints for initial position
|
||||
|
||||
GLFW now provides the @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints for
|
||||
specifying the initial position of the window. This removes the need to create a hidden
|
||||
window, move it and then show it. The default value of these hints is
|
||||
`GLFW_ANY_POSITION`, which selects the previous behavior.
|
||||
|
||||
|
||||
@subsubsection features_34_win32_keymenu Support for keyboard access to Windows window menu
|
||||
|
||||
GLFW now provides the
|
||||
@@ -243,6 +251,9 @@ then GLFW will fail to initialize.
|
||||
- @ref GLFW_ANGLE_PLATFORM_TYPE_METAL
|
||||
- @ref GLFW_X11_XCB_VULKAN_SURFACE
|
||||
- @ref GLFW_CURSOR_CAPTURED
|
||||
- @ref GLFW_POSITION_X
|
||||
- @ref GLFW_POSITION_Y
|
||||
- @ref GLFW_ANY_POSITION
|
||||
|
||||
|
||||
@section news_archive Release notes for earlier versions
|
||||
|
||||
+24
-1
@@ -256,6 +256,14 @@ This is only supported for undecorated windows. Decorated windows with this
|
||||
enabled will behave differently between platforms. Possible values are
|
||||
`GLFW_TRUE` and `GLFW_FALSE`.
|
||||
|
||||
@anchor GLFW_POSITION_X
|
||||
@anchor GLFW_POSITION_Y
|
||||
__GLFW_POSITION_X__ and __GLFW_POSITION_Y__ specify the desired initial position
|
||||
of the window. The window manager may modify or ignore these coordinates. If
|
||||
either or both of these hints are set to `GLFW_ANY_POSITION` then the window
|
||||
manager will position the window where it thinks the user will prefer it.
|
||||
Possible values are any valid screen coordinates and `GLFW_ANY_POSITION`.
|
||||
|
||||
|
||||
@subsubsection window_hints_fb Framebuffer related hints
|
||||
|
||||
@@ -516,6 +524,8 @@ GLFW_TRANSPARENT_FRAMEBUFFER | `GLFW_FALSE` | `GLFW_TRUE` or `GL
|
||||
GLFW_FOCUS_ON_SHOW | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_SCALE_TO_MONITOR | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_MOUSE_PASSTHROUGH | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_POSITION_X | `GLFW_ANY_POSITION` | Any valid screen x-coordinate or `GLFW_ANY_POSITION`
|
||||
GLFW_POSITION_Y | `GLFW_ANY_POSITION` | Any valid screen y-coordinate or `GLFW_ANY_POSITION`
|
||||
GLFW_RED_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
GLFW_GREEN_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
GLFW_BLUE_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
@@ -798,7 +808,20 @@ are undefined if they conflict.
|
||||
|
||||
@subsection window_pos Window position
|
||||
|
||||
The position of a windowed-mode window can be changed with @ref
|
||||
By default, the window manager chooses the position of new windowed mode
|
||||
windows, based on its size and which monitor the user appears to be working on.
|
||||
This is most often the right choice. If you need to create a window at
|
||||
a specific position, you can set the desired position with the @ref
|
||||
GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints.
|
||||
|
||||
@code
|
||||
glfwWindowHint(GLFW_POSITION_X, 70);
|
||||
glfwWindowHint(GLFW_POSITION_Y, 83);
|
||||
@endcode
|
||||
|
||||
To restore the previous behavior, set these hints to `GLFW_ANY_POSITION`.
|
||||
|
||||
The position of a windowed mode window can be changed with @ref
|
||||
glfwSetWindowPos. This moves the window so that the upper-left corner of its
|
||||
content area has the specified [screen coordinates](@ref coordinate_systems).
|
||||
The window system may put limitations on window placement.
|
||||
|
||||
Reference in New Issue
Block a user