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

hg/feature/sound
kervala 15 years ago
parent f71252d0d5
commit 1cb477b8d3

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

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

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

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

@ -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" ) IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )

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

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

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

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

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

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

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

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

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

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

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

@ -284,7 +284,7 @@ void CCustomMouse::release()
{ {
if (!isAlphaBlendedCursorSupported()) return; if (!isAlphaBlendedCursorSupported()) return;
nlassert(Driver); nlassert(Driver);
HWND drvWnd = (HWND) Driver->getDisplay(); HWND drvWnd = Driver->getDisplay();
if (drvWnd) if (drvWnd)
{ {
SetClassLongPtr(drvWnd, GCLP_HCURSOR, 0); 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()) if (CInputHandlerManager::getInstance()->hasFocus())
{ {
::SetCursor(cursorHandle); ::SetCursor(cursorHandle);
HWND drvWnd = (HWND) Driver->getDisplay(); HWND drvWnd = Driver->getDisplay();
if (drvWnd) if (drvWnd)
{ {
SetClassLongPtr(drvWnd, GCLP_HCURSOR, (LONG_PTR) cursorHandle); // set default mouse icon to the last one SetClassLongPtr(drvWnd, GCLP_HCURSOR, (LONG_PTR) cursorHandle); // set default mouse icon to the last one
@ -449,7 +449,7 @@ void CCustomMouse::setSystemArrow()
{ {
::SetCursor(arrow); ::SetCursor(arrow);
} }
HWND drvWnd = (HWND) Driver->getDisplay(); HWND drvWnd = Driver->getDisplay();
if (drvWnd) if (drvWnd)
{ {
SetClassLongPtr(drvWnd, GCLP_HCURSOR, (LONG_PTR) arrow); // set default mouse icon to the last one SetClassLongPtr(drvWnd, GCLP_HCURSOR, (LONG_PTR) arrow); // set default mouse icon to the last one

@ -150,7 +150,7 @@ CLuaState::CLuaState()
TGetLuaIDEInterface getter = (TGetLuaIDEInterface) GetProcAddress(LuaDebuggerModule, "GetLuaIDEInterface"); TGetLuaIDEInterface getter = (TGetLuaIDEInterface) GetProcAddress(LuaDebuggerModule, "GetLuaIDEInterface");
nlassert(getter); nlassert(getter);
LuaDebuggerIDE = 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(); _State = LuaDebuggerIDE->getLuaState();
} }
} }

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

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

Loading…
Cancel
Save