If we have a window, g_pContext is set; if not, it's NULL. Avoid redundantly tracking state, when it can be clearly derived from other state; it introduces ways that the class might be in an inconsistent state and adds bookkeeping.

This commit is contained in:
Glenn Maynard
2006-02-25 21:05:19 +00:00
parent 3e72c0e002
commit 1a67cca345
2 changed files with 1 additions and 5 deletions
@@ -27,7 +27,6 @@ static Window g_AltWindow = 0;
static LocalizedString FAILED_CONNECTION_XSERVER( "LowLevelWindow_X11", "Failed to establish a connection with the X server'" );
LowLevelWindow_X11::LowLevelWindow_X11()
{
m_bWindowIsOpen = false;
if( !X11Helper::Go() )
RageException::Throw( FAILED_CONNECTION_XSERVER.GetValue() );
@@ -95,7 +94,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
hints.base_width = p.width;
hints.base_height = p.height;
if( !m_bWindowIsOpen || p.bpp != CurrentParams.bpp || ( m_bWasWindowed != p.windowed ) )
if( g_pContext == NULL || p.bpp != CurrentParams.bpp || m_bWasWindowed != p.windowed )
{
// Different depth, or we didn't make a window before. New context.
bNewDeviceOut = true;
@@ -138,8 +137,6 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
g_AltWindow = X11Helper::CreateWindow(xvi->screen, xvi->depth, xvi->visual, p.width, p.height, !p.windowed);
ASSERT( g_AltWindow );
m_bWindowIsOpen = true;
char *szWindowTitle = const_cast<char *>( p.sWindowTitle.c_str() );
XChangeProperty( X11Helper::Dpy, X11Helper::Win, XA_WM_NAME, XA_STRING, 8, PropModeReplace,
reinterpret_cast<unsigned char*>(szWindowTitle), strlen(szWindowTitle) );
@@ -29,7 +29,6 @@ public:
void EndConcurrentRendering();
private:
bool m_bWindowIsOpen;
bool m_bWasWindowed;
VideoModeParams CurrentParams;
};