pfvInputMngr(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
NAMEpfvInputMngr - Track Mouse and Keyboard Input over multiple Display
Manager Views.
FUNCTION SPECIFICATION
#include <Performer/pfv/pfvInput.h>
static int pfvInputMngr::init();
static int pfvInputMngr::collectEvents();
static pfuMouse* pfvInputMngr::getMouse();
static pfuEventStream* pfvInputMngr::getEvents();
static int pfvInputMngr::getFocusViewIndex();
static int pfvInputMngr::getViewNormXY( float*x,
float*y );
static int pfvInputMngr::getFocusChanIndex();
static pfvDispChan* pfvInputMngr::getFocusChan();
static int pfvInputMngr::getChanNormXY( float*x,
float*y );
static int pfvInputMngr::getChanAbsXY( int*x,
int*y );
static int pfvInputMngr::getFocusPWinIndex();
static int pfvInputMngr::getPWinNormXY( float*x,
float*y );
static int pfvInputMngr::getPWinAbsXY( int*x,
int*y );
static pfvInputMngrCallback* -
pfvInputMngr::addCallback( pfvInputMngrCBFunc_t func,
void* data, char* evMask,
uint64_t viewMask=0 );
static int -
pfvInputMngr::deleteCallback( pfvInputMngrCallback* cb );
static int -
pfvInputMngr::deleteCallback( pfvInputMngrCBFunc_t func,
void* data );
Page 1
pfvInputMngr(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
static pfvInputMngrCallback* -
pfvInputMngr::findCallback(pfvInputMngrCBFunc_t func,
void*data);
static int pfvInputMngr::getNumCallbacks();
static pfvInputMngrCallback* pfvInputMngr::getCallback(int i);
static int pfvInputMngr::dispatchEvents();
static int pfvInputMngr::dispatchKeyEvent(int key,
int viewMask=0);
static char* pfvInputMngr::getKeyName(int key);
static int -
pfvInputMngr::getKeyFromName(char*keyName);
DESCRIPTION
The pfvInputMngr class is used to track mouse and keyboard events over
multiple pipes, pipewindows and channels, as configured by the Display
Manager.
pfvInputMngr makes extensive use of the pfutil library for input
collection.
pfvInputMngr::init initializes input collection on all pwins created by
the pfvDisplayMngr. This function must be called after
pfvDispMngr::postConfig, since pfPipe, pfPipeWindow and pfChannels are
expected to exist before input can be initialized. pfvInputMngr::init
will call pfuInitMultiChanInput.
pfvInputMngr::collectEvents will collect all mouse and keyboard events
generated since method was last called, and will carry out useful
computation such as establishing which view has current mouse focus, and
computing mouse coordinates in channel,pwin and view-normalized coords.
Note that pfvInputMngr::collectEvents will call pfuGetMouse and
pfuGetEvents.
pfvInputMngr::getMouse returns a pointer to the pfuMouse structure used
by pfvInputMngr to collect mouse data through pfuGetMouse. This points to
a static pfuMouse structure within the pfvInputMngr class and will
therefore remain valid through the course of the application.
pfvInputMngr::getEvents returns a pointer to the pfuEventStream structure
used by pfvInputMngr to collect keyboard event data through
pfuGetEvents. This points to a static pfuEventStream structure within
the pfvInputMngr class and will therefore remain valid through the course
of the application.
pfvInputMngr::getFocusViewIndex returns the index of the view which has
current focus. If cursor is within the viewport of a channel created by
Page 2
pfvInputMngr(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
the Display Manager, the index of the view to which channel belongs will
be returned. If cursor is not over any channel, or not over any pwin,
this method will return -1. Note that the index associated with a view
is that returned by pfvDispView::getIndex, and represents view's position
in Display Manager's view-list. Note that when dragging cursor while
keeping one or more buttons pressed, focus is retained by the view over
which button was first pressed, so it is possible to have a valid focus-
view index even if mouse is not over a channel belonging to such view.
pfvInputMngr::getViewNormXY will return current mouse coordinates
normalized to the current focus-view. View-normalized coordinates are
computed based on focus-channel's view-range settings (see man page for
pfvDispChan::setViewRange).
pfvInputMngr::getFocusChanIndex returns the index of the pfvDispChannel
that has current mouse focus. The index associated with a channel is that
returned by pfvDispChan::getIndex, and represents channel's position in
Display Manager's channel-list. If no channel has current mouse focus,
this method returns -1.
pfvInputMngr::getFocusChan() returns a pointer to the pfvDispChan with
current mouse focus. If no channel has current mouse focus, this method
returns NULL.
pfvInputMngr::getChanNormXY returns the current cursor position
normalized to focus-channel's viewport.
pfvInputMngr::getChanAbsXY returns the current cursor position expressed
as integer offsets (in pixels) from the bottom-left corner of viewport of
channel with current focus.
pfvInputMngr::getFocusPWinIndex returns the index of the pfvDispPWin with
current mouse focus. The index associated with a pwin is that returned by
pfvDispPWin::getIndex, and represents pwin's position in Display
Manager's pwin-list.
pfvInputMngr::getPWinNormXY will return current mouse coordinates
normalized to the current focus-pwin.
pfvInputMngr::getPWinAbsXY returns the current cursor position expressed
as integer offsets (in pixels) from the bottom-left corner of pipe window
with current focus.
pfvInputMngr::addCallback registers the callback function func with the
Input Manager. data is a pointer to user data that will be passed as an
argument to callback whenever it is called by InputMngr. evMask is a
zero-terminated string containing a list of key values to which callback
function needs to be associated. viewMask is a 64-bit mask indicating
that callback should be called only if event (key press) happens over the
collection of views specified by mask. Note that if mask is equal to 0,
callback will be associated with all views. This function creates and
returns a handle to a new pfvInputMngrCallback object. This pointer can
Page 3
pfvInputMngr(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
be stored by user so that callback can later be removed, or associated
with different keys, or with different views. See man page for
pfvInputMngrCallback.
pfvInputMngr::deleteCallback( pfvInputMngrCallback* cb ) deletes the
pfvInputMngrCallback pointed to by cb.
pfvInputMngr::deleteCallback( pfvInputMngrCBFunc_t func, void* data )
will look through all registered pfvInputMngrCallbacks, and will delete
the first one that has func as an associated callback function, and data
as associated userData.
pfvInputMngr::findCallback will look through all registered
pfvInputMngrCallbacks, and return a pointer to the first one that has
func as an associated callback function, and data as associated userData.
If no matching pfvInputMngrCallback is found, NULL is returned.
pfvInputMngr::getNumCallbacks returns the number of currently registered
pfvInputMngrCallbacks.
pfvInputMngr::getCallback returns a pointer to the ith
pfvInputMngrCallback in global list held by Input Manager if i is a valid
index, else method returns NULL.
pfvInputMngr::dispatchKeyEvent can be used to simulate a key-press event
for any given key. The input manager will go through the list of
pfvInputMngrCallbacks which are currently enabled for that key, and will
call the corresponding user callbacks until one of them returns non-zero,
indicating that key-down event was used (grabbed) by user-callback. If
vMask is non-zero, only user-callbacks associated with
pfvInputMngrCallbacks whose view-mask is either zero, or the result of a
bitwise OR on the two masks is itself non-zero are called.
The method pfvInputMngr::dispatchEvents will look at the pfuEventStream
structure allocated by the Input Manager, and will dispatch callback
calls for all events it finds. Note that for each event in pfuEventStream
struct, the method pfvInputMngr::dispatchKeyEvent is called with a
viewMask corresponding to the view with current focus, or zero if no view
has current focus.
pfvInputMngr::getKeyName returns a pointer to the name (a string),
associated with the key-value key. For a list of all defined key values
see the header file /usr/include/Performer/pfv/pfvInput.h. The strings
returned by pfvInputMngr::getKeyName can be deduced by removing the
PFVKEY_ prefix from the #defined token names. Eg: key= PFVKEY_a, key-
name= "a" key= PFVKEY_BACKSLASH, key-name= "BACKSLASH"
pfvInputMngr::getKeyFromName returns the key value corresponding to the
key whose name matches string keyName, or 0 if no key name matches.
Page 4
pfvInputMngr(3pf) OpenGL Performer 3.2.2 libpfv C++ Reference Pages
NOTESSEE ALSO
pfvInputMngrCallback, pfDisplayMngr, pfvDispPWin, pfvDispChan,
pfDispView, pfvViewer, pfuInitIput, pfuGetMouse, pfuGetEvents
Page 5