mirror of https://github.com/encounter/SDL.git
Added a hint to disable windows message processing in SDL_PumpEvents()
SDL_SetHint( SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, "0" );
This commit is contained in:
parent
0d1f0fed71
commit
3e3b34adc9
|
@ -196,6 +196,17 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
|
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the windows message loop is processed by SDL
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - The window message loop is not run
|
||||||
|
* "1" - The window message loop is processed in SDL_PumpEvents()
|
||||||
|
*
|
||||||
|
* By default SDL will process the windows message loop
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether grabbing input grabs the keyboard
|
* \brief A variable controlling whether grabbing input grabs the keyboard
|
||||||
*
|
*
|
||||||
|
|
|
@ -890,6 +890,7 @@ WIN_PumpEvents(_THIS)
|
||||||
MSG msg;
|
MSG msg;
|
||||||
DWORD start_ticks = GetTickCount();
|
DWORD start_ticks = GetTickCount();
|
||||||
|
|
||||||
|
if (g_WindowsEnableMessageLoop) {
|
||||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
|
/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
|
@ -900,6 +901,7 @@ WIN_PumpEvents(_THIS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
|
/* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
|
||||||
You won't get a KEYUP until both are released, and that keyup will only be for the second
|
You won't get a KEYUP until both are released, and that keyup will only be for the second
|
||||||
|
|
|
@ -39,8 +39,18 @@ static int WIN_VideoInit(_THIS);
|
||||||
static void WIN_VideoQuit(_THIS);
|
static void WIN_VideoQuit(_THIS);
|
||||||
|
|
||||||
/* Hints */
|
/* Hints */
|
||||||
|
SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE;
|
||||||
SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
|
SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
|
||||||
|
|
||||||
|
static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
|
||||||
|
{
|
||||||
|
if (newValue && *newValue == '0') {
|
||||||
|
g_WindowsEnableMessageLoop = SDL_FALSE;
|
||||||
|
} else {
|
||||||
|
g_WindowsEnableMessageLoop = SDL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
|
static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
|
||||||
{
|
{
|
||||||
if (newValue && *newValue == '0') {
|
if (newValue && *newValue == '0') {
|
||||||
|
@ -178,6 +188,7 @@ WIN_VideoInit(_THIS)
|
||||||
WIN_InitKeyboard(_this);
|
WIN_InitKeyboard(_this);
|
||||||
WIN_InitMouse(_this);
|
WIN_InitMouse(_this);
|
||||||
|
|
||||||
|
SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL);
|
||||||
SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL);
|
SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -171,6 +171,7 @@ typedef struct SDL_VideoData
|
||||||
TSFSink *ime_ippasink;
|
TSFSink *ime_ippasink;
|
||||||
} SDL_VideoData;
|
} SDL_VideoData;
|
||||||
|
|
||||||
|
extern SDL_bool g_WindowsEnableMessageLoop;
|
||||||
extern SDL_bool g_WindowFrameUsableWhileCursorHidden;
|
extern SDL_bool g_WindowFrameUsableWhileCursorHidden;
|
||||||
|
|
||||||
typedef struct IDirect3D9 IDirect3D9;
|
typedef struct IDirect3D9 IDirect3D9;
|
||||||
|
|
Loading…
Reference in New Issue