Changed sf::WindowHandle from void* to HWND on Windows

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1580 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-10-13 16:38:39 +00:00
parent 0354c306e3
commit d327320b59
3 changed files with 10 additions and 9 deletions

View File

@ -30,6 +30,10 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
// Windows' HWND is a typedef on struct HWND__*
#if defined(SFML_SYSTEM_WINDOWS)
struct HWND__;
#endif
namespace sf namespace sf
{ {
@ -39,17 +43,17 @@ namespace sf
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
// Windows defines a void* handle (HWND) // Window handle is HWND (HWND__*) on Windows
typedef void* WindowHandle; typedef HWND__* WindowHandle;
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
// Unix - X11 defines an unsigned integer handle (Window) // Window handle is Window (unsigned long) on Unix - X11
typedef unsigned long WindowHandle; typedef unsigned long WindowHandle;
#elif defined(SFML_SYSTEM_MACOS) #elif defined(SFML_SYSTEM_MACOS)
// Mac OS X defines a void* handle (NSWindow) // Window handle is NSWindow (void*) on Mac OS X - Cocoa
typedef void* WindowHandle; typedef void* WindowHandle;
#endif #endif

View File

@ -71,7 +71,7 @@ myContext (NULL),
myOwnsWindow (false) myOwnsWindow (false)
{ {
// Get the owner window and its device context // Get the owner window and its device context
myWindow = static_cast<HWND>(owner->GetSystemHandle()); myWindow = owner->GetSystemHandle();
myDeviceContext = GetDC(myWindow); myDeviceContext = GetDC(myWindow);
// Create the context // Create the context

View File

@ -64,16 +64,13 @@ namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowImplWin32::WindowImplWin32(WindowHandle handle) : WindowImplWin32::WindowImplWin32(WindowHandle handle) :
myHandle (NULL), myHandle (handle),
myCallback (0), myCallback (0),
myCursor (NULL), myCursor (NULL),
myIcon (NULL), myIcon (NULL),
myKeyRepeatEnabled(true), myKeyRepeatEnabled(true),
myIsCursorIn (false) myIsCursorIn (false)
{ {
// Save window handle
myHandle = static_cast<HWND>(handle);
if (myHandle) if (myHandle)
{ {
// Get window client size // Get window client size