Windows: 1. GWL_USERDATA must be GWLP_USERDATA to be compatible with x86 and x64. (GWL_USERDATA is deprecated anyway). 3. Replace Get/SetWindowLong with Get/SetWindoeLongPtr or placing this into GWLP_USERDATA will truncate the pointer.

(transplanted from 5f50745bff03700d3862a6bb1eb5936be0fdc6cd)
master
Nicky 2016-04-22 14:55:19 +02:00
parent a116f96a2f
commit 30dcad4b95
2 changed files with 7 additions and 7 deletions

View File

@ -113,7 +113,7 @@ class LLDragDropWin32Target:
PVOID data = GlobalLock( stgmed.hGlobal ); PVOID data = GlobalLock( stgmed.hGlobal );
mDropUrl = std::string( (char*)data ); mDropUrl = std::string( (char*)data );
// XXX MAJOR MAJOR HACK! // XXX MAJOR MAJOR HACK!
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA); LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
if (NULL != window_imp) if (NULL != window_imp)
{ {
LLCoordGL gl_coord( 0, 0 ); LLCoordGL gl_coord( 0, 0 );
@ -168,7 +168,7 @@ class LLDragDropWin32Target:
if ( mAllowDrop ) if ( mAllowDrop )
{ {
// XXX MAJOR MAJOR HACK! // XXX MAJOR MAJOR HACK!
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA); LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
if (NULL != window_imp) if (NULL != window_imp)
{ {
LLCoordGL gl_coord( 0, 0 ); LLCoordGL gl_coord( 0, 0 );
@ -215,7 +215,7 @@ class LLDragDropWin32Target:
HRESULT __stdcall DragLeave( void ) HRESULT __stdcall DragLeave( void )
{ {
// XXX MAJOR MAJOR HACK! // XXX MAJOR MAJOR HACK!
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA); LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
if (NULL != window_imp) if (NULL != window_imp)
{ {
LLCoordGL gl_coord( 0, 0 ); LLCoordGL gl_coord( 0, 0 );
@ -232,7 +232,7 @@ class LLDragDropWin32Target:
if ( mAllowDrop ) if ( mAllowDrop )
{ {
// window impl stored in Window data (neat!) // window impl stored in Window data (neat!)
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA ); LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
if ( NULL != window_imp ) if ( NULL != window_imp )
{ {
POINT pt_client; POINT pt_client;

View File

@ -759,7 +759,7 @@ void LLWindowWin32::close()
LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL; LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL;
// Don't process events in our mainWindowProc any longer. // Don't process events in our mainWindowProc any longer.
SetWindowLong(mWindowHandle, GWL_USERDATA, NULL); SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL);
// Make sure we don't leave a blank toolbar button. // Make sure we don't leave a blank toolbar button.
ShowWindow(mWindowHandle, SW_HIDE); ShowWindow(mWindowHandle, SW_HIDE);
@ -1538,7 +1538,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL; LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL;
} }
SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this); SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, (LONG_PTR)this);
// register this window as handling drag/drop events from the OS // register this window as handling drag/drop events from the OS
DragAcceptFiles( mWindowHandle, TRUE ); DragAcceptFiles( mWindowHandle, TRUE );
@ -1850,7 +1850,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
// This is to avoid triggering double click teleport after returning focus (see MAINT-3786). // This is to avoid triggering double click teleport after returning focus (see MAINT-3786).
static bool sHandleDoubleClick = true; static bool sHandleDoubleClick = true;
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA); LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( h_wnd, GWLP_USERDATA );
if (NULL != window_imp) if (NULL != window_imp)