split out CreateWindow

This commit is contained in:
Glenn Maynard
2006-01-27 08:17:29 +00:00
parent f09aee93b8
commit 24e016c397
2 changed files with 15 additions and 6 deletions
+13 -6
View File
@@ -88,8 +88,6 @@ static bool pApplyMasks()
bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width, int height, bool overrideRedirect ) bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width, int height, bool overrideRedirect )
{ {
vector<long>::iterator i;
if( g_iRefCount == 0 ) if( g_iRefCount == 0 )
return false; return false;
@@ -101,6 +99,17 @@ bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width,
// 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...
Window Win = CreateWindow( screenNum, depth, visual, width, height, overrideRedirect );
g_bHaveWin = true;
return true;
}
Window X11Helper::CreateWindow( int screenNum, int depth, Visual *visual, int width, int height, bool overrideRedirect )
{
vector<long>::iterator i;
XSetWindowAttributes winAttribs; XSetWindowAttributes winAttribs;
winAttribs.border_pixel = 0; winAttribs.border_pixel = 0;
@@ -116,6 +125,7 @@ bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width,
winAttribs.colormap = XCreateColormap( Dpy, RootWindow(Dpy, screenNum), visual, AllocNone ); winAttribs.colormap = XCreateColormap( Dpy, RootWindow(Dpy, screenNum), visual, AllocNone );
Window Win;
if( overrideRedirect ) if( overrideRedirect )
{ {
winAttribs.override_redirect = True; winAttribs.override_redirect = True;
@@ -130,9 +140,6 @@ bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width,
CWBorderPixel | CWColormap | CWEventMask, &winAttribs ); CWBorderPixel | CWColormap | CWEventMask, &winAttribs );
} }
g_bHaveWin = true;
/* Hide the mouse cursor. */ /* Hide the mouse cursor. */
{ {
const char pBlank[] = { 0,0,0,0,0,0,0,0 }; const char pBlank[] = { 0,0,0,0,0,0,0,0 };
@@ -146,7 +153,7 @@ bool X11Helper::MakeWindow( int screenNum, int depth, Visual *visual, int width,
XFreeCursor( Dpy, pBlankPointer ); XFreeCursor( Dpy, pBlankPointer );
} }
return true; return Win;
} }
int protoErrorCallback( Display *d, XErrorEvent *err ) int protoErrorCallback( Display *d, XErrorEvent *err )
+2
View File
@@ -30,6 +30,8 @@ namespace X11Helper
bool MakeWindow(int screenNum, int depth, Visual *visual, bool MakeWindow(int screenNum, int depth, Visual *visual,
int width=32, int height=32, bool overrideRedirect=false); int width=32, int height=32, bool overrideRedirect=false);
Window CreateWindow( int screenNum, int depth, Visual *visual, int width, int height, bool overrideRedirect );
// Unmask one X event type mask thingy (XSelectInput() arg 3) on the // Unmask one X event type mask thingy (XSelectInput() arg 3) on the
// current window. Masked/unmasked events will carry between windows. // current window. Masked/unmasked events will carry between windows.
bool OpenMask(long mask); bool OpenMask(long mask);