newspeoplefor developersdocumentationdownloads

nInputServer Class Reference
[Input Subsystem]

#include <ninputserver.h>

Inheritance diagram for nInputServer:

nRoot nObject nNode nReferenced nSignalEmitter nDI8Server List of all members.

Detailed Description

Manage input devices, events and mappings.

See also nInputServer Script Interface

(C) 2002 RadonLabs GmbH

Definition at line 24 of file ninputserver.h.


Public Member Functions

 nInputServer ()
 constructor
virtual ~nInputServer ()
 destructor
virtual void Open ()
 open the input server
virtual void Trigger (double time)
 per frame trigger
nInputEventNewEvent ()
 create a new input event object
void ReleaseEvent (nInputEvent *event)
 release an input event object
void LinkEvent (nInputEvent *event)
 link input event object into global input event list
void UnlinkEvent (nInputEvent *event)
 unlink input event object from global input event list
void FlushEvents ()
 flush (clear) global input event list
nInputEventFirstEvent ()
 return pointer to first input event in global input event list
nInputEventNextEvent (nInputEvent *)
 return pointer to next event in global input event list
void BeginMap ()
 begin mapping input events
bool Map (const char *event, const char *state)
 map an input event to an input state
void EndMap ()
 finish mapping input
float GetSlider (const char *state)
 get an input state as slider value
bool GetButton (const char *state)
 get an input state as button value
const vector2GetMousePos () const
 get the current mouse pos
void StartLogging ()
 start logging input
void StopLogging ()
 stop logging input
bool IsLogging ()
 is currently logging input?
void SetLongPressedTime (float)
 set the long pressed time
float GetLongPressedTime ()
 get the long pressed time
void SetDoubleClickTime (float)
 set the double click time
float GetDoubleClickTime ()
 get the double click time
void SetMouseFactor (float s)
 set mouse sensitivity
float GetMouseFactor () const
 get mouse sensitivity
void SetMouseInvert (bool b)
 set invert mouse flag
bool GetMouseInvert () const
 get invert mouse flag
void ObtainFocus ()
 call when input focus obtained
void LoseFocus ()
 call when input focus lost
void FlushInput ()
 flush entire input mapping
void SetMute (bool b)
 set mute mode on/off
bool GetMute () const
 get mute mode

Static Public Member Functions

static nInputServerInstance ()
 get instance pointer

Protected Types

enum  { N_MAXNUM_SCRIPTS = 16 }

Protected Member Functions

bool MapStrToEvent (const char *str, nInputEvent *event)
 convert an input event string into an input event
nInputEventFirstIdenticalEvent (nInputEvent *pattern)
 return pointer to first matching event
nInputEventNextIdenticalEvent (nInputEvent *pattern, nInputEvent *cur)
 return pointer to next matching event
void DoInputMapping ()
 do actual input mapping
void BeginScripts ()
 begin adding a script to execute
void AddScript (const char *script)
 add a script to execute
void EndScripts ()
 finish adding script
bool IsIdenticalEvent (nInputEvent *event0, nInputEvent *event1)
 check if events are identical
void LogSingleEvent (nInputEvent *event)
 log a single event
void LogEvents ()
 log all events
nInputStateGetInputState (const char *state)
 find input state object by name
nInputStateAddInputState (const char *state)
 add a named input state
void ExportDefaultKeyboard ()
 export the default keyboard
void ExportDefaultMouse ()
 export the default mouse
const char * BuildInputMappingName (const char *ieStr, const char *isStr, char *buf, int bufSize)
 build an input mapping name

Protected Attributes

double timeStamp
nAutoRef< nScriptServerref_ss
nAutoRef< nConServerref_con
nRef< nRootref_statedir
nRef< nRootref_inpdir
nList events
bool log_events
bool in_begin_map
bool mute
nHashList im_list
nHashList is_list
int act_script
const char * script_array [N_MAXNUM_SCRIPTS]
double long_pressed_time
double double_click_time
float mouseFactor
bool mouseInvert
vector2 mousePos

Member Enumeration Documentation

anonymous enum [protected]
 

Enumerator:
N_MAXNUM_SCRIPTS 

Reimplemented from nRoot.

Definition at line 136 of file ninputserver.h.


Constructor & Destructor Documentation

nInputServer::nInputServer  ) 
 

constructor

Definition at line 98 of file ninput_main.cc.

nInputServer::~nInputServer  )  [virtual]
 

destructor

Definition at line 127 of file ninput_main.cc.


Member Function Documentation

nInputServer * nInputServer::Instance  )  [inline, static]
 

get instance pointer

Definition at line 172 of file ninputserver.h.

void nInputServer::Open  )  [virtual]
 

open the input server

Reimplemented in nDI8Server.

Definition at line 162 of file ninput_main.cc.

void nInputServer::Trigger double  time  )  [virtual]
 

per frame trigger

Do the usual per frame stuff, especially mapping raw events to cooked input states.

  • 09-Mar-99 floh created
  • 22-Jul-99 floh + nInputState-Handling
  • 26-Nov-99 floh + oops, boeser Bug, innerhalb der Mapping- Schleife konnten Scripts ausgefuehrt werden, die die Mapping-Liste selbst aendern konnten, wodurch die Schleife vollkommen aus dem Tritt geriet und abstuerzen konnte!
  • 10-Dec-99 floh + Disabled-Events werden jetzt beim Mapping ignoriert (der Console-Server darf Tasten- Events nicht mehr loeschen, sondern disabled sie, das ganze, damit das Input-Recording auch bei offener Konsole klappt)
  • 21-Dec-99 floh + Modifier-Handling fuer Input-States + neues Script-Handling (nicht mehr generell bei Button-Down, sondern bei "Active"

Reimplemented in nDI8Server.

Definition at line 267 of file ninput_main.cc.

nInputEvent * nInputServer::NewEvent  ) 
 

create a new input event object

Definition at line 12 of file ninput_events.cc.

void nInputServer::ReleaseEvent nInputEvent event  ) 
 

release an input event object

Definition at line 20 of file ninput_events.cc.

void nInputServer::LinkEvent nInputEvent event  ) 
 

link input event object into global input event list

Definition at line 33 of file ninput_events.cc.

void nInputServer::UnlinkEvent nInputEvent event  ) 
 

unlink input event object from global input event list

Definition at line 43 of file ninput_events.cc.

void nInputServer::FlushEvents  ) 
 

flush (clear) global input event list

Definition at line 53 of file ninput_events.cc.

nInputEvent * nInputServer::FirstEvent  ) 
 

return pointer to first input event in global input event list

Definition at line 92 of file ninput_events.cc.

nInputEvent * nInputServer::NextEvent nInputEvent  ) 
 

return pointer to next event in global input event list

Definition at line 101 of file ninput_events.cc.

void nInputServer::BeginMap  ) 
 

begin mapping input events

Definition at line 42 of file ninput_states.cc.

bool nInputServer::Map const char *  event,
const char *  state
 

map an input event to an input state

Definition at line 83 of file ninput_states.cc.

void nInputServer::EndMap  ) 
 

finish mapping input

Definition at line 181 of file ninput_states.cc.

float nInputServer::GetSlider const char *  state  ) 
 

get an input state as slider value

Definition at line 230 of file ninput_states.cc.

bool nInputServer::GetButton const char *  state  ) 
 

get an input state as button value

Definition at line 247 of file ninput_states.cc.

const vector2 & nInputServer::GetMousePos  )  const [inline]
 

get the current mouse pos

Definition at line 205 of file ninputserver.h.

void nInputServer::StartLogging  ) 
 

start logging input

Definition at line 14 of file ninput_log.cc.

void nInputServer::StopLogging  ) 
 

stop logging input

Definition at line 30 of file ninput_log.cc.

bool nInputServer::IsLogging  ) 
 

is currently logging input?

Definition at line 45 of file ninput_log.cc.

void nInputServer::SetLongPressedTime float   ) 
 

set the long pressed time

Definition at line 213 of file ninput_main.cc.

float nInputServer::GetLongPressedTime  ) 
 

get the long pressed time

Definition at line 222 of file ninput_main.cc.

void nInputServer::SetDoubleClickTime float   ) 
 

set the double click time

Definition at line 231 of file ninput_main.cc.

float nInputServer::GetDoubleClickTime  ) 
 

get the double click time

Definition at line 239 of file ninput_main.cc.

void nInputServer::SetMouseFactor float  s  )  [inline]
 

set mouse sensitivity

Definition at line 215 of file ninputserver.h.

float nInputServer::GetMouseFactor  )  const [inline]
 

get mouse sensitivity

Definition at line 226 of file ninputserver.h.

void nInputServer::SetMouseInvert bool  b  )  [inline]
 

set invert mouse flag

Definition at line 236 of file ninputserver.h.

bool nInputServer::GetMouseInvert  )  const [inline]
 

get invert mouse flag

Definition at line 247 of file ninputserver.h.

void nInputServer::ObtainFocus  ) 
 

call when input focus obtained

Definition at line 320 of file ninput_states.cc.

void nInputServer::LoseFocus  ) 
 

call when input focus lost

Definition at line 342 of file ninput_states.cc.

void nInputServer::FlushInput  ) 
 

flush entire input mapping

Flush events, states and mappings.

Definition at line 64 of file ninput_events.cc.

void nInputServer::SetMute bool  b  )  [inline]
 

set mute mode on/off

Set mute mode on/off. When in mute mode, only raw events will be generated, but no input mapping takes place.

Definition at line 185 of file ninputserver.h.

bool nInputServer::GetMute  )  const [inline]
 

get mute mode

Definition at line 195 of file ninputserver.h.

bool nInputServer::MapStrToEvent const char *  str,
nInputEvent ie
[protected]
 

convert an input event string into an input event

Maps a string of the form "devN:channel" to an nInputEvent. The directory structure under /sys/share/input/devs is used to determine if the device exists and the channel is supported. If not, the nInputEvent is invalid and the function returns false.

Definition at line 218 of file ninput_events.cc.

nInputEvent * nInputServer::FirstIdenticalEvent nInputEvent pattern  )  [protected]
 

return pointer to first matching event

Definition at line 162 of file ninput_events.cc.

nInputEvent * nInputServer::NextIdenticalEvent nInputEvent pattern,
nInputEvent cur
[protected]
 

return pointer to next matching event

Definition at line 180 of file ninput_events.cc.

void nInputServer::DoInputMapping  )  [protected]
 

do actual input mapping

Definition at line 264 of file ninput_states.cc.

void nInputServer::BeginScripts  )  [protected]
 

begin adding a script to execute

Definition at line 171 of file ninput_main.cc.

void nInputServer::AddScript const char *  script  )  [protected]
 

add a script to execute

Definition at line 180 of file ninput_main.cc.

void nInputServer::EndScripts  )  [protected]
 

finish adding script

Definition at line 192 of file ninput_main.cc.

bool nInputServer::IsIdenticalEvent nInputEvent event0,
nInputEvent event1
[protected]
 

check if events are identical

Definition at line 109 of file ninput_events.cc.

void nInputServer::LogSingleEvent nInputEvent event  )  [protected]
 

log a single event

Definition at line 53 of file ninput_log.cc.

void nInputServer::LogEvents  )  [protected]
 

log all events

Definition at line 107 of file ninput_log.cc.

nInputState * nInputServer::GetInputState const char *  state  )  [protected]
 

find input state object by name

Definition at line 13 of file ninput_states.cc.

nInputState * nInputServer::AddInputState const char *  state  )  [protected]
 

add a named input state

Definition at line 23 of file ninput_states.cc.

void nInputServer::ExportDefaultKeyboard  )  [protected]
 

export the default keyboard

Definition at line 25 of file ninput_main.cc.

void nInputServer::ExportDefaultMouse  )  [protected]
 

export the default mouse

Definition at line 64 of file ninput_main.cc.

const char * nInputServer::BuildInputMappingName const char *  ieStr,
const char *  isStr,
char *  buf,
int  bufSize
[protected]
 

build an input mapping name

Build input mapping name from input event string and input state string.

Parameters:
ieStr input event string
isStr input state string
buf target char buffer
bufSize byte size of target buffer
Returns:
pointer to buf

Definition at line 72 of file ninput_states.cc.


Member Data Documentation

double nInputServer::timeStamp [protected]
 

Definition at line 141 of file ninputserver.h.

nAutoRef<nScriptServer> nInputServer::ref_ss [protected]
 

Definition at line 143 of file ninputserver.h.

nAutoRef<nConServer> nInputServer::ref_con [protected]
 

Definition at line 144 of file ninputserver.h.

nRef<nRoot> nInputServer::ref_statedir [protected]
 

Definition at line 145 of file ninputserver.h.

nRef<nRoot> nInputServer::ref_inpdir [protected]
 

Definition at line 146 of file ninputserver.h.

nList nInputServer::events [protected]
 

Definition at line 148 of file ninputserver.h.

bool nInputServer::log_events [protected]
 

Definition at line 150 of file ninputserver.h.

bool nInputServer::in_begin_map [protected]
 

Definition at line 151 of file ninputserver.h.

bool nInputServer::mute [protected]
 

Definition at line 152 of file ninputserver.h.

nHashList nInputServer::im_list [protected]
 

Definition at line 154 of file ninputserver.h.

nHashList nInputServer::is_list [protected]
 

Definition at line 155 of file ninputserver.h.

int nInputServer::act_script [protected]
 

Definition at line 157 of file ninputserver.h.

const char* nInputServer::script_array[N_MAXNUM_SCRIPTS] [protected]
 

Definition at line 158 of file ninputserver.h.

double nInputServer::long_pressed_time [protected]
 

Definition at line 160 of file ninputserver.h.

double nInputServer::double_click_time [protected]
 

Definition at line 161 of file ninputserver.h.

float nInputServer::mouseFactor [protected]
 

Definition at line 162 of file ninputserver.h.

bool nInputServer::mouseInvert [protected]
 

Definition at line 163 of file ninputserver.h.

vector2 nInputServer::mousePos [protected]
 

Definition at line 164 of file ninputserver.h.


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

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.