mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Added a feature for disabling sticky keys in Windows
This commit is contained in:
parent
72f7489e66
commit
e54901c125
@ -75,6 +75,11 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
# Setup wantVerifyPdb as soon as reasonable:
|
# Setup wantVerifyPdb as soon as reasonable:
|
||||||
Verify.wantVerifyPdb = self.config.GetBool('want-verify-pdb', 0)
|
Verify.wantVerifyPdb = self.config.GetBool('want-verify-pdb', 0)
|
||||||
|
|
||||||
|
# [gjeon] to disable sticky keys
|
||||||
|
storeAccessibilityShortcutKeys()
|
||||||
|
if self.config.GetBool('disable-sticky-keys', 0):
|
||||||
|
allowAccessibilityShortcutKeys(False)
|
||||||
|
|
||||||
self.printEnvDebugInfo()
|
self.printEnvDebugInfo()
|
||||||
vfs = VirtualFileSystem.getGlobalPtr()
|
vfs = VirtualFileSystem.getGlobalPtr()
|
||||||
|
|
||||||
@ -418,6 +423,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
|
|
||||||
This function is designed to be safe to call multiple times."""
|
This function is designed to be safe to call multiple times."""
|
||||||
|
|
||||||
|
# [gjeon] restore sticky key settings
|
||||||
|
allowAccessibilityShortcutKeys(True)
|
||||||
|
|
||||||
taskMgr.destroy()
|
taskMgr.destroy()
|
||||||
|
|
||||||
if getattr(self, 'musicManager', None):
|
if getattr(self, 'musicManager', None):
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
interrogatedb:c dconfig:c dtoolconfig:m \
|
interrogatedb:c dconfig:c dtoolconfig:m \
|
||||||
dtoolutil:c dtoolbase:c dtool:m
|
dtoolutil:c dtoolbase:c dtool:m
|
||||||
|
|
||||||
|
#define WIN_SYS_LIBS \
|
||||||
|
User32.lib
|
||||||
|
|
||||||
#define SOURCES \
|
#define SOURCES \
|
||||||
showBase.cxx showBase.h
|
showBase.cxx showBase.h
|
||||||
|
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "graphicsPipeSelection.h"
|
#include "graphicsPipeSelection.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h> // For SystemParametersInfo()
|
||||||
|
STICKYKEYS g_StartupStickyKeys = {sizeof(STICKYKEYS), 0};
|
||||||
|
TOGGLEKEYS g_StartupToggleKeys = {sizeof(TOGGLEKEYS), 0};
|
||||||
|
FILTERKEYS g_StartupFilterKeys = {sizeof(FILTERKEYS), 0};
|
||||||
|
#endif
|
||||||
|
|
||||||
ConfigureDef(config_showbase);
|
ConfigureDef(config_showbase);
|
||||||
ConfigureFn(config_showbase) {
|
ConfigureFn(config_showbase) {
|
||||||
@ -85,6 +91,61 @@ query_fullscreen_testresult(int xsize, int ysize) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
store_accessibility_shortcut_keys() {
|
||||||
|
#ifdef WIN32
|
||||||
|
SystemParametersInfo(SPI_GETSTICKYKEYS, sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
|
||||||
|
SystemParametersInfo(SPI_GETTOGGLEKEYS, sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
|
||||||
|
SystemParametersInfo(SPI_GETFILTERKEYS, sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
allow_accessibility_shortcut_keys(bool allowKeys) {
|
||||||
|
#ifdef WIN32
|
||||||
|
if( allowKeys )
|
||||||
|
{
|
||||||
|
// Restore StickyKeys/etc to original state and enable Windows key
|
||||||
|
SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
|
||||||
|
SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
|
||||||
|
SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
|
||||||
|
} else {
|
||||||
|
// Disable StickyKeys/etc shortcuts but if the accessibility feature is on,
|
||||||
|
// then leave the settings alone as its probably being usefully used
|
||||||
|
|
||||||
|
STICKYKEYS skOff = g_StartupStickyKeys;
|
||||||
|
if( (skOff.dwFlags & SKF_STICKYKEYSON) == 0 )
|
||||||
|
{
|
||||||
|
// Disable the hotkey and the confirmation
|
||||||
|
skOff.dwFlags &= ~SKF_HOTKEYACTIVE;
|
||||||
|
skOff.dwFlags &= ~SKF_CONFIRMHOTKEY;
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &skOff, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TOGGLEKEYS tkOff = g_StartupToggleKeys;
|
||||||
|
if( (tkOff.dwFlags & TKF_TOGGLEKEYSON) == 0 )
|
||||||
|
{
|
||||||
|
// Disable the hotkey and the confirmation
|
||||||
|
tkOff.dwFlags &= ~TKF_HOTKEYACTIVE;
|
||||||
|
tkOff.dwFlags &= ~TKF_CONFIRMHOTKEY;
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), &tkOff, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FILTERKEYS fkOff = g_StartupFilterKeys;
|
||||||
|
if( (fkOff.dwFlags & FKF_FILTERKEYSON) == 0 )
|
||||||
|
{
|
||||||
|
// Disable the hotkey and the confirmation
|
||||||
|
fkOff.dwFlags &= ~FKF_HOTKEYACTIVE;
|
||||||
|
fkOff.dwFlags &= ~FKF_CONFIRMHOTKEY;
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &fkOff, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int TempGridZoneManager::
|
int TempGridZoneManager::
|
||||||
add_grid_zone(unsigned int x,
|
add_grid_zone(unsigned int x,
|
||||||
|
@ -48,6 +48,10 @@ EXPCL_DIRECT void add_fullscreen_testsize(int xsize, int ysize);
|
|||||||
EXPCL_DIRECT void runtest_fullscreen_sizes(GraphicsWindow *win);
|
EXPCL_DIRECT void runtest_fullscreen_sizes(GraphicsWindow *win);
|
||||||
EXPCL_DIRECT bool query_fullscreen_testresult(int xsize, int ysize);
|
EXPCL_DIRECT bool query_fullscreen_testresult(int xsize, int ysize);
|
||||||
|
|
||||||
|
// to handle windows stickykeys
|
||||||
|
EXPCL_DIRECT void store_accessibility_shortcut_keys();
|
||||||
|
EXPCL_DIRECT void allow_accessibility_shortcut_keys(bool allowKeys);
|
||||||
|
|
||||||
END_PUBLISH
|
END_PUBLISH
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@ typedef WCHAR *BSTR;
|
|||||||
typedef struct _MediaType AM_MEDIA_TYPE;
|
typedef struct _MediaType AM_MEDIA_TYPE;
|
||||||
typedef struct _VIDEO_STREAM_CONFIG_CAPS VIDEO_STREAM_CONFIG_CAPS;
|
typedef struct _VIDEO_STREAM_CONFIG_CAPS VIDEO_STREAM_CONFIG_CAPS;
|
||||||
typedef struct _GUID GUID;
|
typedef struct _GUID GUID;
|
||||||
|
typedef struct _STICKYKEYS STICKYKEYS;
|
||||||
|
typedef struct _TOGGLEKEYS TOGGLEKEYS;
|
||||||
|
typedef struct _FILTERKEYS FILTERKEYS;
|
||||||
|
|
||||||
#define CALLBACK
|
#define CALLBACK
|
||||||
|
|
||||||
#define WINAPI
|
#define WINAPI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user