From d327320b59d424cb09c24728f11453d404f50ede Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Wed, 13 Oct 2010 16:38:39 +0000 Subject: [PATCH] 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 --- include/SFML/Window/WindowHandle.hpp | 12 ++++++++---- src/SFML/Window/Win32/WglContext.cpp | 2 +- src/SFML/Window/Win32/WindowImplWin32.cpp | 5 +---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp index 852036c00..2947a7c53 100644 --- a/include/SFML/Window/WindowHandle.hpp +++ b/include/SFML/Window/WindowHandle.hpp @@ -30,6 +30,10 @@ //////////////////////////////////////////////////////////// #include +// Windows' HWND is a typedef on struct HWND__* +#if defined(SFML_SYSTEM_WINDOWS) + struct HWND__; +#endif namespace sf { @@ -39,17 +43,17 @@ namespace sf //////////////////////////////////////////////////////////// #if defined(SFML_SYSTEM_WINDOWS) - // Windows defines a void* handle (HWND) - typedef void* WindowHandle; + // Window handle is HWND (HWND__*) on Windows + typedef HWND__* WindowHandle; #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; #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; #endif diff --git a/src/SFML/Window/Win32/WglContext.cpp b/src/SFML/Window/Win32/WglContext.cpp index 5f2da0710..72e850d11 100644 --- a/src/SFML/Window/Win32/WglContext.cpp +++ b/src/SFML/Window/Win32/WglContext.cpp @@ -71,7 +71,7 @@ myContext (NULL), myOwnsWindow (false) { // Get the owner window and its device context - myWindow = static_cast(owner->GetSystemHandle()); + myWindow = owner->GetSystemHandle(); myDeviceContext = GetDC(myWindow); // Create the context diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index 6d113f2a8..558da6d8a 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -64,16 +64,13 @@ namespace priv { //////////////////////////////////////////////////////////// WindowImplWin32::WindowImplWin32(WindowHandle handle) : -myHandle (NULL), +myHandle (handle), myCallback (0), myCursor (NULL), myIcon (NULL), myKeyRepeatEnabled(true), myIsCursorIn (false) { - // Save window handle - myHandle = static_cast(handle); - if (myHandle) { // Get window client size