30 static Bool fn_always_true( ::Display * , XEvent * , XPointer )
 
   62         Bool rc = XCheckIfEvent( display().x() , &event , &fn_always_true , 0 ) ;
 
   74         if( m_timeout.is_set() && now > m_timeout )
 
   82         struct timeval * tp = nullptr ;
 
   83         if( m_timeout.is_set() )
 
   92         int fd = ConnectionNumber(display().x()) ;
 
   96         int rc = select( fd+1 , &fds , 
nullptr , &fds , tp ) ;
 
   98             throw Error( 
"select failed" ) ;
 
  101         handlePendingEvents() ;
 
  110         Bool rc = XCheckIfEvent( display().x() , &event , &fn_always_true , 0 ) ;
 
  124     XNextEvent( display().x() , &event ) ;
 
  133         XNextEvent( display().x() , &event ) ;
 
  135         if( event.type == type ) break ;
 
  145 void GX::EventLoop::handle( XEvent & e )
 
  151     catch( WindowMap::NotFound & )
 
  154         G_WARNING( 
"warning: event received for unknown window: type " << e.type ) ;
 
  158 void GX::EventLoop::handleImp( XEvent & e )
 
  160     if( e.type == Expose ) 
 
  162         w(e.xexpose.window).
onExposure( e.xexpose.x , e.xexpose.y , e.xexpose.width , e.xexpose.height ) ;
 
  163         w(e.xexpose.window).
onPaint() ;
 
  164         w(e.xexpose.window).
onExpose( e.xexpose ) ;
 
  166     else if( e.type == KeyPress )
 
  170     else if( e.type == KeyRelease ) 
 
  174     else if( e.type == ButtonPress )
 
  176         bool shift = e.xbutton.state & ShiftMask ;
 
  177         bool control = e.xbutton.state & ControlMask ;
 
  178         if( e.xbutton.button == Button1 )
 
  181     else if( e.type == ButtonRelease ) 
 
  183         bool shift = e.xbutton.state & ShiftMask ;
 
  184         bool control = e.xbutton.state & ControlMask ;
 
  185         if( e.xbutton.button == Button1 )
 
  188     else if( e.type == MapNotify ) 
 
  191             throw Error( 
"window not created" ) ; 
 
  192         w(e.xmap.window).
onShow() ;
 
  193         w(e.xmap.window).
onMap( e.xmap ) ;
 
  195     else if( e.type == ClientMessage )
 
  197         w(e.xclient.window).
onUser() ;
 
  199     else if( e.type == MotionNotify )
 
  201         w(e.xmotion.window).
onMouseMove( e.xmotion.x , e.xmotion.y ) ;
 
A window class that is-a GX::Drawable and a GX::EventHandler. 
virtual void onLeftMouseButtonUp(int x, int y, bool shift, bool control)
Called for a left-mouse-button-up event. 
void handlePendingEvents()
Handles all pending events. 
virtual void onPaint()
Called second for a window-expose event. 
void startTimer(unsigned int milliseconds)
Starts a timer for runToTimeout(). 
void runToEmpty()
Processes all events in the queue and then returns. 
virtual void onExposure(int x, int y, int dx, int dy)
Called first for a window-expose event. 
virtual bool onCreate()
Called first for a window-map event. 
An exception class for GX classes. 
virtual void onKeyRelease(::XKeyEvent &)
Called for a key-release event. 
virtual void onLeftMouseButtonDown(int x, int y, bool shift, bool control)
Called for a left-mouse-button-down event. 
virtual void onKeyPress(::XKeyEvent &) override
An override from EventHandler that calls onKey() doing the translation from opaque keycode to meaning...
GX::Window & find(::Window w) const 
Finds a window. Throws if not found. 
virtual void onMouseMove(int x, int y)
Called for a mouse-move event. 
virtual void onExpose(::XExposeEvent &)
Called third for a window-expose event. 
void runOnce()
Waits for one event and processes it. 
void runUntil(int event_type)
Runs the event loop until the given event is received. 
void run()
Runs the event loop. 
virtual void onUser()
Called for a client-message event. 
void runToTimeout()
Processes all events until the timer goes off. 
EventLoop(Display &)
Constructor. The display reference is kept. 
virtual void onShow()
Called second for a window-map event. 
virtual void onMap(::XMapEvent &)
Called third for a window-map event. 
static WindowMap * instance()
Singleton access. Returns nullptr if none. 
A thin wrapper for 'struct timeval' providing relational operators etc.