diff --git a/stepmania/src/archutils/Unix/X11Helper.cpp b/stepmania/src/archutils/Unix/X11Helper.cpp index 5619a48233..e2cee0b896 100644 --- a/stepmania/src/archutils/Unix/X11Helper.cpp +++ b/stepmania/src/archutils/Unix/X11Helper.cpp @@ -6,8 +6,6 @@ #include "RageDisplay.h" // RageDisplay -vector pCBacks; // Callbacks for the rendering - // thread list pMasks; // Currently open masks Display *pDpy; // Running X connection Window *pWin = NULL; // Current window @@ -31,6 +29,11 @@ Display *X11Helper::Dpy() return pDpy; } +Window& X11Helper::Win() +{ + return pWin; +} + static bool pApplyMasks() { int i; @@ -52,13 +55,9 @@ bool X11Helper::OpenMask(long mask) { pMasks.push_back(mask); if(pWin != NULL) - { - return pApplyMasks(); - } + { return pApplyMasks(); } else - { - return true; - } + { return true; } } bool X11Helper::CloseMask(long mask) @@ -78,13 +77,9 @@ bool X11Helper::CloseMask(long mask) } if(pWin != NULL) - { - return pApplyMasks(); - } + { return pApplyMasks(); } else - { - return true; - } + { return true; } } bool X11Helper::MakeWindow(int screenNum, int depth, Visual *visual int width=64, int height=64) @@ -106,21 +101,7 @@ bool X11Helper::MakeWindow(int screenNum, int depth, Visual *visual int width=64 height, 0, depth, InputOutput, visual, CWBorderPixel | CWColorMap | CWEventMask, &winAttribs); - i = 0; - while(i < pCBacks.size() ) - { - pCBacks[i](pWin); - i++; - } - - return pApplyMasks(); -} - -bool X11Helper::Callback(Callback_t cb) -{ - pCBacks.push_back(cb); - - return true; + return pApplyMasks(); } void X11Helper::Stop() diff --git a/stepmania/src/archutils/Unix/X11Helper.h b/stepmania/src/archutils/Unix/X11Helper.h index cb213f8a9a..f49d5c411f 100644 --- a/stepmania/src/archutils/Unix/X11Helper.h +++ b/stepmania/src/archutils/Unix/X11Helper.h @@ -19,14 +19,15 @@ namespace X11Helper // didn't call Go() with a successful result first. Display *Dpy(); + // Get the current open window. Behavior is undefined if we didn't make + // a window yet. + Window& Win(); + // (Re)create the window on the screen of this number with this depth, // this visual type, this width (optional -- you can resize the window // in your callback later), and this height (optional). - bool MakeWindow(int screenNum, int depth, Visual *visual, int width=64, - int height=64); - - // Callback type. - typedef void (*Callback_t)(Window*); + bool MakeWindow(int screenNum, int depth, Visual *visual, + int width=64, int height=64); // Unmask one X event type mask thingy (XSelectInput() arg 3) on the // current window. Masked/unmasked events will carry between windows. @@ -36,11 +37,6 @@ namespace X11Helper // current window. Masked/unmasked events will carry between windows. bool CloseMask(long mask); - // Register a callback for new windows (including the initial window). - // This callback will be called with 0 if I try to create a new window, - // but fail. - bool Callback(Callback_t cb); - // Destroy the connection, if appropriate; otherwise do some important // internal session-tracking stuff (so you should call it anyway). void Stop();