Fixed: #951 Use nlWindow instead of void* for window ID

This commit is contained in:
kervala 2010-05-31 13:15:36 +02:00
parent c05493a1b9
commit 1ee6003817
20 changed files with 43 additions and 43 deletions

View file

@ -201,7 +201,7 @@ public:
// Return is the associated window information. (Implementation dependent)
// Must be a HWND for Windows (WIN32).
virtual void *getDisplay() =0;
virtual nlWindow getDisplay() =0;
/**
* Setup monitor color properties.

View file

@ -162,7 +162,7 @@ public:
/// Return true if driver is still active. Return false else. If he user close the window, must return false.
virtual bool isActive();
/// Return an OS dependent window handle. Under Win32, it is a HWND.
virtual void *getDisplay ();
virtual nlWindow getDisplay ();
// @}

View file

@ -221,7 +221,7 @@ public:
virtual bool isActive()=0;
/// Return an OS dependent window handle. Under Win32, it is a HWND.
virtual void *getDisplay () = 0;
virtual nlWindow getDisplay () = 0;
// @}

View file

@ -30,7 +30,7 @@ namespace NLMISC
*/
class CSystemUtils
{
static void *s_window;
static nlWindow s_window;
public:
/// Initialize data which needs it before using them.
@ -40,7 +40,7 @@ public:
static bool uninit();
/// Set the window which will be used by some functions.
static void setWindow(void *window);
static void setWindow(nlWindow window);
/// Create/update a progress bar with an appearance depending on system.
static bool updateProgressBar(uint value, uint total);

View file

@ -34,7 +34,7 @@ namespace NL3D
{
// ***************************************************************************
const uint32 IDriver::InterfaceVersion = 0x64; // Added nlWindow patch.
const uint32 IDriver::InterfaceVersion = 0x65; // Added nlWindow patch.
// ***************************************************************************
IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )

View file

@ -1323,7 +1323,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
// Create a window
_HWnd = (HWND)wnd;
_HWnd = wnd;
// Reset window state
_Maximized = false;
@ -1440,19 +1440,19 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
// Create the D3D device
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, (HWND)_HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface);
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface);
if (result != D3D_OK)
{
nlwarning ("Can't create device hr:0x%x adap:0x%x rast:0x%x", result, adapter, _Rasterizer);
// Create the D3D device without puredevice
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, (HWND)_HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
if (result != D3D_OK)
{
nlwarning ("Can't create device without puredevice hr:0x%x adap:0x%x rast:0x%x", result, adapter, _Rasterizer);
// Create the D3D device without puredevice and hardware
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, (HWND)_HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
if (result != D3D_OK)
{
nlwarning ("Can't create device without puredevice and hardware hr:0x%x adap:0x%x rast:0x%x", result, adapter, _Rasterizer);
@ -1462,7 +1462,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
}
// _D3D->CreateDevice (adapter, _Rasterizer, (HWND)_HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// Check some caps
D3DCAPS9 caps;
@ -1794,9 +1794,9 @@ bool CDriverD3D::isActive ()
// ***************************************************************************
void* CDriverD3D::getDisplay()
nlWindow CDriverD3D::getDisplay()
{
return (void*)_HWnd;
return _HWnd;
}
// ***************************************************************************

View file

@ -749,7 +749,7 @@ public:
virtual bool initVertexBufferHard(uint agpMem, uint vramMem);
// Windows interface
virtual void* getDisplay();
virtual nlWindow getDisplay();
virtual emptyProc getWindowProc();
virtual NLMISC::IEventEmitter *getEventEmitter();
virtual void getWindowSize (uint32 &width, uint32 &height);

View file

@ -870,7 +870,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_FullScreen= false;
if (wnd)
{
_hWnd=(HWND)wnd;
_hWnd=wnd;
_DestroyWindow=false;
}
else

View file

@ -299,12 +299,12 @@ public:
/// Show or hide the NeL window
virtual void showWindow(bool show);
virtual void* getDisplay()
virtual nlWindow getDisplay()
{
#ifdef NL_OS_WINDOWS
return (void*)_hWnd;
return _hWnd;
#else // NL_OS_WINDOWS
return NULL;
return win;
#endif // NL_OS_WINDOWS
}

View file

@ -386,7 +386,7 @@ bool CDriverUser::isActive()
// ***************************************************************************
void *CDriverUser::getDisplay ()
nlWindow CDriverUser::getDisplay ()
{
NL3D_HAUTO_UI_DRIVER;

View file

@ -287,7 +287,7 @@ int Height = 100;
CFontGenerator::CFontGenerator (const std::string &fontFileName, const std::string &fontExFileName)
{
// HWND win=(HWND)winHack;
// HWND win=winHack;
// WindowHandle = win;
// Format = format;
// RECT rect;

View file

@ -36,7 +36,7 @@ static const uint32 KeyMaxLength = 1024;
namespace NLMISC {
void *CSystemUtils::s_window = NULL;
nlWindow CSystemUtils::s_window = EmptyWindow;
bool CSystemUtils::init()
{
@ -59,7 +59,7 @@ bool CSystemUtils::uninit()
return true;
}
void CSystemUtils::setWindow(void *window)
void CSystemUtils::setWindow(nlWindow window)
{
s_window = window;
}
@ -83,12 +83,12 @@ bool CSystemUtils::updateProgressBar(uint value, uint total)
if (total)
{
// update the taskbar progress
hr = pTaskbarList->SetProgressValue((HWND)s_window, (ULONGLONG)value, (ULONGLONG)total);
hr = pTaskbarList->SetProgressValue(s_window, (ULONGLONG)value, (ULONGLONG)total);
}
else
{
// don't update anymore the progress
hr = pTaskbarList->SetProgressState((HWND)s_window, value == 0 ? TBPF_INDETERMINATE:TBPF_NOPROGRESS);
hr = pTaskbarList->SetProgressState(s_window, value == 0 ? TBPF_INDETERMINATE:TBPF_NOPROGRESS);
}
// release the interface
@ -368,13 +368,13 @@ bool CSystemUtils::isSystemCursorInClientArea()
return false;
}
HWND wnd = WindowFromPoint(cursPos);
if (wnd != (HWND)s_window)
if (wnd != s_window)
{
return false; // not the same window
}
// want that the mouse be in the client area
RECT clientRect;
if (!GetClientRect((HWND)s_window, &clientRect))
if (!GetClientRect(s_window, &clientRect))
{
return false;
}
@ -383,11 +383,11 @@ bool CSystemUtils::isSystemCursorInClientArea()
tl.y = clientRect.top;
br.x = clientRect.right;
br.y = clientRect.bottom;
if (!ClientToScreen((HWND)s_window, &tl))
if (!ClientToScreen(s_window, &tl))
{
return false;
}
if (!ClientToScreen((HWND)s_window, &br))
if (!ClientToScreen(s_window, &br))
{
return false;
}

View file

@ -472,7 +472,7 @@ void CBGDownloaderAccess::CDownloadCoTask::restartDownloader()
}
*(uint32 *) Parent->_RyzomInstPIDPtr = (uint32) GetCurrentProcessId();
HWND hWnd = (HWND)Driver->getDisplay ();
HWND hWnd = Driver->getDisplay();
// for safety, stop any running downloader
if (isDownloaderProcessRunning())

View file

@ -283,7 +283,7 @@ static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARA
{
if (Driver)
{
HWND wnd = (HWND) Driver->getDisplay();
HWND wnd = Driver->getDisplay();
ShowWindow(wnd, SW_MINIMIZE);
}
browseFAQ(ClientCfg.ConfigFile);
@ -461,7 +461,7 @@ static string crashCallback()
Driver->getCurrentScreenMode(mode);
if (!mode.Windowed)
{
HWND wnd = (HWND) Driver->getDisplay();
HWND wnd = Driver->getDisplay();
ShowWindow(wnd, SW_MINIMIZE);
}
}
@ -1227,7 +1227,7 @@ void postlogInit()
// tmp fix : it seems that, at this point, if the bg downloader window has focus and
// not the Ryzom one, then sound init fails
#ifdef NL_OS_WINDOWS
HWND hWnd = (HWND)Driver->getDisplay ();
HWND hWnd = Driver->getDisplay ();
nlassert (hWnd);
ShowWindow(hWnd, SW_RESTORE);
SetForegroundWindow(hWnd);

View file

@ -369,7 +369,7 @@ void CaptureSystemCursor()
{
if (IsSystemCursorCaptured()) return;
#ifdef NL_OS_WINDOWS
HWND drvWnd = (HWND) Driver->getDisplay();
HWND drvWnd = Driver->getDisplay();
if (!drvWnd) return;
SetCapture(drvWnd);
#else
@ -402,7 +402,7 @@ bool IsSystemCursorCaptured()
{
if (!Driver) return false;
#ifdef NL_OS_WINDOWS
return GetCapture() == (HWND) Driver->getDisplay();
return GetCapture() == Driver->getDisplay();
#else
return MouseCapture;
#endif
@ -445,7 +445,7 @@ bool IsSystemCursorInClientArea()
{
if (!Driver) return false;
#ifdef NL_OS_WINDOWS
HWND drvWnd = (HWND) Driver->getDisplay();
HWND drvWnd = Driver->getDisplay();
if (!drvWnd) return false;
UDriver::CMode videoMode;
Driver->getCurrentScreenMode(videoMode);

View file

@ -3725,7 +3725,7 @@ public:
#ifdef NL_OS_WINDOWS
if (Driver)
{
HWND wnd = (HWND) Driver->getDisplay();
HWND wnd = Driver->getDisplay();
ShowWindow(wnd, SW_MINIMIZE);
}
#endif

View file

@ -284,7 +284,7 @@ void CCustomMouse::release()
{
if (!isAlphaBlendedCursorSupported()) return;
nlassert(Driver);
HWND drvWnd = (HWND) Driver->getDisplay();
HWND drvWnd = Driver->getDisplay();
if (drvWnd)
{
SetClassLongPtr(drvWnd, GCLP_HCURSOR, 0);
@ -353,7 +353,7 @@ void CCustomMouse::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 r
if (CInputHandlerManager::getInstance()->hasFocus())
{
::SetCursor(cursorHandle);
HWND drvWnd = (HWND) Driver->getDisplay();
HWND drvWnd = Driver->getDisplay();
if (drvWnd)
{
SetClassLongPtr(drvWnd, GCLP_HCURSOR, (LONG_PTR) cursorHandle); // set default mouse icon to the last one
@ -449,7 +449,7 @@ void CCustomMouse::setSystemArrow()
{
::SetCursor(arrow);
}
HWND drvWnd = (HWND) Driver->getDisplay();
HWND drvWnd = Driver->getDisplay();
if (drvWnd)
{
SetClassLongPtr(drvWnd, GCLP_HCURSOR, (LONG_PTR) arrow); // set default mouse icon to the last one

View file

@ -150,7 +150,7 @@ CLuaState::CLuaState()
TGetLuaIDEInterface getter = (TGetLuaIDEInterface) GetProcAddress(LuaDebuggerModule, "GetLuaIDEInterface");
nlassert(getter);
LuaDebuggerIDE = getter();
LuaDebuggerIDE->prepareDebug("save\\___external_debug.lpr", l_realloc_func, l_free_func, (HWND)Driver->getDisplay());
LuaDebuggerIDE->prepareDebug("save\\___external_debug.lpr", l_realloc_func, l_free_func, Driver->getDisplay());
_State = LuaDebuggerIDE->getLuaState();
}
}

View file

@ -109,7 +109,7 @@ void CMusicPlayer::previous ()
{
// Point the previous song
if (_CurrentSong == 0)
_CurrentSong = _Songs.size()-1;
_CurrentSong = (uint)_Songs.size()-1;
else
_CurrentSong--;
@ -228,7 +228,7 @@ public:
OPENFILENAME ofn;
memset (&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = Driver?(HWND)Driver->getDisplay ():NULL;
ofn.hwndOwner = Driver ? Driver->getDisplay():NULL;
ofn.hInstance = HInstance;
ofn.lpstrFilter = szFilter;
ofn.nFilterIndex = 0;

View file

@ -425,7 +425,7 @@ void loginMainLoop()
#ifdef NL_OS_WINDOWS
{
// Get the window
HWND hWnd = (HWND)Driver->getDisplay ();
HWND hWnd = Driver->getDisplay();
nlassert (hWnd);
// Show the window, unless it has been minimized, in
// which case we don't pop it unexpectedly