Laxkit  0.0.7.1
Public Member Functions | Public Attributes
Laxkit::DeviceManager Class Reference

Class to translate various incoming device events into Lax events. More...

List of all members.

Public Member Functions

virtual int init ()
virtual int selectForWindow (anXWindow *win, unsigned long)
 Set proper settings for the window to select for device events.
virtual int eventFilter (EventData **events_ret, XEvent *xev, anXWindow *target, int &isinput)
 Maybe turn an XEvent into zero or more EventData objects.
virtual int SetFocus (anXWindow *win, LaxKeyboard *kb, clock_t t, int notifyonly)
 Tries to get the keyboard to set the focus.
virtual int clearReceiver (EventReceiver *receiver)
 This gets called when a window is removed, and all references to it must be cleared.
virtual int filedescriptors (fd_set *fds, int *n)
 Set any file descriptors in fds to pass on to select() in event loop.
virtual EventDatagetEvents (fd_set *fds)
 For any devices that do not use X, this allows devices to parse any pending events.
virtual LaxDevicefindDevice (int id)
 Return a pointer to the device with the given id, or NULL if not found.
virtual LaxMousefindMouse (int id)
 Find a LaxMouse with the id, or any mouse if id==0.
virtual int NumDevices ()
virtual LaxDeviceDevice (int i)

Public Attributes

PtrStack< LaxDevicedevices

Detailed Description

Class to translate various incoming device events into Lax events.

If you care about events outside of core X events, you would use a DeviceManagerXinput2. Otherwise, for only core events, use a DeviceManagerXlib.

Todo:
*** the plan is to have a handler not only for Xinput1, Xinput2, but also any other devices, such as TUIO, wiimotes, midi, general osc, etc... still debating the best way to do this.

Member Function Documentation

int Laxkit::DeviceManager::clearReceiver ( EventReceiver receiver)
virtual

This gets called when a window is removed, and all references to it must be cleared.

Removes focus reference. Also remove any tooltip consideration reference.

Return 0 for focus removed. nonzero for focus not found.

References Laxkit::PtrStack< T >::e, Laxkit::IsWindowChild(), Laxkit::PtrStack< T >::n, and Laxkit::LaxKeyboard::SetFocus().

int Laxkit::DeviceManager::eventFilter ( EventData **  events_ret,
XEvent *  xev,
anXWindow target,
int isinput 
)
virtual

Maybe turn an XEvent into zero or more EventData objects.

This will overwrite whataver was in *events_ret, replacing it with either a new event list, or NULL.

Return 0 if event is ignored. Return 1 for XEvent absorbed, and the returned EventData objects should be used instead (if any).

References Laxkit::PtrStack< T >::e, Laxkit::LaxDevice::eventFilter(), Laxkit::PtrStack< T >::n, and Laxkit::LaxDevice::usesX().

int Laxkit::DeviceManager::filedescriptors ( fd_set *  fds,
int n_ret 
)
virtual

Set any file descriptors in fds to pass on to select() in event loop.

Return the number of file descriptors set in n_ret. Return value is the maximum value of the descriptors (select() needs this).

This uses LaxDevice::fd() and FD_SET() to set on the fds set.

References Laxkit::PtrStack< T >::e, and Laxkit::PtrStack< T >::n.

int Laxkit::DeviceManager::selectForWindow ( anXWindow win,
unsigned long  mask 
)
virtual

Set proper settings for the window to select for device events.

Default is simply to call LaxDevice::selectForWindow() with each device.

Note that this will be called automatically by anXApp::addwindow() after anXWindow::xlib_window exists.

References Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::n, and Laxkit::LaxDevice::selectForWindow().

int Laxkit::DeviceManager::SetFocus ( anXWindow win,
LaxKeyboard kb,
clock_t  t,
int  notifyonly 
)
virtual

Tries to get the keyboard to set the focus.

If the focus cannot be set based on the given information, return 1. If successful setting of focus, return 0;

If notifyonly, then this has been called in response to an event, not as a request to grab the focus.

This will typically prompt future focus on and off events. For instance, a core Xlib keyboard will use XSetInputFocus(), which will generate Xlib FocusIn and FocusOut events.

Todo:
*** need to figure out an mpx way of handling WM_TAKE_FOCUS!!

References Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::n, and Laxkit::LaxKeyboard::SetFocus().


The documentation for this class was generated from the following files:

Mon Feb 17 2014 11:52:59, Laxkit