ch.claudio.pen
Class InputEventHandler

java.lang.Object
  extended by java.lang.Thread
      extended by ch.claudio.pen.InputEventHandler
All Implemented Interfaces:
java.lang.Runnable

public class InputEventHandler
extends java.lang.Thread

Read data from a linux event input device and translate them to mouse events.

The input device delivers separate events for X and Y changes, but accompanies them with a time stamp. This allows to combine them.

For this to work an extra thread is necessary, as unfortunately Java does not allow to select on FileChannels.

Version:
$Id:$
Author:
Claudio Nieder

Copyright (C) 2007 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
InputEventHandler(java.awt.Component sourceArg)
          Create a new input event handler for a component.
 
Method Summary
static void main(java.lang.String[] args)
          Print license.
 void put(ch.claudio.pen.InputEventHandler.Event e)
          Add a new event to the queue.
 void run()
           
 void setMouseListener(java.awt.event.MouseListener mlArg)
          Set the mouse listener.
 void setMouseMotionListener(java.awt.event.MouseMotionListener mmlArg)
          Set the mouse motion listener.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InputEventHandler

public InputEventHandler(java.awt.Component sourceArg)
Create a new input event handler for a component.

Parameters:
sourceArg -
Method Detail

setMouseListener

public void setMouseListener(java.awt.event.MouseListener mlArg)
Set the mouse listener. Setting a new one daectivates the previous one.

Parameters:
mlArg -

setMouseMotionListener

public void setMouseMotionListener(java.awt.event.MouseMotionListener mmlArg)
Set the mouse motion listener. Setting a new one daectivates the previous one.

Parameters:
mmlArg -

put

public void put(ch.claudio.pen.InputEventHandler.Event e)
Add a new event to the queue.

Parameters:
e - event

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored