diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/doom/d_main.c | 2 | ||||
-rw-r--r-- | src/heretic/d_main.c | 2 | ||||
-rw-r--r-- | src/hexen/h2_main.c | 2 | ||||
-rw-r--r-- | src/i_video.c | 17 | ||||
-rw-r--r-- | src/m_controls.c | 76 | ||||
-rw-r--r-- | src/m_controls.h | 2 | ||||
-rw-r--r-- | src/setup/mode.c | 2 |
7 files changed, 101 insertions, 2 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c index ce9b667d..9fa9ae3b 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -348,6 +348,8 @@ void D_BindVariables(void) { int i; + M_ApplyPlatformDefaults(); + I_BindVideoVariables(); I_BindJoystickVariables(); I_BindSoundVariables(); diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index d501c496..10f5fd3e 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -737,6 +737,8 @@ void D_BindVariables(void) extern int snd_Channels; int i; + M_ApplyPlatformDefaults(); + I_BindVideoVariables(); I_BindJoystickVariables(); I_BindSoundVariables(); diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 656ab80c..ef223c0e 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -147,6 +147,8 @@ void D_BindVariables(void) { int i; + M_ApplyPlatformDefaults(); + I_BindVideoVariables(); I_BindJoystickVariables(); I_BindSoundVariables(); diff --git a/src/i_video.c b/src/i_video.c index a41f523b..a938b1f8 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -266,7 +266,7 @@ static boolean MouseShouldBeGrabbed() if (screensaver_mode) return false; - // if the window doesnt have focus, never grab it + // if the window doesn't have focus, never grab it if (!window_focused) return false; @@ -277,13 +277,24 @@ static boolean MouseShouldBeGrabbed() if (fullscreen) return true; +#ifdef _WIN32_WCE + + // On Windows CE, always grab input. This is because hardware + // button events are only acquired by SDL when the input is grabbed. + // Almost all Windows CE devices should have touch screens anyway, + // so this shouldn't affect mouse grabbing behavior. + + return true; + +#else + // Don't grab the mouse if mouse input is disabled if (!usemouse || nomouse) return false; // if we specify not to grab the mouse, never grab - + if (!grabmouse) return false; @@ -298,6 +309,8 @@ static boolean MouseShouldBeGrabbed() { return true; } + +#endif /* #ifndef _WIN32_WCE */ } void I_SetGrabMouseCallback(grabmouse_callback_t func) diff --git a/src/m_controls.c b/src/m_controls.c index 1cca6263..98b1e51b 100644 --- a/src/m_controls.c +++ b/src/m_controls.c @@ -272,3 +272,79 @@ void M_BindMenuControls(void) M_BindVariable("key_menu_decscreen", &key_menu_decscreen); } +#ifdef _WIN32_WCE + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +static int SystemHasKeyboard(void) +{ + HKEY key; + DWORD valtype; + DWORD valsize; + DWORD result; + + if (RegOpenKeyExW(HKEY_CURRENT_USER, + L"\\Software\\Microsoft\\Shell", 0, + KEY_READ, &key) != ERROR_SUCCESS) + { + return 0; + } + + valtype = REG_SZ; + valsize = sizeof(DWORD); + + if (RegQueryValueExW(key, L"HasKeyboard", NULL, &valtype, + (LPBYTE) &result, &valsize) != ERROR_SUCCESS) + { + result = 0; + } + + // Close the key + + RegCloseKey(key); + + return result; +} + +// +// Apply custom defaults for Windows CE. +// + +static void M_ApplyWindowsCEDefaults(void) +{ + // If the system doesn't have a keyboard, patch the default + // configuration to use the hardware keys. + + if (!SystemHasKeyboard()) + { + key_use = KEY_F1; + key_fire = KEY_F2; + key_menu_activate = KEY_F3; + key_map_toggle = KEY_F4; + + key_menu_help = 0; + key_menu_save = 0; + key_menu_load = 0; + key_menu_volume = 0; + + key_menu_confirm = KEY_ENTER; + key_menu_back = KEY_F2; + key_menu_abort = KEY_F2; + } +} + +#endif + +// +// Apply custom patches to the default values depending on the +// platform we are running on. +// + +void M_ApplyPlatformDefaults(void) +{ +#ifdef _WIN32_WCE + M_ApplyWindowsCEDefaults(); +#endif +} + diff --git a/src/m_controls.h b/src/m_controls.h index 5054212e..2a4aa3df 100644 --- a/src/m_controls.h +++ b/src/m_controls.h @@ -144,5 +144,7 @@ void M_BindWeaponControls(void); void M_BindMapControls(void); void M_BindMenuControls(void); +void M_ApplyPlatformDefaults(void); + #endif /* #ifndef __M_CONTROLS_H__ */ diff --git a/src/setup/mode.c b/src/setup/mode.c index 9d900319..e300dc9f 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -127,6 +127,8 @@ static void BindMiscVariables(void) void InitBindings(void) { + M_ApplyPlatformDefaults(); + // Keyboard, mouse, joystick controls M_BindBaseControls(); |