Fix GetWindowsLon and SetWindowsLong issues with VS2012 and Windows 8.
Remove unneeded #ifdef block for GWL_WNDPROC and GWL_USERDATA
This commit is contained in:
Jürgen Herrmann 2013-05-13 20:27:05 +00:00
parent 92da9792fe
commit 3d3a4e8eec
3 changed files with 5 additions and 21 deletions

@ -47,14 +47,6 @@
#include <shlobj.h>
#include <tlhelp32.h>
// win64 doesn't define GWL_USERDATA
#ifdef WIN32
# ifndef GWL_USERDATA
# define GWL_USERDATA GWLP_USERDATA
# define GWL_WNDPROC GWLP_WNDPROC
# endif
#endif
#include "utfconv.h"
#include "GHOST_DisplayManagerWin32.h"
@ -904,7 +896,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized");
if (hwnd) {
GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLongPtr(hwnd, GWL_USERDATA);
GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (window) {
switch (msg) {
// we need to check if new key layout has AltGr

@ -50,14 +50,6 @@
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
// win64 doesn't define GWL_USERDATA
#ifdef WIN32 /* why? - probably should remove */
# ifndef GWL_USERDATA
# define GWL_USERDATA GWLP_USERDATA
# define GWL_WNDPROC GWLP_WNDPROC
# endif
#endif
const wchar_t *GHOST_WindowWin32::s_windowClassName = L"GHOST_WindowClass";
const int GHOST_WindowWin32::s_maxTitleLength = 128;
HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
@ -270,7 +262,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
}
// Store a pointer to this class in the window structure
::SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG_PTR) this);
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR) this);
m_wsh.setHWND(m_hWnd);
m_wsh.setMinSize(320, 240);

@ -260,14 +260,14 @@ bool GPG_Application::startScreenSaverPreview(
}
SetParent(ghost_hwnd, parentWindow);
LONG style = GetWindowLong(ghost_hwnd, GWL_STYLE);
LONG exstyle = GetWindowLong(ghost_hwnd, GWL_EXSTYLE);
LONG_PTR style = GetWindowLongPtr(ghost_hwnd, GWL_STYLE);
LONG_PTR exstyle = GetWindowLongPtr(ghost_hwnd, GWL_EXSTYLE);
RECT adjrc = { 0, 0, windowWidth, windowHeight };
AdjustWindowRectEx(&adjrc, style, FALSE, exstyle);
style = (style & (~(WS_POPUP|WS_OVERLAPPEDWINDOW|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_TILEDWINDOW ))) | WS_CHILD;
SetWindowLong(ghost_hwnd, GWL_STYLE, style);
SetWindowLongPtr(ghost_hwnd, GWL_STYLE, style);
SetWindowPos(ghost_hwnd, NULL, adjrc.left, adjrc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
/* Check the size of the client rectangle of the window and resize the window