mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-20 17:20:26 +01:00
Remove various ancient support code
This commit is contained in:
parent
2cc1a4e20a
commit
0afd799002
@ -32,11 +32,6 @@ public:
|
||||
/** \return Returns 0 if no string is in there. */
|
||||
virtual const c8* getTextFromClipboard() const = 0;
|
||||
|
||||
//! Get the processor speed in megahertz
|
||||
/** \param MHz The integer variable to store the speed in.
|
||||
\return True if successful, false if not */
|
||||
virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
|
||||
|
||||
//! Get the total and available system RAM
|
||||
/** \param totalBytes: will contain the total system memory in bytes
|
||||
\param availableBytes: will contain the available memory in bytes
|
||||
|
@ -76,15 +76,12 @@ CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
|
||||
|
||||
if (CreationParams.Fullscreen)
|
||||
{
|
||||
// Some mingw versions lack this define, so avoid it in case it does not exist
|
||||
#if (_WIN32_WINNT >= 0x0501) && defined(CONSOLE_FULLSCREEN_MODE)
|
||||
PCOORD dimensions = 0;
|
||||
if (SetConsoleDisplayMode(WindowsSTDOut, CONSOLE_FULLSCREEN_MODE, dimensions))
|
||||
{
|
||||
CreationParams.WindowSize.Width = dimensions->X;
|
||||
CreationParams.WindowSize.Width = dimensions->Y;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -21,9 +21,7 @@
|
||||
#if !defined(_IRR_XBOX_PLATFORM_)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if(_WIN32_WINNT >= 0x0500)
|
||||
#define _IRR_WINDOWS_NT_CONSOLE_
|
||||
#endif
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
@ -453,8 +453,7 @@ bool CIrrDeviceLinux::createWindow()
|
||||
switchToFullscreen();
|
||||
|
||||
WindowMinimized=false;
|
||||
// Currently broken in X, see Bug ID 2795321
|
||||
// XkbSetDetectableAutoRepeat(XDisplay, True, &AutorepeatSupport);
|
||||
XkbSetDetectableAutoRepeat(XDisplay, True, &AutorepeatSupport);
|
||||
|
||||
Window tmp;
|
||||
u32 borderWidth;
|
||||
@ -633,7 +632,6 @@ bool CIrrDeviceLinux::createInputContext()
|
||||
XIMStyles *im_supported_styles;
|
||||
XGetIMValues(XInputMethod, XNQueryInputStyle, &im_supported_styles, (char*)NULL);
|
||||
XIMStyle bestStyle = 0;
|
||||
// TODO: If we want to support languages like chinese or japanese as well we probably have to work with callbacks here.
|
||||
XIMStyle supportedStyle = XIMPreeditNothing | XIMStatusNothing;
|
||||
for(int i=0; i < im_supported_styles->count_styles; ++i)
|
||||
{
|
||||
@ -692,7 +690,6 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event)
|
||||
|
||||
SKeyMap mp;
|
||||
mp.X11Key = XkbKeycodeToKeysym(XDisplay, event.xkey.keycode, 0, 0);
|
||||
// mp.X11Key = XKeycodeToKeysym(XDisplay, event.xkey.keycode, 0); // deprecated, if we still find platforms which need that we have to use some define
|
||||
const s32 idx = KeyMap.binary_search(mp);
|
||||
if (idx != -1)
|
||||
{
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <OpenGL/gl.h>
|
||||
#ifndef __MAC_10_6
|
||||
#import <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#include "CIrrDeviceOSX.h"
|
||||
|
||||
@ -38,12 +35,7 @@
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
#ifdef MACOS_10_0_4
|
||||
#include <IOKit/hidsystem/IOHIDUsageTables.h>
|
||||
#else
|
||||
/* The header was moved here in Mac OS X 10.1 */
|
||||
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
|
||||
#endif
|
||||
#include <IOKit/hid/IOHIDLib.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
@ -301,8 +293,6 @@ static void getJoystickDeviceInfo (io_object_t hidDevice, CFMutableDictionaryRef
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
|
||||
// only OSX 10.5 seems to not need these defines...
|
||||
#if !defined(__MAC_10_5) || defined(__MAC_10_6)
|
||||
// Contents from Events.h from Carbon/HIToolbox but we need it with Cocoa too
|
||||
// and for some reason no Cocoa equivalent of these constants seems provided.
|
||||
// So I'm doing like everyone else and using copy-and-paste.
|
||||
@ -440,7 +430,6 @@ enum {
|
||||
kVK_DownArrow = 0x7D,
|
||||
kVK_UpArrow = 0x7E
|
||||
};
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
Boolean GetDictionaryBoolean(CFDictionaryRef theDict, const void* key)
|
||||
@ -629,11 +618,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
||||
CIrrDeviceMacOSX::~CIrrDeviceMacOSX()
|
||||
{
|
||||
[SoftwareDriverTarget release];
|
||||
#ifdef __MAC_10_6
|
||||
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
|
||||
#else
|
||||
SetSystemUIMode(kUIModeNormal, kUIOptionAutoShowMenuBar);
|
||||
#endif
|
||||
closeDevice();
|
||||
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
||||
for (u32 joystick = 0; joystick < ActiveJoysticks.size(); ++joystick)
|
||||
@ -668,11 +653,7 @@ bool CIrrDeviceMacOSX::createWindow()
|
||||
Display = CGMainDisplayID();
|
||||
|
||||
CGRect displayRect;
|
||||
#ifdef __MAC_10_6
|
||||
CGDisplayModeRef displaymode, olddisplaymode;
|
||||
#else
|
||||
CFDictionaryRef displaymode, olddisplaymode;
|
||||
#endif
|
||||
|
||||
ScreenWidth = (int)CGDisplayPixelsWide(Display);
|
||||
ScreenHeight = (int)CGDisplayPixelsHigh(Display);
|
||||
@ -707,7 +688,6 @@ bool CIrrDeviceMacOSX::createWindow()
|
||||
{
|
||||
IsFullscreen = true;
|
||||
|
||||
#ifdef __MAC_10_6
|
||||
displaymode = CGDisplayCopyDisplayMode(Display);
|
||||
|
||||
CFArrayRef Modes = CGDisplayCopyAllDisplayModes(Display, NULL);
|
||||
@ -734,26 +714,15 @@ bool CIrrDeviceMacOSX::createWindow()
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
displaymode = CGDisplayBestModeForParameters(Display,CreationParams.Bits,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height,NULL);
|
||||
#endif
|
||||
|
||||
if (displaymode != NULL)
|
||||
{
|
||||
#ifdef __MAC_10_6
|
||||
olddisplaymode = CGDisplayCopyDisplayMode(Display);
|
||||
#else
|
||||
olddisplaymode = CGDisplayCurrentMode(Display);
|
||||
#endif
|
||||
|
||||
error = CGCaptureAllDisplays();
|
||||
if (error == CGDisplayNoErr)
|
||||
{
|
||||
#ifdef __MAC_10_6
|
||||
error = CGDisplaySetDisplayMode(Display, displaymode, NULL);
|
||||
#else
|
||||
error = CGDisplaySwitchToMode(Display, displaymode);
|
||||
#endif
|
||||
|
||||
if (error == CGDisplayNoErr)
|
||||
{
|
||||
@ -788,11 +757,7 @@ bool CIrrDeviceMacOSX::createWindow()
|
||||
|
||||
if (IsFullscreen) //hide menus in fullscreen mode only
|
||||
{
|
||||
#ifdef __MAC_10_6
|
||||
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
|
||||
#else
|
||||
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,11 +839,6 @@ void CIrrDeviceMacOSX::createDriver()
|
||||
[(NSView*)CreationParams.WindowId setWantsBestResolutionOpenGLSurface:NO];
|
||||
[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:(NSView*)CreationParams.WindowId];
|
||||
}
|
||||
|
||||
#ifndef __MAC_10_6
|
||||
CGLContextObj CGLContext = (CGLContextObj)[(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context CGLContextObj];
|
||||
CGLSetFullScreen(CGLContext);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
|
||||
@ -1279,14 +1239,9 @@ void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
|
||||
c.x = p.x;
|
||||
c.y = p.y;
|
||||
|
||||
#ifdef __MAC_10_6
|
||||
CGEventRef ev = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, c, kCGMouseButtonLeft);
|
||||
CGEventPost(kCGHIDEventTap, ev);
|
||||
CFRelease(ev);
|
||||
#else
|
||||
CGSetLocalEventsSuppressionInterval(0);
|
||||
CGWarpMouseCursorPosition(c);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1797,7 +1752,6 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList()
|
||||
CGDirectDisplayID display;
|
||||
display = CGMainDisplayID();
|
||||
|
||||
#ifdef __MAC_10_6
|
||||
CFArrayRef Modes = CGDisplayCopyAllDisplayModes(display, NULL);
|
||||
|
||||
for(int i = 0; i < CFArrayGetCount(Modes); ++i)
|
||||
@ -1825,27 +1779,6 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList()
|
||||
VideoModeList->addMode(core::dimension2d<u32>(Width, Height), Depth);
|
||||
}
|
||||
}
|
||||
#else
|
||||
CFArrayRef availableModes = CGDisplayAvailableModes(display);
|
||||
unsigned int numberOfAvailableModes = CFArrayGetCount(availableModes);
|
||||
for (u32 i= 0; i<numberOfAvailableModes; ++i)
|
||||
{
|
||||
// look at each mode in the available list
|
||||
CFDictionaryRef mode = (CFDictionaryRef)CFArrayGetValueAtIndex(availableModes, i);
|
||||
long bitsPerPixel = GetDictionaryLong(mode, kCGDisplayBitsPerPixel);
|
||||
Boolean safeForHardware = GetDictionaryBoolean(mode, kCGDisplayModeIsSafeForHardware);
|
||||
Boolean stretched = GetDictionaryBoolean(mode, kCGDisplayModeIsStretched);
|
||||
|
||||
if (!safeForHardware)
|
||||
continue;
|
||||
|
||||
long width = GetDictionaryLong(mode, kCGDisplayWidth);
|
||||
long height = GetDictionaryLong(mode, kCGDisplayHeight);
|
||||
// long refresh = GetDictionaryLong((mode), kCGDisplayRefreshRate);
|
||||
VideoModeList.addMode(core::dimension2d<u32>(width, height),
|
||||
bitsPerPixel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return VideoModeList;
|
||||
}
|
||||
|
@ -528,166 +528,6 @@ bool SJoystickWin32Control::activateJoysticks(core::array<SJoystickInfo> & joyst
|
||||
}
|
||||
} // end namespace irr
|
||||
|
||||
// Get the codepage from the locale language id
|
||||
// Based on the table from http://www.science.co.il/Language/Locale-Codes.asp?s=decimal
|
||||
static unsigned int LocaleIdToCodepage(unsigned int lcid)
|
||||
{
|
||||
switch ( lcid )
|
||||
{
|
||||
case 1098: // Telugu
|
||||
case 1095: // Gujarati
|
||||
case 1094: // Punjabi
|
||||
case 1103: // Sanskrit
|
||||
case 1111: // Konkani
|
||||
case 1114: // Syriac
|
||||
case 1099: // Kannada
|
||||
case 1102: // Marathi
|
||||
case 1125: // Divehi
|
||||
case 1067: // Armenian
|
||||
case 1081: // Hindi
|
||||
case 1079: // Georgian
|
||||
case 1097: // Tamil
|
||||
return 0;
|
||||
case 1054: // Thai
|
||||
return 874;
|
||||
case 1041: // Japanese
|
||||
return 932;
|
||||
case 2052: // Chinese (PRC)
|
||||
case 4100: // Chinese (Singapore)
|
||||
return 936;
|
||||
case 1042: // Korean
|
||||
return 949;
|
||||
case 5124: // Chinese (Macau S.A.R.)
|
||||
case 3076: // Chinese (Hong Kong S.A.R.)
|
||||
case 1028: // Chinese (Taiwan)
|
||||
return 950;
|
||||
case 1048: // Romanian
|
||||
case 1060: // Slovenian
|
||||
case 1038: // Hungarian
|
||||
case 1051: // Slovak
|
||||
case 1045: // Polish
|
||||
case 1052: // Albanian
|
||||
case 2074: // Serbian (Latin)
|
||||
case 1050: // Croatian
|
||||
case 1029: // Czech
|
||||
return 1250;
|
||||
case 1104: // Mongolian (Cyrillic)
|
||||
case 1071: // FYRO Macedonian
|
||||
case 2115: // Uzbek (Cyrillic)
|
||||
case 1058: // Ukrainian
|
||||
case 2092: // Azeri (Cyrillic)
|
||||
case 1092: // Tatar
|
||||
case 1087: // Kazakh
|
||||
case 1059: // Belarusian
|
||||
case 1088: // Kyrgyz (Cyrillic)
|
||||
case 1026: // Bulgarian
|
||||
case 3098: // Serbian (Cyrillic)
|
||||
case 1049: // Russian
|
||||
return 1251;
|
||||
case 8201: // English (Jamaica)
|
||||
case 3084: // French (Canada)
|
||||
case 1036: // French (France)
|
||||
case 5132: // French (Luxembourg)
|
||||
case 5129: // English (New Zealand)
|
||||
case 6153: // English (Ireland)
|
||||
case 1043: // Dutch (Netherlands)
|
||||
case 9225: // English (Caribbean)
|
||||
case 4108: // French (Switzerland)
|
||||
case 4105: // English (Canada)
|
||||
case 1110: // Galician
|
||||
case 10249: // English (Belize)
|
||||
case 3079: // German (Austria)
|
||||
case 6156: // French (Monaco)
|
||||
case 12297: // English (Zimbabwe)
|
||||
case 1069: // Basque
|
||||
case 2067: // Dutch (Belgium)
|
||||
case 2060: // French (Belgium)
|
||||
case 1035: // Finnish
|
||||
case 1080: // Faroese
|
||||
case 1031: // German (Germany)
|
||||
case 3081: // English (Australia)
|
||||
case 1033: // English (United States)
|
||||
case 2057: // English (United Kingdom)
|
||||
case 1027: // Catalan
|
||||
case 11273: // English (Trinidad)
|
||||
case 7177: // English (South Africa)
|
||||
case 1030: // Danish
|
||||
case 13321: // English (Philippines)
|
||||
case 15370: // Spanish (Paraguay)
|
||||
case 9226: // Spanish (Colombia)
|
||||
case 5130: // Spanish (Costa Rica)
|
||||
case 7178: // Spanish (Dominican Republic)
|
||||
case 12298: // Spanish (Ecuador)
|
||||
case 17418: // Spanish (El Salvador)
|
||||
case 4106: // Spanish (Guatemala)
|
||||
case 18442: // Spanish (Honduras)
|
||||
case 3082: // Spanish (International Sort)
|
||||
case 13322: // Spanish (Chile)
|
||||
case 19466: // Spanish (Nicaragua)
|
||||
case 2058: // Spanish (Mexico)
|
||||
case 10250: // Spanish (Peru)
|
||||
case 20490: // Spanish (Puerto Rico)
|
||||
case 1034: // Spanish (Traditional Sort)
|
||||
case 14346: // Spanish (Uruguay)
|
||||
case 8202: // Spanish (Venezuela)
|
||||
case 1089: // Swahili
|
||||
case 1053: // Swedish
|
||||
case 2077: // Swedish (Finland)
|
||||
case 5127: // German (Liechtenstein)
|
||||
case 1078: // Afrikaans
|
||||
case 6154: // Spanish (Panama)
|
||||
case 4103: // German (Luxembourg)
|
||||
case 16394: // Spanish (Bolivia)
|
||||
case 2055: // German (Switzerland)
|
||||
case 1039: // Icelandic
|
||||
case 1057: // Indonesian
|
||||
case 1040: // Italian (Italy)
|
||||
case 2064: // Italian (Switzerland)
|
||||
case 2068: // Norwegian (Nynorsk)
|
||||
case 11274: // Spanish (Argentina)
|
||||
case 1046: // Portuguese (Brazil)
|
||||
case 1044: // Norwegian (Bokmal)
|
||||
case 1086: // Malay (Malaysia)
|
||||
case 2110: // Malay (Brunei Darussalam)
|
||||
case 2070: // Portuguese (Portugal)
|
||||
return 1252;
|
||||
case 1032: // Greek
|
||||
return 1253;
|
||||
case 1091: // Uzbek (Latin)
|
||||
case 1068: // Azeri (Latin)
|
||||
case 1055: // Turkish
|
||||
return 1254;
|
||||
case 1037: // Hebrew
|
||||
return 1255;
|
||||
case 5121: // Arabic (Algeria)
|
||||
case 15361: // Arabic (Bahrain)
|
||||
case 9217: // Arabic (Yemen)
|
||||
case 3073: // Arabic (Egypt)
|
||||
case 2049: // Arabic (Iraq)
|
||||
case 11265: // Arabic (Jordan)
|
||||
case 13313: // Arabic (Kuwait)
|
||||
case 12289: // Arabic (Lebanon)
|
||||
case 4097: // Arabic (Libya)
|
||||
case 6145: // Arabic (Morocco)
|
||||
case 8193: // Arabic (Oman)
|
||||
case 16385: // Arabic (Qatar)
|
||||
case 1025: // Arabic (Saudi Arabia)
|
||||
case 10241: // Arabic (Syria)
|
||||
case 14337: // Arabic (U.A.E.)
|
||||
case 1065: // Farsi
|
||||
case 1056: // Urdu
|
||||
case 7169: // Arabic (Tunisia)
|
||||
return 1256;
|
||||
case 1061: // Estonian
|
||||
case 1062: // Latvian
|
||||
case 1063: // Lithuanian
|
||||
return 1257;
|
||||
case 1066: // Vietnamese
|
||||
return 1258;
|
||||
}
|
||||
return 65001; // utf-8
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct SEnvMapper
|
||||
@ -699,7 +539,6 @@ namespace
|
||||
irr::core::array<SEnvMapper> EnvMap;
|
||||
|
||||
HKL KEYBOARD_INPUT_HKL=0;
|
||||
unsigned int KEYBOARD_INPUT_CODEPAGE = 1252;
|
||||
}
|
||||
|
||||
irr::CIrrDeviceWin32* getDeviceFromHWnd(HWND hWnd)
|
||||
@ -718,9 +557,6 @@ irr::CIrrDeviceWin32* getDeviceFromHWnd(HWND hWnd)
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef WM_MOUSEWHEEL
|
||||
#define WM_MOUSEWHEEL 0x020A
|
||||
#endif
|
||||
#ifndef WHEEL_DELTA
|
||||
#define WHEEL_DELTA 120
|
||||
#endif
|
||||
@ -787,12 +623,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
// middle and extra buttons
|
||||
if (wParam & MK_MBUTTON)
|
||||
event.MouseInput.ButtonStates |= irr::EMBSM_MIDDLE;
|
||||
#if(_WIN32_WINNT >= 0x0500)
|
||||
if (wParam & MK_XBUTTON1)
|
||||
event.MouseInput.ButtonStates |= irr::EMBSM_EXTRA1;
|
||||
if (wParam & MK_XBUTTON2)
|
||||
event.MouseInput.ButtonStates |= irr::EMBSM_EXTRA2;
|
||||
#endif
|
||||
event.MouseInput.Wheel = 0.f;
|
||||
|
||||
// wheel
|
||||
@ -853,22 +687,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)wParam;
|
||||
event.KeyInput.PressedDown = (message==WM_KEYDOWN || message == WM_SYSKEYDOWN);
|
||||
|
||||
const UINT MY_MAPVK_VSC_TO_VK_EX = 3; // MAPVK_VSC_TO_VK_EX should be in SDK according to MSDN, but isn't in mine.
|
||||
if ( event.KeyInput.Key == irr::KEY_SHIFT )
|
||||
{
|
||||
// this will fail on systems before windows NT/2000/XP, not sure _what_ will return there instead.
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MAPVK_VSC_TO_VK_EX );
|
||||
}
|
||||
if ( event.KeyInput.Key == irr::KEY_CONTROL )
|
||||
{
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MAPVK_VSC_TO_VK_EX );
|
||||
// some keyboards will just return LEFT for both - left and right keys. So also check extend bit.
|
||||
if (lParam & 0x1000000)
|
||||
event.KeyInput.Key = irr::KEY_RCONTROL;
|
||||
}
|
||||
if ( event.KeyInput.Key == irr::KEY_MENU )
|
||||
{
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
|
||||
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MAPVK_VSC_TO_VK_EX );
|
||||
if (lParam & 0x1000000)
|
||||
event.KeyInput.Key = irr::KEY_RMENU;
|
||||
}
|
||||
@ -878,23 +710,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0);
|
||||
event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0);
|
||||
|
||||
// Handle unicode and deadkeys in a way that works since Windows 95 and nt4.0
|
||||
// Using ToUnicode instead would be shorter, but would to my knowledge not run on 95 and 98.
|
||||
WORD keyChars[2];
|
||||
// Handle unicode and deadkeys
|
||||
WCHAR keyChars[2];
|
||||
UINT scanCode = HIWORD(lParam);
|
||||
int conversionResult = ToAsciiEx(static_cast<UINT>(wParam),scanCode,allKeys,keyChars,0,KEYBOARD_INPUT_HKL);
|
||||
int conversionResult = ToUnicodeEx(static_cast<UINT>(wParam),scanCode,allKeys,keyChars,2,0,KEYBOARD_INPUT_HKL);
|
||||
if (conversionResult == 1)
|
||||
{
|
||||
WORD unicodeChar;
|
||||
MultiByteToWideChar(
|
||||
KEYBOARD_INPUT_CODEPAGE,
|
||||
MB_PRECOMPOSED, // default
|
||||
(LPCSTR)keyChars,
|
||||
sizeof(keyChars),
|
||||
(WCHAR*)&unicodeChar,
|
||||
1 );
|
||||
event.KeyInput.Char = unicodeChar;
|
||||
}
|
||||
event.KeyInput.Char = keyChars[0];
|
||||
else
|
||||
event.KeyInput.Char = 0;
|
||||
|
||||
@ -959,7 +780,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_INPUTLANGCHANGE:
|
||||
// get the new codepage used for keyboard input
|
||||
KEYBOARD_INPUT_HKL = GetKeyboardLayout(0);
|
||||
KEYBOARD_INPUT_CODEPAGE = LocaleIdToCodepage( LOWORD(KEYBOARD_INPUT_HKL) );
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
@ -1107,9 +927,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
||||
SetForegroundWindow(HWnd);
|
||||
}
|
||||
|
||||
// get the codepage used for keyboard input
|
||||
KEYBOARD_INPUT_HKL = GetKeyboardLayout(0);
|
||||
KEYBOARD_INPUT_CODEPAGE = LocaleIdToCodepage( LOWORD(KEYBOARD_INPUT_HKL) );
|
||||
|
||||
// inform driver about the window size etc.
|
||||
resizeIfNecessary();
|
||||
@ -1443,229 +1261,17 @@ CIrrDeviceWin32::CCursorControl* CIrrDeviceWin32::getWin32CursorControl()
|
||||
return Win32CursorControl;
|
||||
}
|
||||
|
||||
|
||||
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
|
||||
// Needed for old windows apis
|
||||
// depending on the SDK version and compilers some defines might be available
|
||||
// or not
|
||||
#ifndef PRODUCT_ULTIMATE
|
||||
#define PRODUCT_ULTIMATE 0x00000001
|
||||
#define PRODUCT_HOME_BASIC 0x00000002
|
||||
#define PRODUCT_HOME_PREMIUM 0x00000003
|
||||
#define PRODUCT_ENTERPRISE 0x00000004
|
||||
#define PRODUCT_HOME_BASIC_N 0x00000005
|
||||
#define PRODUCT_BUSINESS 0x00000006
|
||||
#define PRODUCT_STARTER 0x0000000B
|
||||
#endif
|
||||
#ifndef PRODUCT_ULTIMATE_N
|
||||
#define PRODUCT_BUSINESS_N 0x00000010
|
||||
#define PRODUCT_HOME_PREMIUM_N 0x0000001A
|
||||
#define PRODUCT_ENTERPRISE_N 0x0000001B
|
||||
#define PRODUCT_ULTIMATE_N 0x0000001C
|
||||
#endif
|
||||
#ifndef PRODUCT_STARTER_N
|
||||
#define PRODUCT_STARTER_N 0x0000002F
|
||||
#endif
|
||||
#ifndef PRODUCT_PROFESSIONAL
|
||||
#define PRODUCT_PROFESSIONAL 0x00000030
|
||||
#define PRODUCT_PROFESSIONAL_N 0x00000031
|
||||
#endif
|
||||
#ifndef PRODUCT_ULTIMATE_E
|
||||
#define PRODUCT_STARTER_E 0x00000042
|
||||
#define PRODUCT_HOME_BASIC_E 0x00000043
|
||||
#define PRODUCT_HOME_PREMIUM_E 0x00000044
|
||||
#define PRODUCT_PROFESSIONAL_E 0x00000045
|
||||
#define PRODUCT_ENTERPRISE_E 0x00000046
|
||||
#define PRODUCT_ULTIMATE_E 0x00000047
|
||||
#endif
|
||||
|
||||
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
||||
{
|
||||
OSVERSIONINFOEX osvi;
|
||||
PGPI pGPI;
|
||||
BOOL bOsVersionInfoEx;
|
||||
OSVERSIONINFO osvi;
|
||||
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osvi);
|
||||
|
||||
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
|
||||
if (!bOsVersionInfoEx)
|
||||
{
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
if (! GetVersionEx((OSVERSIONINFO *) &osvi))
|
||||
return;
|
||||
}
|
||||
|
||||
switch (osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
if (osvi.dwMajorVersion <= 4)
|
||||
out.append("Microsoft Windows NT ");
|
||||
else
|
||||
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
|
||||
out.append("Microsoft Windows 2000 ");
|
||||
else
|
||||
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
|
||||
out.append("Microsoft Windows XP ");
|
||||
else
|
||||
if (osvi.dwMajorVersion == 6 )
|
||||
{
|
||||
if (osvi.dwMinorVersion == 0)
|
||||
{
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
out.append("Microsoft Windows Vista ");
|
||||
else
|
||||
out.append("Microsoft Windows Server 2008 ");
|
||||
}
|
||||
else if (osvi.dwMinorVersion == 1)
|
||||
{
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
out.append("Microsoft Windows 7 ");
|
||||
else
|
||||
out.append("Microsoft Windows Server 2008 R2 ");
|
||||
}
|
||||
else if (osvi.dwMinorVersion == 2)
|
||||
{
|
||||
out.append("Microsoft Windows 8 or later ");
|
||||
}
|
||||
}
|
||||
|
||||
if (bOsVersionInfoEx)
|
||||
{
|
||||
if (osvi.dwMajorVersion == 6)
|
||||
{
|
||||
DWORD dwType;
|
||||
pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo");
|
||||
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
|
||||
|
||||
switch (dwType)
|
||||
{
|
||||
case PRODUCT_ULTIMATE:
|
||||
case PRODUCT_ULTIMATE_E:
|
||||
case PRODUCT_ULTIMATE_N:
|
||||
out.append("Ultimate Edition ");
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL:
|
||||
case PRODUCT_PROFESSIONAL_E:
|
||||
case PRODUCT_PROFESSIONAL_N:
|
||||
out.append("Professional Edition ");
|
||||
break;
|
||||
case PRODUCT_HOME_BASIC:
|
||||
case PRODUCT_HOME_BASIC_E:
|
||||
case PRODUCT_HOME_BASIC_N:
|
||||
out.append("Home Basic Edition ");
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM:
|
||||
case PRODUCT_HOME_PREMIUM_E:
|
||||
case PRODUCT_HOME_PREMIUM_N:
|
||||
out.append("Home Premium Edition ");
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE:
|
||||
case PRODUCT_ENTERPRISE_E:
|
||||
case PRODUCT_ENTERPRISE_N:
|
||||
out.append("Enterprise Edition ");
|
||||
break;
|
||||
case PRODUCT_BUSINESS:
|
||||
case PRODUCT_BUSINESS_N:
|
||||
out.append("Business Edition ");
|
||||
break;
|
||||
case PRODUCT_STARTER:
|
||||
case PRODUCT_STARTER_E:
|
||||
case PRODUCT_STARTER_N:
|
||||
out.append("Starter Edition ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef VER_SUITE_ENTERPRISE
|
||||
else
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
{
|
||||
#ifndef __BORLANDC__
|
||||
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
|
||||
out.append("Personal ");
|
||||
else
|
||||
out.append("Professional ");
|
||||
#endif
|
||||
}
|
||||
else if (osvi.wProductType == VER_NT_SERVER)
|
||||
{
|
||||
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
||||
out.append("DataCenter Server ");
|
||||
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
|
||||
out.append("Advanced Server ");
|
||||
else
|
||||
out.append("Server ");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
HKEY hKey;
|
||||
char szProductType[80];
|
||||
DWORD dwBufLen;
|
||||
|
||||
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
||||
__TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
|
||||
0, KEY_QUERY_VALUE, &hKey );
|
||||
RegQueryValueEx( hKey, __TEXT("ProductType"), NULL, NULL,
|
||||
(LPBYTE) szProductType, &dwBufLen);
|
||||
RegCloseKey( hKey );
|
||||
|
||||
|
||||
if (irr::core::stringc("WINNT").equals_ignore_case(szProductType))
|
||||
out.append("Professional ");
|
||||
if (irr::core::stringc("LANMANNT").equals_ignore_case(szProductType))
|
||||
out.append("Server ");
|
||||
if (irr::core::stringc("SERVERNT").equals_ignore_case(szProductType))
|
||||
out.append("Advanced Server ");
|
||||
}
|
||||
|
||||
// Display version, service pack (if any), and build number.
|
||||
|
||||
char tmp[255];
|
||||
|
||||
if (osvi.dwMajorVersion <= 4 )
|
||||
{
|
||||
sprintf(tmp, "version %lu.%lu %s (Build %lu)",
|
||||
osvi.dwMajorVersion,
|
||||
osvi.dwMinorVersion,
|
||||
irr::core::stringc(osvi.szCSDVersion).c_str(),
|
||||
osvi.dwBuildNumber & 0xFFFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%s (Build %lu)", irr::core::stringc(osvi.szCSDVersion).c_str(),
|
||||
osvi.dwBuildNumber & 0xFFFF);
|
||||
}
|
||||
|
||||
out.append(tmp);
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
|
||||
{
|
||||
out.append("Microsoft Windows 95 ");
|
||||
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
|
||||
out.append("OSR2 " );
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
|
||||
{
|
||||
out.append("Microsoft Windows 98 ");
|
||||
if ( osvi.szCSDVersion[1] == 'A' )
|
||||
out.append( "SE " );
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
|
||||
out.append("Microsoft Windows Me ");
|
||||
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32s:
|
||||
out.append("Microsoft Win32s ");
|
||||
break;
|
||||
}
|
||||
char tmp[255];
|
||||
snprintf(tmp, sizeof(tmp), "Microsoft Windows %lu.%lu %s", osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.szCSDVersion);
|
||||
out.append(tmp);
|
||||
}
|
||||
|
||||
//! Notifies the device, that it has been resized
|
||||
@ -1867,63 +1473,6 @@ void CIrrDeviceWin32::clearSystemMessages()
|
||||
{}
|
||||
}
|
||||
|
||||
// shows last error in a messagebox to help internal debugging.
|
||||
void CIrrDeviceWin32::ReportLastWinApiError()
|
||||
{
|
||||
// (based on code from ovidiucucu from http://www.codeguru.com/forum/showthread.php?t=318721)
|
||||
LPCTSTR pszCaption = __TEXT("Windows SDK Error Report");
|
||||
DWORD dwError = GetLastError();
|
||||
|
||||
if(NOERROR == dwError)
|
||||
{
|
||||
MessageBox(NULL, __TEXT("No error"), pszCaption, MB_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
const DWORD dwFormatControl = FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM;
|
||||
|
||||
LPVOID pTextBuffer = NULL;
|
||||
DWORD dwCount = FormatMessage(dwFormatControl,
|
||||
NULL,
|
||||
dwError,
|
||||
0,
|
||||
(LPTSTR) &pTextBuffer,
|
||||
0,
|
||||
NULL);
|
||||
if(0 != dwCount)
|
||||
{
|
||||
MessageBox(NULL, (LPCTSTR)pTextBuffer, pszCaption, MB_OK|MB_ICONERROR);
|
||||
LocalFree(pTextBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, __TEXT("Unknown error"), pszCaption, MB_OK|MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Same function Windows offers in VersionHelpers.h, but we can't use that as it's not available in older sdk's (minimum is SDK 8.1)
|
||||
bool CIrrDeviceWin32::isWindowsVistaOrGreater()
|
||||
{
|
||||
#if (_WIN32_WINNT >= 0x0500)
|
||||
OSVERSIONINFOEX osvi;
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
osvi.dwMajorVersion = 6; // Windows Vista
|
||||
|
||||
if ( !GetVersionEx((OSVERSIONINFO*)&osvi) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return VerifyVersionInfo(&osvi, VER_MAJORVERSION, VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL)) ? true : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Convert an Irrlicht texture to a Windows cursor
|
||||
// Based on http://www.codeguru.com/cpp/w-p/win32/cursors/article.php/c4529/
|
||||
HCURSOR CIrrDeviceWin32::TextureToCursor(HWND hwnd, irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot)
|
||||
|
@ -117,13 +117,6 @@ namespace irr
|
||||
//! Switch to fullscreen
|
||||
bool switchToFullScreen();
|
||||
|
||||
//! Check for and show last Windows API error to help internal debugging.
|
||||
//! Does call GetLastError and on errors formats the error text and displays it in a messagebox.
|
||||
static void ReportLastWinApiError();
|
||||
|
||||
//! Same function Windows offers in VersionHelpers.h, but we can't use that as it's not available before SDK 8.1
|
||||
static bool isWindowsVistaOrGreater();
|
||||
|
||||
// convert an Irrlicht texture to a windows cursor
|
||||
HCURSOR TextureToCursor(HWND hwnd, irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot);
|
||||
|
||||
@ -292,9 +285,8 @@ namespace irr
|
||||
if (!fullscreen)
|
||||
{
|
||||
s32 paddingBorder = 0;
|
||||
#if defined (SM_CXPADDEDBORDER)
|
||||
if (CIrrDeviceWin32::isWindowsVistaOrGreater())
|
||||
paddingBorder = GetSystemMetrics(SM_CXPADDEDBORDER);
|
||||
#ifdef SM_CXPADDEDBORDER
|
||||
paddingBorder = GetSystemMetrics(SM_CXPADDEDBORDER);
|
||||
#endif
|
||||
|
||||
if (resizable)
|
||||
|
@ -145,73 +145,10 @@ const c8* COSOperator::getTextFromClipboard() const
|
||||
}
|
||||
|
||||
|
||||
bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
||||
{
|
||||
if (MHz)
|
||||
*MHz=0;
|
||||
#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_)
|
||||
LONG Error;
|
||||
|
||||
HKEY Key;
|
||||
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
__TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"),
|
||||
0, KEY_READ, &Key);
|
||||
|
||||
if(Error != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
DWORD Speed = 0;
|
||||
DWORD Size = sizeof(Speed);
|
||||
Error = RegQueryValueEx(Key, __TEXT("~MHz"), NULL, NULL, (LPBYTE)&Speed, &Size);
|
||||
|
||||
RegCloseKey(Key);
|
||||
|
||||
if (Error != ERROR_SUCCESS)
|
||||
return false;
|
||||
else if (MHz)
|
||||
*MHz = Speed;
|
||||
return true;
|
||||
|
||||
#elif defined(_IRR_OSX_PLATFORM_)
|
||||
struct clockinfo CpuClock;
|
||||
size_t Size = sizeof(clockinfo);
|
||||
|
||||
if (!sysctlbyname("kern.clockrate", &CpuClock, &Size, NULL, 0))
|
||||
return false;
|
||||
else if (MHz)
|
||||
*MHz = CpuClock.hz;
|
||||
return true;
|
||||
#else
|
||||
// read from "/proc/cpuinfo"
|
||||
FILE* file = fopen("/proc/cpuinfo", "r");
|
||||
if (file)
|
||||
{
|
||||
char buffer[1024];
|
||||
size_t r = fread(buffer, 1, 1023, file);
|
||||
buffer[r] = 0;
|
||||
buffer[1023]=0;
|
||||
core::stringc str(buffer);
|
||||
s32 pos = str.find("cpu MHz");
|
||||
if (pos != -1)
|
||||
{
|
||||
pos = str.findNext(':', pos);
|
||||
if (pos != -1)
|
||||
{
|
||||
while ( str[++pos] == ' ' );
|
||||
*MHz = core::fast_atof(str.c_str()+pos);
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
return (MHz && *MHz != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
|
||||
{
|
||||
#if defined(_IRR_WINDOWS_API_) && !defined (_IRR_XBOX_PLATFORM_)
|
||||
|
||||
#if (_WIN32_WINNT >= 0x0500)
|
||||
MEMORYSTATUSEX MemoryStatusEx;
|
||||
MemoryStatusEx.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
|
||||
@ -223,19 +160,6 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
|
||||
if (Avail)
|
||||
*Avail = (u32)(MemoryStatusEx.ullAvailPhys>>10);
|
||||
return true;
|
||||
#else
|
||||
MEMORYSTATUS MemoryStatus;
|
||||
MemoryStatus.dwLength = sizeof(MEMORYSTATUS);
|
||||
|
||||
// cannot fail
|
||||
GlobalMemoryStatus(&MemoryStatus);
|
||||
|
||||
if (Total)
|
||||
*Total = (u32)(MemoryStatus.dwTotalPhys>>10);
|
||||
if (Avail)
|
||||
*Avail = (u32)(MemoryStatus.dwAvailPhys>>10);
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#elif defined(_IRR_POSIX_API_) && !defined(__FreeBSD__)
|
||||
#if defined(_SC_PHYS_PAGES) && defined(_SC_AVPHYS_PAGES)
|
||||
|
@ -33,11 +33,6 @@ public:
|
||||
//! \return Returns 0 if no string is in there.
|
||||
virtual const c8* getTextFromClipboard() const _IRR_OVERRIDE_;
|
||||
|
||||
//! gets the processor speed in megahertz
|
||||
//! \param Mhz:
|
||||
//! \return Returns true if successful, false if not
|
||||
virtual bool getProcessorSpeedMHz(u32* MHz) const _IRR_OVERRIDE_;
|
||||
|
||||
//! gets the total and available system RAM in kB
|
||||
//! \param Total: will contain the total system memory
|
||||
//! \param Avail: will contain the available memory
|
||||
|
Loading…
Reference in New Issue
Block a user