mirror of
https://github.com/glfw/glfw.git
synced 2024-11-12 17:51:48 +00:00
parent
8c4ce9a3de
commit
a10caa4631
@ -77,6 +77,7 @@ does not find Doxygen, the documentation will not be generated.
|
|||||||
- Added `glfwVulkanSupported`, `glfwGetRequiredInstanceExtensions`,
|
- Added `glfwVulkanSupported`, `glfwGetRequiredInstanceExtensions`,
|
||||||
`glfwGetInstanceProcAddress`, `glfwGetPhysicalDevicePresentationSupport` and
|
`glfwGetInstanceProcAddress`, `glfwGetPhysicalDevicePresentationSupport` and
|
||||||
`glfwCreateWindowSurface` for platform independent Vulkan support
|
`glfwCreateWindowSurface` for platform independent Vulkan support
|
||||||
|
- Added `glfwMaximizeWindow` for maximizing windows
|
||||||
- Added `glfwSetWindowSizeLimits` and `glfwSetWindowAspectRatio` for setting
|
- Added `glfwSetWindowSizeLimits` and `glfwSetWindowAspectRatio` for setting
|
||||||
absolute and relative window size limits
|
absolute and relative window size limits
|
||||||
- Added `glfwGetKeyName` for querying the layout-specific name of printable
|
- Added `glfwGetKeyName` for querying the layout-specific name of printable
|
||||||
|
@ -26,6 +26,12 @@ Vulkan header inclusion can be selected with
|
|||||||
[GLFW_INCLUDE_VULKAN](@ref build_macros).
|
[GLFW_INCLUDE_VULKAN](@ref build_macros).
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_32_maximize Window maxmimization supprot
|
||||||
|
|
||||||
|
GLFW now supports window maximization with @ref glfwMaximizeWindow and the
|
||||||
|
[GLFW_MAXIMIZED](@ref window_attribs_wnd) window hint and attribute.
|
||||||
|
|
||||||
|
|
||||||
@section news_31 New features in 3.1
|
@section news_31 New features in 3.1
|
||||||
|
|
||||||
These are the release highlights. For a full list of changes see the
|
These are the release highlights. For a full list of changes see the
|
||||||
|
@ -175,6 +175,9 @@ above other regular windows, also called topmost or always-on-top. This is
|
|||||||
intended primarily for debugging purposes and cannot be used to implement proper
|
intended primarily for debugging purposes and cannot be used to implement proper
|
||||||
full screen windows. This hint is ignored for full screen windows.
|
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.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection window_hints_fb Framebuffer related hints
|
@subsubsection window_hints_fb Framebuffer related hints
|
||||||
|
|
||||||
@ -323,6 +326,7 @@ Window hint | Default value | Supported values
|
|||||||
`GLFW_FOCUSED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
`GLFW_FOCUSED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
`GLFW_AUTO_ICONIFY` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
`GLFW_AUTO_ICONIFY` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
`GLFW_FLOATING` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
`GLFW_FLOATING` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
|
`GLFW_MAXIMIZED` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
`GLFW_RED_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
`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_GREEN_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
`GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
`GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||||
@ -791,6 +795,9 @@ same name.
|
|||||||
`GLFW_ICONIFIED` indicates whether the specified window is iconified, whether by
|
`GLFW_ICONIFIED` indicates whether the specified window is iconified, whether by
|
||||||
the user or with @ref glfwIconifyWindow.
|
the user or with @ref glfwIconifyWindow.
|
||||||
|
|
||||||
|
`GLFW_MAXIMIZED` indicates whether the specified window is maximized, whether by
|
||||||
|
the user or with @ref glfwMaximizeWindow.
|
||||||
|
|
||||||
`GLFW_VISIBLE` indicates whether the specified window is visible. Window
|
`GLFW_VISIBLE` indicates whether the specified window is visible. Window
|
||||||
visibility can be controlled with @ref glfwShowWindow and @ref glfwHideWindow
|
visibility can be controlled with @ref glfwShowWindow and @ref glfwHideWindow
|
||||||
and initial visibility is controlled by the [window hint](@ref window_hints_wnd)
|
and initial visibility is controlled by the [window hint](@ref window_hints_wnd)
|
||||||
|
@ -626,6 +626,7 @@ extern "C" {
|
|||||||
#define GLFW_DECORATED 0x00020005
|
#define GLFW_DECORATED 0x00020005
|
||||||
#define GLFW_AUTO_ICONIFY 0x00020006
|
#define GLFW_AUTO_ICONIFY 0x00020006
|
||||||
#define GLFW_FLOATING 0x00020007
|
#define GLFW_FLOATING 0x00020007
|
||||||
|
#define GLFW_MAXIMIZED 0x00020008
|
||||||
|
|
||||||
#define GLFW_RED_BITS 0x00021001
|
#define GLFW_RED_BITS 0x00021001
|
||||||
#define GLFW_GREEN_BITS 0x00021002
|
#define GLFW_GREEN_BITS 0x00021002
|
||||||
@ -2180,6 +2181,7 @@ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int
|
|||||||
*
|
*
|
||||||
* @sa @ref window_iconify
|
* @sa @ref window_iconify
|
||||||
* @sa glfwRestoreWindow
|
* @sa glfwRestoreWindow
|
||||||
|
* @sa glfwMaximizeWindow
|
||||||
*
|
*
|
||||||
* @since Added in version 2.1.
|
* @since Added in version 2.1.
|
||||||
* @glfw3 Added window handle parameter.
|
* @glfw3 Added window handle parameter.
|
||||||
@ -2191,7 +2193,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
|||||||
/*! @brief Restores the specified window.
|
/*! @brief Restores the specified window.
|
||||||
*
|
*
|
||||||
* This function restores the specified window if it was previously iconified
|
* This function restores the specified window if it was previously iconified
|
||||||
* (minimized). If the window is already restored, this function does nothing.
|
* (minimized) or maximized. If the window is already restored, this function
|
||||||
|
* does nothing.
|
||||||
*
|
*
|
||||||
* If the specified window is a full screen window, the resolution chosen for
|
* If the specified window is a full screen window, the resolution chosen for
|
||||||
* the window is restored on the selected monitor.
|
* the window is restored on the selected monitor.
|
||||||
@ -2205,6 +2208,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
|||||||
*
|
*
|
||||||
* @sa @ref window_iconify
|
* @sa @ref window_iconify
|
||||||
* @sa glfwIconifyWindow
|
* @sa glfwIconifyWindow
|
||||||
|
* @sa glfwMaximizeWindow
|
||||||
*
|
*
|
||||||
* @since Added in version 2.1.
|
* @since Added in version 2.1.
|
||||||
* @glfw3 Added window handle parameter.
|
* @glfw3 Added window handle parameter.
|
||||||
@ -2213,6 +2217,28 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
|
GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Maximizes the specified window.
|
||||||
|
*
|
||||||
|
* This function maximizes the specified window if it was previously not
|
||||||
|
* maximized. If the window is already maximized, this function does nothing.
|
||||||
|
*
|
||||||
|
* If the specified window is a full screen window, this function does nothing.
|
||||||
|
*
|
||||||
|
* @param[in] window The window to maximize.
|
||||||
|
*
|
||||||
|
* @par Thread Safety
|
||||||
|
* This function may only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref window_iconify
|
||||||
|
* @sa glfwIconifyWindow
|
||||||
|
* @sa glfwRestoreWindow
|
||||||
|
*
|
||||||
|
* @since Added in GLFW 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup window
|
||||||
|
*/
|
||||||
|
GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Makes the specified window visible.
|
/*! @brief Makes the specified window visible.
|
||||||
*
|
*
|
||||||
* This function makes the specified window visible if it was previously
|
* This function makes the specified window visible if it was previously
|
||||||
|
@ -851,6 +851,9 @@ static GLFWbool createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (wndconfig->floating)
|
if (wndconfig->floating)
|
||||||
[window->ns.object setLevel:NSFloatingWindowLevel];
|
[window->ns.object setLevel:NSFloatingWindowLevel];
|
||||||
|
|
||||||
|
if (wndconfig->maximized)
|
||||||
|
[window->ns.object zoom:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
||||||
@ -1023,7 +1026,16 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
[window->ns.object deminiaturize:nil];
|
if ([window->ns.object isMiniaturized])
|
||||||
|
[window->ns.object deminiaturize:nil];
|
||||||
|
else if ([window->ns.object isZoomed])
|
||||||
|
[window->ns.object zoom:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (![window->ns.object isZoomed])
|
||||||
|
[window->ns.object zoom:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
@ -1062,6 +1074,11 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|||||||
return [window->ns.object isVisible];
|
return [window->ns.object isVisible];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return [window->ns.object isZoomed];
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -255,6 +255,7 @@ struct _GLFWwndconfig
|
|||||||
GLFWbool focused;
|
GLFWbool focused;
|
||||||
GLFWbool autoIconify;
|
GLFWbool autoIconify;
|
||||||
GLFWbool floating;
|
GLFWbool floating;
|
||||||
|
GLFWbool maximized;
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -673,6 +674,11 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window);
|
|||||||
*/
|
*/
|
||||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @copydoc glfwMaximizeWindow
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window);
|
||||||
|
|
||||||
/*! @copydoc glfwShowWindow
|
/*! @copydoc glfwShowWindow
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
@ -702,6 +708,11 @@ int _glfwPlatformWindowIconified(_GLFWwindow* window);
|
|||||||
*/
|
*/
|
||||||
int _glfwPlatformWindowVisible(_GLFWwindow* window);
|
int _glfwPlatformWindowVisible(_GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns whether the window is maximized.
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window);
|
||||||
|
|
||||||
/*! @copydoc glfwPollEvents
|
/*! @copydoc glfwPollEvents
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
|
@ -467,6 +467,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
mir_surface_set_state(window->mir.surface, mir_surface_state_restored);
|
mir_surface_set_state(window->mir.surface, mir_surface_state_restored);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
MirSurfaceSpec* spec;
|
MirSurfaceSpec* spec;
|
||||||
@ -514,6 +520,13 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|||||||
return mir_surface_get_visibility(window->mir.surface) == mir_surface_visibility_exposed;
|
return mir_surface_get_visibility(window->mir.surface) == mir_surface_visibility_exposed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
EventNode* node = NULL;
|
EventNode* node = NULL;
|
||||||
|
@ -653,6 +653,8 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
|
|||||||
{
|
{
|
||||||
int xpos, ypos, fullWidth, fullHeight;
|
int xpos, ypos, fullWidth, fullHeight;
|
||||||
WCHAR* wideTitle;
|
WCHAR* wideTitle;
|
||||||
|
DWORD style = getWindowStyle(window);
|
||||||
|
DWORD exStyle = getWindowExStyle(window);
|
||||||
|
|
||||||
if (wndconfig->monitor)
|
if (wndconfig->monitor)
|
||||||
{
|
{
|
||||||
@ -671,7 +673,10 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
|
|||||||
xpos = CW_USEDEFAULT;
|
xpos = CW_USEDEFAULT;
|
||||||
ypos = CW_USEDEFAULT;
|
ypos = CW_USEDEFAULT;
|
||||||
|
|
||||||
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
|
if (wndconfig->maximized)
|
||||||
|
style |= WS_MAXIMIZE;
|
||||||
|
|
||||||
|
getFullWindowSize(style, exStyle,
|
||||||
wndconfig->width, wndconfig->height,
|
wndconfig->width, wndconfig->height,
|
||||||
&fullWidth, &fullHeight);
|
&fullWidth, &fullHeight);
|
||||||
}
|
}
|
||||||
@ -684,10 +689,10 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->win32.handle = CreateWindowExW(getWindowExStyle(window),
|
window->win32.handle = CreateWindowExW(exStyle,
|
||||||
_GLFW_WNDCLASSNAME,
|
_GLFW_WNDCLASSNAME,
|
||||||
wideTitle,
|
wideTitle,
|
||||||
getWindowStyle(window),
|
style,
|
||||||
xpos, ypos,
|
xpos, ypos,
|
||||||
fullWidth, fullHeight,
|
fullWidth, fullHeight,
|
||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
@ -1026,6 +1031,11 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
ShowWindow(window->win32.handle, SW_RESTORE);
|
ShowWindow(window->win32.handle, SW_RESTORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
ShowWindow(window->win32.handle, SW_MAXIMIZE);
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
ShowWindow(window->win32.handle, SW_SHOW);
|
ShowWindow(window->win32.handle, SW_SHOW);
|
||||||
@ -1059,6 +1069,11 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|||||||
return IsWindowVisible(window->win32.handle);
|
return IsWindowVisible(window->win32.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return IsZoomed(window->win32.handle);
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
12
src/window.c
12
src/window.c
@ -339,6 +339,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
|||||||
case GLFW_FLOATING:
|
case GLFW_FLOATING:
|
||||||
_glfw.hints.window.floating = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.floating = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_MAXIMIZED:
|
||||||
|
_glfw.hints.window.maximized = hint ? GLFW_TRUE : GLFW_FALSE;
|
||||||
|
break;
|
||||||
case GLFW_VISIBLE:
|
case GLFW_VISIBLE:
|
||||||
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
break;
|
break;
|
||||||
@ -593,6 +596,13 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
|
|||||||
_glfwPlatformRestoreWindow(window);
|
_glfwPlatformRestoreWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwMaximizeWindow(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
_glfwPlatformMaximizeWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
@ -634,6 +644,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
|||||||
return _glfwPlatformWindowIconified(window);
|
return _glfwPlatformWindowIconified(window);
|
||||||
case GLFW_VISIBLE:
|
case GLFW_VISIBLE:
|
||||||
return _glfwPlatformWindowVisible(window);
|
return _glfwPlatformWindowVisible(window);
|
||||||
|
case GLFW_MAXIMIZED:
|
||||||
|
return _glfwPlatformWindowMaximized(window);
|
||||||
case GLFW_RESIZABLE:
|
case GLFW_RESIZABLE:
|
||||||
return window->resizable;
|
return window->resizable;
|
||||||
case GLFW_DECORATED:
|
case GLFW_DECORATED:
|
||||||
|
@ -459,6 +459,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
fprintf(stderr, "_glfwPlatformRestoreWindow not implemented yet\n");
|
fprintf(stderr, "_glfwPlatformRestoreWindow not implemented yet\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
fprintf(stderr, "_glfwPlatformMaximizeWindow not implemented yet\n");
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
wl_shell_surface_set_toplevel(window->wl.shell_surface);
|
wl_shell_surface_set_toplevel(window->wl.shell_surface);
|
||||||
@ -494,6 +500,12 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
handleEvents(0);
|
handleEvents(0);
|
||||||
|
@ -444,6 +444,10 @@ static void detectEWMH(void)
|
|||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
|
||||||
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT =
|
||||||
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT");
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ =
|
||||||
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ");
|
||||||
_glfw.x11.NET_WM_FULLSCREEN_MONITORS =
|
_glfw.x11.NET_WM_FULLSCREEN_MONITORS =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
|
||||||
_glfw.x11.NET_WM_NAME =
|
_glfw.x11.NET_WM_NAME =
|
||||||
|
@ -175,6 +175,8 @@ typedef struct _GLFWlibraryX11
|
|||||||
Atom NET_WM_STATE;
|
Atom NET_WM_STATE;
|
||||||
Atom NET_WM_STATE_ABOVE;
|
Atom NET_WM_STATE_ABOVE;
|
||||||
Atom NET_WM_STATE_FULLSCREEN;
|
Atom NET_WM_STATE_FULLSCREEN;
|
||||||
|
Atom NET_WM_STATE_MAXIMIZED_VERT;
|
||||||
|
Atom NET_WM_STATE_MAXIMIZED_HORZ;
|
||||||
Atom NET_WM_BYPASS_COMPOSITOR;
|
Atom NET_WM_BYPASS_COMPOSITOR;
|
||||||
Atom NET_WM_FULLSCREEN_MONITORS;
|
Atom NET_WM_FULLSCREEN_MONITORS;
|
||||||
Atom NET_ACTIVE_WINDOW;
|
Atom NET_ACTIVE_WINDOW;
|
||||||
|
@ -355,6 +355,24 @@ static GLFWbool createWindow(_GLFWwindow* window,
|
|||||||
0, 1, 0);
|
0, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wndconfig->maximized)
|
||||||
|
{
|
||||||
|
if (_glfw.x11.NET_WM_STATE &&
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||||
|
{
|
||||||
|
const Atom states[2] =
|
||||||
|
{
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ
|
||||||
|
};
|
||||||
|
|
||||||
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
|
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||||
|
PropModeReplace, (unsigned char*) &states, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1820,10 +1838,42 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMapWindow(_glfw.x11.display, window->x11.handle);
|
if (_glfwPlatformWindowIconified(window))
|
||||||
|
XMapWindow(_glfw.x11.display, window->x11.handle);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_glfw.x11.NET_WM_STATE &&
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||||
|
{
|
||||||
|
sendEventToWM(window,
|
||||||
|
_glfw.x11.NET_WM_STATE,
|
||||||
|
_NET_WM_STATE_REMOVE,
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ,
|
||||||
|
1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XFlush(_glfw.x11.display);
|
XFlush(_glfw.x11.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (_glfw.x11.NET_WM_STATE &&
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||||
|
{
|
||||||
|
sendEventToWM(window,
|
||||||
|
_glfw.x11.NET_WM_STATE,
|
||||||
|
_NET_WM_STATE_ADD,
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||||
|
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ,
|
||||||
|
1, 0);
|
||||||
|
XFlush(_glfw.x11.display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
XMapRaised(_glfw.x11.display, window->x11.handle);
|
XMapRaised(_glfw.x11.display, window->x11.handle);
|
||||||
@ -1863,6 +1913,31 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|||||||
return wa.map_state == IsViewable;
|
return wa.map_state == IsViewable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
Atom* states;
|
||||||
|
unsigned long i;
|
||||||
|
GLFWbool maximized = GLFW_FALSE;
|
||||||
|
const unsigned long count =
|
||||||
|
_glfwGetWindowPropertyX11(window->x11.handle,
|
||||||
|
_glfw.x11.NET_WM_STATE,
|
||||||
|
XA_ATOM,
|
||||||
|
(unsigned char**) &states);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (states[i] == _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT ||
|
||||||
|
states[i] == _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||||
|
{
|
||||||
|
maximized = GLFW_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(states);
|
||||||
|
return maximized;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
{
|
{
|
||||||
int count = XPending(_glfw.x11.display);
|
int count = XPending(_glfw.x11.display);
|
||||||
|
@ -62,9 +62,15 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case GLFW_KEY_SPACE:
|
case GLFW_KEY_I:
|
||||||
glfwIconifyWindow(window);
|
glfwIconifyWindow(window);
|
||||||
break;
|
break;
|
||||||
|
case GLFW_KEY_M:
|
||||||
|
glfwMaximizeWindow(window);
|
||||||
|
break;
|
||||||
|
case GLFW_KEY_R:
|
||||||
|
glfwRestoreWindow(window);
|
||||||
|
break;
|
||||||
case GLFW_KEY_ESCAPE:
|
case GLFW_KEY_ESCAPE:
|
||||||
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
||||||
break;
|
break;
|
||||||
@ -240,7 +246,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
glfwPollEvents();
|
glfwWaitEvents();
|
||||||
|
|
||||||
for (i = 0; i < window_count; i++)
|
for (i = 0; i < window_count; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user