Design change -- the callback system is unnecssary, all InputHandler_X11 needs to do is unmask events, which is already available through OpenMask(). Also, a few idle formatting tweaks.

This commit is contained in:
Ben Anderson
2005-03-13 17:54:13 +00:00
parent 410da1de20
commit 62c0288f66
2 changed files with 16 additions and 39 deletions
+9 -28
View File
@@ -6,8 +6,6 @@
#include "RageDisplay.h" // RageDisplay
vector<Callback_t> pCBacks; // Callbacks for the rendering
// thread
list<long> 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,23 +101,9 @@ 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;
}
void X11Helper::Stop()
{
pCt--;
+6 -10
View File
@@ -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();