use GraphicsWindow::GetHwnd

This commit is contained in:
Glenn Maynard
2005-02-07 09:16:00 +00:00
parent 28241e30aa
commit 7ccda6012d
5 changed files with 14 additions and 13 deletions
@@ -10,6 +10,7 @@
#include "archutils/win32/GotoURL.h" #include "archutils/win32/GotoURL.h"
#include "archutils/win32/RestartProgram.h" #include "archutils/win32/RestartProgram.h"
#include "archutils/win32/WindowsResources.h" #include "archutils/win32/WindowsResources.h"
#include "archutils/win32/GraphicsWindow.h"
static bool g_Hush; static bool g_Hush;
static CString g_sMessage; static CString g_sMessage;
@@ -70,8 +71,6 @@ static BOOL CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
} }
extern HWND g_hWndMain;
void DialogDriver_Win32::OK( CString sMessage, CString ID ) void DialogDriver_Win32::OK( CString sMessage, CString ID )
{ {
#if defined(HAVE_SDL) #if defined(HAVE_SDL)
@@ -81,7 +80,7 @@ void DialogDriver_Win32::OK( CString sMessage, CString ID )
g_AllowHush = ID != ""; g_AllowHush = ID != "";
g_sMessage = sMessage; g_sMessage = sMessage;
AppInstance handle; AppInstance handle;
DialogBox(handle.Get(), MAKEINTRESOURCE(IDD_OK), g_hWndMain, OKWndProc); DialogBox(handle.Get(), MAKEINTRESOURCE(IDD_OK), GraphicsWindow::GetHwnd(), OKWndProc);
if( g_AllowHush && g_Hush ) if( g_AllowHush && g_Hush )
Dialog::IgnoreMessage( ID ); Dialog::IgnoreMessage( ID );
} }
@@ -157,7 +156,7 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( CString sMessage, CString I
SDL_PumpEvents(); SDL_PumpEvents();
#endif #endif
switch( MessageBox(g_hWndMain, sMessage, WINDOW_TITLE, MB_ABORTRETRYIGNORE|MB_DEFBUTTON3 ) ) switch( MessageBox(GraphicsWindow::GetHwnd(), sMessage, WINDOW_TITLE, MB_ABORTRETRYIGNORE|MB_DEFBUTTON3 ) )
{ {
case IDABORT: return Dialog::abort; case IDABORT: return Dialog::abort;
case IDRETRY: return Dialog::retry; case IDRETRY: return Dialog::retry;
@@ -172,7 +171,7 @@ Dialog::Result DialogDriver_Win32::AbortRetry( CString sMessage, CString ID )
SDL_PumpEvents(); SDL_PumpEvents();
#endif #endif
switch( MessageBox(g_hWndMain, sMessage, WINDOW_TITLE, MB_RETRYCANCEL ) ) switch( MessageBox(GraphicsWindow::GetHwnd(), sMessage, WINDOW_TITLE, MB_RETRYCANCEL ) )
{ {
case IDRETRY: return Dialog::retry; case IDRETRY: return Dialog::retry;
default: ASSERT(0); default: ASSERT(0);
@@ -5,6 +5,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "archutils/Win32/AppInstance.h" #include "archutils/Win32/AppInstance.h"
#include "archutils/Win32/GraphicsWindow.h"
#include "InputFilter.h" #include "InputFilter.h"
#include "PrefsManager.h" #include "PrefsManager.h"
@@ -350,7 +351,7 @@ void InputHandler_DInput::UpdateBuffered(DIDevice &device, const RageTimer &tm)
/* XXX: We should check GetConsoleWindow(), to allow input while the console window /* XXX: We should check GetConsoleWindow(), to allow input while the console window
* is focused. */ * is focused. */
if( GetForegroundWindow() != g_hWndMain ) if( GetForegroundWindow() != GraphicsWindow::GetHwnd() )
return; return;
for(int i = 0; i < (int) numevents; ++i) for(int i = 0; i < (int) numevents; ++i)
@@ -3,6 +3,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "StepMania.h" #include "StepMania.h"
#include "archutils/Win32/GraphicsWindow.h"
#pragma comment(lib, "dinput.lib") #pragma comment(lib, "dinput.lib")
#if defined(_WINDOWS) #if defined(_WINDOWS)
@@ -47,7 +48,7 @@ bool DIDevice::Open()
if( type == KEYBOARD ) if( type == KEYBOARD )
coop = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE; coop = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE;
hr = Device->SetCooperativeLevel( g_hWndMain, coop ); hr = Device->SetCooperativeLevel( GraphicsWindow::GetHwnd(), coop );
if ( hr != DI_OK ) if ( hr != DI_OK )
{ {
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetCooperativeLevel", JoystickInst.tszProductName) ); LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetCooperativeLevel", JoystickInst.tszProductName) );
@@ -47,7 +47,7 @@ LowLevelWindow_Win32::~LowLevelWindow_Win32()
int ChooseWindowPixelFormat( RageDisplay::VideoModeParams p, PIXELFORMATDESCRIPTOR *PixelFormat ) int ChooseWindowPixelFormat( RageDisplay::VideoModeParams p, PIXELFORMATDESCRIPTOR *PixelFormat )
{ {
ASSERT( g_hWndMain != NULL ); ASSERT( GraphicsWindow::GetHwnd() != NULL );
ASSERT( GraphicsWindow::GetHDC() != NULL ); ASSERT( GraphicsWindow::GetHDC() != NULL );
ZERO( *PixelFormat ); ZERO( *PixelFormat );
@@ -114,7 +114,7 @@ CString LowLevelWindow_Win32::TryVideoMode( RageDisplay::VideoModeParams p, bool
bool bCanSetPixelFormat = true; bool bCanSetPixelFormat = true;
/* Do we have an old window? */ /* Do we have an old window? */
if( g_hWndMain == NULL ) if( GraphicsWindow::GetHwnd() == NULL )
{ {
/* No. Always create and show the window before changing the video mode. /* No. Always create and show the window before changing the video mode.
* Otherwise, some other window may have focus, and changing the video mode will * Otherwise, some other window may have focus, and changing the video mode will
@@ -128,7 +128,7 @@ CString LowLevelWindow_Win32::TryVideoMode( RageDisplay::VideoModeParams p, bool
bCanSetPixelFormat = false; bCanSetPixelFormat = false;
} }
ASSERT( g_hWndMain ); ASSERT( GraphicsWindow::GetHwnd() );
/* Set the display mode: switch to a fullscreen mode or revert to windowed mode. */ /* Set the display mode: switch to a fullscreen mode or revert to windowed mode. */
LOG->Trace("SetScreenMode ..."); LOG->Trace("SetScreenMode ...");
+3 -3
View File
@@ -10,6 +10,7 @@
#include "arch/Threads/Threads_Win32.h" #include "arch/Threads/Threads_Win32.h"
#include "archutils/win32/WindowsResources.h" #include "archutils/win32/WindowsResources.h"
#include "archutils/Win32/GraphicsWindow.h" /* for GraphicsWindow::GetHwnd */
#include "crash.h" #include "crash.h"
#include "ProductInfo.h" #include "ProductInfo.h"
@@ -161,7 +162,6 @@ bool VDDebugInfoInitFromFile( VDDebugInfoContext *pctx );
void VDDebugInfoDeinit(VDDebugInfoContext *pctx); void VDDebugInfoDeinit(VDDebugInfoContext *pctx);
extern HWND g_hWndMain;
long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc) long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc)
{ {
/* Flush the log it isn't cut off at the end. */ /* Flush the log it isn't cut off at the end. */
@@ -253,11 +253,11 @@ long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc)
/* Now things get more risky. If we're fullscreen, the window will obscure the /* Now things get more risky. If we're fullscreen, the window will obscure the
* crash dialog. Try to hide the window. Things might blow up here; do this * crash dialog. Try to hide the window. Things might blow up here; do this
* after DoSave, so we always write a crash dump. */ * after DoSave, so we always write a crash dump. */
if( GetWindowThreadProcessId( g_hWndMain, NULL ) == GetCurrentThreadId() ) if( GetWindowThreadProcessId( GraphicsWindow::GetHwnd(), NULL ) == GetCurrentThreadId() )
{ {
/* The thread that crashed was the thread that created the main window. Hide /* The thread that crashed was the thread that created the main window. Hide
* the window. This will also restore the video mode, if necessary. */ * the window. This will also restore the video mode, if necessary. */
ShowWindow( g_hWndMain, SW_HIDE ); ShowWindow( GraphicsWindow::GetHwnd(), SW_HIDE );
} else { } else {
/* A different thread crashed. Simply kill all other windows. We can't safely /* A different thread crashed. Simply kill all other windows. We can't safely
* call ShowWindow; the main thread might be deadlocked. */ * call ShowWindow; the main thread might be deadlocked. */