This commit is contained in:
Fabiitch 2026-09-22 08:03:47 +00:00 • committed by GitHub
commit f43275715a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 3 deletions

View file

@ -120,7 +120,7 @@ information on what to include when reporting a bug.
## Changelog since 3.5
None.
- Added `GLFW_WIN32_NO_REDIRECTION_BITMAP` window hint for Win32 window creation (#2904)
## Contact

View file

@ -486,7 +486,13 @@ window. If this information was not specified when the program was started,
GLFW behaves as if this hint was set to `GLFW_FALSE`. Possible values are
`GLFW_TRUE` and `GLFW_FALSE`. This is ignored on other platforms.
@anchor GLFW_WIN32_NO_REDIRECTION_BITMAP_hint
__GLFW_WIN32_NO_REDIRECTION_BITMAP__ specifies whether to create the window
without a DWM redirection bitmap. This is intended for applications that
provide their window content through DirectComposition. A window created with
this hint requires a rendering path that supports DirectComposition; GLFW does
not validate this. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is
ignored on other platforms.
#### macOS specific hints {#window_hints_osx}
@anchor GLFW_COCOA_FRAME_NAME_hint
@ -575,6 +581,7 @@ GLFW_CONTEXT_DEBUG | `GLFW_FALSE` | `GLFW_TRUE` or `GL
GLFW_OPENGL_PROFILE | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
GLFW_WIN32_KEYBOARD_MENU | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
GLFW_WIN32_SHOWDEFAULT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
GLFW_WIN32_NO_REDIRECTION_BITMAP | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name
GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
GLFW_WAYLAND_APP_ID | `""` | An ASCII encoded Wayland `app_id` name

View file

@ -1129,6 +1129,9 @@ extern "C" {
/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint).
*/
#define GLFW_WIN32_SHOWDEFAULT 0x00025002
/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_NO_REDIRECTION_BITMAP_hint).
*/
#define GLFW_WIN32_NO_REDIRECTION_BITMAP 0x00025003
/*! @brief Wayland specific
* [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
*

View file

@ -425,6 +425,7 @@ struct _GLFWwndconfig
struct {
bool keymenu;
bool showDefault;
bool noRedirectionBitmap;
} win32;
struct {
char appId[256];

View file

@ -36,6 +36,11 @@
#include <windowsx.h>
#include <shellapi.h>
// Some Windows SDKs targeted by GLFW builds omit this documented style.
#ifndef WS_EX_NOREDIRECTIONBITMAP
#define WS_EX_NOREDIRECTIONBITMAP 0x00200000L
#endif
// Returns the window style for the specified window
//
static DWORD getWindowStyle(const _GLFWwindow* window)
@ -1279,6 +1284,11 @@ static int createNativeWindow(_GLFWwindow* window,
DWORD style = getWindowStyle(window);
DWORD exStyle = getWindowExStyle(window);
// This style must be present at CreateWindowExW time; setting it
// afterwards is rejected by Windows.
if (wndconfig->win32.noRedirectionBitmap)
exStyle |= WS_EX_NOREDIRECTIONBITMAP;
if (!_glfw.win32.mainWindowClass)
{
WNDCLASSEXW wc = { sizeof(wc) };
@ -2581,4 +2591,3 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle)
}
#endif // _GLFW_WIN32

View file

@ -378,6 +378,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
case GLFW_WIN32_SHOWDEFAULT:
_glfw.hints.window.win32.showDefault = value;
return;
case GLFW_WIN32_NO_REDIRECTION_BITMAP:
_glfw.hints.window.win32.noRedirectionBitmap = value;
return;
case GLFW_COCOA_GRAPHICS_SWITCHING:
_glfw.hints.context.nsgl.offline = value;
return;