Don't apply masks unless our window has been created.

This commit is contained in:
Ben Anderson
2005-06-03 18:40:39 +00:00
parent 265d9d56df
commit d280cf7445
+6 -4
View File
@@ -13,6 +13,9 @@ static vector<long> g_aiMasks;
// Number of subsystems using the X connection: // Number of subsystems using the X connection:
static int g_iRefCount = 0; static int g_iRefCount = 0;
// Do we have a window?
static bool g_bHaveWin = false;
Display *X11Helper::Dpy = NULL; Display *X11Helper::Dpy = NULL;
Window X11Helper::Win; Window X11Helper::Win;
@@ -68,7 +71,7 @@ bool X11Helper::CloseMask( long mask )
static bool pApplyMasks() static bool pApplyMasks()
{ {
if( X11Helper::Dpy == NULL ) if( X11Helper::Dpy == NULL | !g_bHaveWin )
return true; return true;
LOG->Trace("X11Helper: Reapplying event masks."); LOG->Trace("X11Helper: Reapplying event masks.");
@@ -85,16 +88,15 @@ static bool pApplyMasks()
bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width, int height ) bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width, int height )
{ {
static bool pHaveWin = false;
vector<long>::iterator i; vector<long>::iterator i;
if( g_iRefCount == 0 ) if( g_iRefCount == 0 )
return false; return false;
if( pHaveWin ) if( g_bHaveWin )
{ {
XDestroyWindow( Dpy, Win ); XDestroyWindow( Dpy, Win );
pHaveWin = false; g_bHaveWin = false;
} }
// pHaveWin will stay false if an error occurs once I do error // pHaveWin will stay false if an error occurs once I do error
// checking here... // checking here...