use GraphicsWindow::GetHwnd
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "archutils/win32/GotoURL.h"
|
||||
#include "archutils/win32/RestartProgram.h"
|
||||
#include "archutils/win32/WindowsResources.h"
|
||||
#include "archutils/win32/GraphicsWindow.h"
|
||||
|
||||
static bool g_Hush;
|
||||
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 )
|
||||
{
|
||||
#if defined(HAVE_SDL)
|
||||
@@ -81,7 +80,7 @@ void DialogDriver_Win32::OK( CString sMessage, CString ID )
|
||||
g_AllowHush = ID != "";
|
||||
g_sMessage = sMessage;
|
||||
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 )
|
||||
Dialog::IgnoreMessage( ID );
|
||||
}
|
||||
@@ -157,7 +156,7 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( CString sMessage, CString I
|
||||
SDL_PumpEvents();
|
||||
#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 IDRETRY: return Dialog::retry;
|
||||
@@ -172,7 +171,7 @@ Dialog::Result DialogDriver_Win32::AbortRetry( CString sMessage, CString ID )
|
||||
SDL_PumpEvents();
|
||||
#endif
|
||||
|
||||
switch( MessageBox(g_hWndMain, sMessage, WINDOW_TITLE, MB_RETRYCANCEL ) )
|
||||
switch( MessageBox(GraphicsWindow::GetHwnd(), sMessage, WINDOW_TITLE, MB_RETRYCANCEL ) )
|
||||
{
|
||||
case IDRETRY: return Dialog::retry;
|
||||
default: ASSERT(0);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "archutils/Win32/AppInstance.h"
|
||||
#include "archutils/Win32/GraphicsWindow.h"
|
||||
#include "InputFilter.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
|
||||
* is focused. */
|
||||
if( GetForegroundWindow() != g_hWndMain )
|
||||
if( GetForegroundWindow() != GraphicsWindow::GetHwnd() )
|
||||
return;
|
||||
|
||||
for(int i = 0; i < (int) numevents; ++i)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "StepMania.h"
|
||||
#include "archutils/Win32/GraphicsWindow.h"
|
||||
|
||||
#pragma comment(lib, "dinput.lib")
|
||||
#if defined(_WINDOWS)
|
||||
@@ -47,7 +48,7 @@ bool DIDevice::Open()
|
||||
if( type == KEYBOARD )
|
||||
coop = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE;
|
||||
|
||||
hr = Device->SetCooperativeLevel( g_hWndMain, coop );
|
||||
hr = Device->SetCooperativeLevel( GraphicsWindow::GetHwnd(), coop );
|
||||
if ( hr != DI_OK )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
ASSERT( g_hWndMain != NULL );
|
||||
ASSERT( GraphicsWindow::GetHwnd() != NULL );
|
||||
ASSERT( GraphicsWindow::GetHDC() != NULL );
|
||||
|
||||
ZERO( *PixelFormat );
|
||||
@@ -114,7 +114,7 @@ CString LowLevelWindow_Win32::TryVideoMode( RageDisplay::VideoModeParams p, bool
|
||||
bool bCanSetPixelFormat = true;
|
||||
|
||||
/* 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.
|
||||
* 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;
|
||||
}
|
||||
|
||||
ASSERT( g_hWndMain );
|
||||
ASSERT( GraphicsWindow::GetHwnd() );
|
||||
|
||||
/* Set the display mode: switch to a fullscreen mode or revert to windowed mode. */
|
||||
LOG->Trace("SetScreenMode ...");
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "arch/Threads/Threads_Win32.h"
|
||||
#include "archutils/win32/WindowsResources.h"
|
||||
#include "archutils/Win32/GraphicsWindow.h" /* for GraphicsWindow::GetHwnd */
|
||||
#include "crash.h"
|
||||
#include "ProductInfo.h"
|
||||
|
||||
@@ -161,7 +162,6 @@ bool VDDebugInfoInitFromFile( VDDebugInfoContext *pctx );
|
||||
void VDDebugInfoDeinit(VDDebugInfoContext *pctx);
|
||||
|
||||
|
||||
extern HWND g_hWndMain;
|
||||
long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc)
|
||||
{
|
||||
/* 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
|
||||
* crash dialog. Try to hide the window. Things might blow up here; do this
|
||||
* 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 window. This will also restore the video mode, if necessary. */
|
||||
ShowWindow( g_hWndMain, SW_HIDE );
|
||||
ShowWindow( GraphicsWindow::GetHwnd(), SW_HIDE );
|
||||
} else {
|
||||
/* A different thread crashed. Simply kill all other windows. We can't safely
|
||||
* call ShowWindow; the main thread might be deadlocked. */
|
||||
|
||||
Reference in New Issue
Block a user