mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-22 18:28:52 -05:00
Win32: Add GLFW_WIN32_KEYBOARD_MENU
This platform specific window hint enables access to the Windows window menu via the keyboard shortcuts.
This commit is contained in:
parent
de23429455
commit
8e288dc94c
|
@ -123,6 +123,8 @@ information on what to include when reporting a bug.
|
|||
relocatable (#1470)
|
||||
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
|
||||
- Bugfix: Compiling with -Wextra-semi caused warnings (#1440)
|
||||
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
|
||||
to the window menu
|
||||
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
||||
symbol redefinition (#1524)
|
||||
- [Win32] Bugfix: The cursor position event was emitted before its cursor enter
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
|
||||
@subsection features_34 New features in version 3.4
|
||||
|
||||
@subsubsection features_34_win32_keymenu Support for keyboard access to Windows window menu
|
||||
|
||||
GLFW now provides the
|
||||
[GLFW_WIN32_KEYBOARD_MENU](@ref GLFW_WIN32_KEYBOARD_MENU_hint) window hint for
|
||||
enabling keyboard access to the window menu via the Alt+Space and
|
||||
Alt-and-then-Space shortcuts. This may be useful for more GUI-oriented
|
||||
applications.
|
||||
|
||||
|
||||
@subsection caveats_34 Caveats for version 3.4
|
||||
|
||||
@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project
|
||||
|
@ -35,6 +44,8 @@ add_subdirectory(path/to/glfw)
|
|||
@subsubsection types_34 New types in version 3.4
|
||||
@subsubsection constants_34 New constants in version 3.4
|
||||
|
||||
- @ref GLFW_WIN32_KEYBOARD_MENU
|
||||
|
||||
|
||||
@section news_archive Release notes for earlier versions
|
||||
|
||||
|
|
|
@ -455,6 +455,14 @@ The no error mode for OpenGL and OpenGL ES is described in detail by the
|
|||
extension.
|
||||
|
||||
|
||||
@subsubsection window_hints_win32 Windows specific window hints
|
||||
|
||||
@anchor GLFW_WIN32_KEYBOARD_MENU_hint
|
||||
__GLFW_WIN32_KEYBOARD_MENU__ specifies whether to allow access to the window
|
||||
menu via the Alt+Space and Alt-and-then-Space keyboard shortcuts. This is
|
||||
ignored on other platforms.
|
||||
|
||||
|
||||
@subsubsection window_hints_osx macOS specific window hints
|
||||
|
||||
@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
|
||||
|
@ -535,6 +543,7 @@ GLFW_CONTEXT_RELEASE_BEHAVIOR | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_
|
|||
GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
GLFW_OPENGL_DEBUG_CONTEXT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
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_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `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`
|
||||
|
|
|
@ -1003,6 +1003,7 @@ extern "C" {
|
|||
* [window hint](@ref GLFW_X11_CLASS_NAME_hint).
|
||||
*/
|
||||
#define GLFW_X11_INSTANCE_NAME 0x00024002
|
||||
#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
|
||||
/*! @} */
|
||||
|
||||
#define GLFW_NO_API 0
|
||||
|
|
|
@ -274,6 +274,9 @@ struct _GLFWwndconfig
|
|||
char className[256];
|
||||
char instanceName[256];
|
||||
} x11;
|
||||
struct {
|
||||
GLFWbool keymenu;
|
||||
} win32;
|
||||
};
|
||||
|
||||
// Context configuration
|
||||
|
|
|
@ -315,6 +315,7 @@ typedef struct _GLFWwindowWin32
|
|||
// Whether to enable framebuffer transparency on DWM
|
||||
GLFWbool transparent;
|
||||
GLFWbool scaleToMonitor;
|
||||
GLFWbool keymenu;
|
||||
|
||||
// The last received cursor position, regardless of source
|
||||
int lastCursorPosX, lastCursorPosY;
|
||||
|
|
|
@ -699,7 +699,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
|
||||
// User trying to access application menu using ALT?
|
||||
case SC_KEYMENU:
|
||||
{
|
||||
if (!window->win32.keymenu)
|
||||
return 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -731,6 +736,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
}
|
||||
|
||||
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
||||
|
||||
if (uMsg == WM_SYSCHAR && window->win32.keymenu)
|
||||
break;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1275,6 +1284,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
}
|
||||
|
||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||
window->win32.keymenu = wndconfig->win32.keymenu;
|
||||
|
||||
// Adjust window rect to account for DPI scaling of the window frame and
|
||||
// (if enabled) DPI scaling of the content area
|
||||
|
|
|
@ -363,6 +363,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
|||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_WIN32_KEYBOARD_MENU:
|
||||
_glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
|
|
|
@ -101,6 +101,7 @@ int main(int argc, char** argv)
|
|||
monitor = glfwGetPrimaryMonitor();
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||
|
||||
window = glfwCreateWindow(800, 400, "Gamma Test", NULL, NULL);
|
||||
if (!window)
|
||||
|
|
|
@ -202,6 +202,7 @@ int main(int argc, char** argv)
|
|||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||
|
||||
window = glfwCreateWindow(width, height, "Input lag test", monitor, NULL);
|
||||
if (!window)
|
||||
|
|
|
@ -182,6 +182,7 @@ int main(void)
|
|||
exit(EXIT_FAILURE);
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||
|
||||
window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL);
|
||||
if (!window)
|
||||
|
|
|
@ -59,6 +59,7 @@ int main(int argc, char** argv)
|
|||
exit(EXIT_FAILURE);
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||
|
||||
window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
|
||||
if (!window)
|
||||
|
|
Loading…
Reference in New Issue
Block a user