Top Description Inners Fields Constructors Methods
com.sun.glass.ui.monocle

pack-priv Class LinuxInputDevice

extends Object
implements Runnable, InputDevice
Class Inheritance
All Implemented Interfaces
com.sun.glass.ui.monocle.InputDevice, java.lang.Runnable
Imports
com.sun.glass.ui.Application, java.io.File, .IOException, java.nio.ByteBuffer, java.nio.channels.ReadableByteChannel, java.util.BitSet, .Map

A LinuxInputDevice listens for events on a Linux input device node, typically one of the files in /dev/input. When events are waiting to be processed on the device it notifies its listener on a thread provided by its runnable processor object.

Event lines are accumulated in a buffer until an event "EV_SYN EV_SYN_REPORT 0" is received. At this point the listener is notified. The listener can then use the methods getEventType(), getEventCode() and getEventValue() to obtain the details of the current event line to process. nextEvent() and hasNextEvent() are used to iterate over pending events.

To save on RAM and GC, event lines are not objects.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
LinuxInputDevice.EventProcessor

The EventProcessor is used to notify listeners of pending events.

Field Summary

Modifier and TypeField and Description
private Map<Integer, LinuxAbsoluteInputCapabilities>
private final LinuxEventBuffer
private Map<String, BitSet>
private File
private final ByteBuffer
private long
private ReadableByteChannel
private LinuxInputProcessor
private LinuxInputDevice.EventProcessor
private RunnableProcessor
private File
private static LinuxSystem
private Map<String, String>
private Map<String, String>

Constructor Summary

AccessConstructor and Description
pack-priv
LinuxInputDevice(File
The node on which to listen for input
devNode
,
File
The sysfs path describing the device
sysPath
,
Map<String, String> udevManifest)

Create a new com.sun.glass.ui.monocle.input.LinuxInputDevice on the given input node.

pack-priv
LinuxInputDevice(Map<String, BitSet>
Simulated capabilities
capabilities
,
Map<Integer, LinuxAbsoluteInputCapabilities>
Simulated absolute axis capabilities
absCaps
,
ReadableByteChannel
Channel f or simulated input events
in
,
Map<String, String> udevManifest, Map<String, String>
Simulated uevent data
uevent
)

Create a new simulated LinuxInputDevice

Method Summary

Modifier and TypeMethod and Description
pack-priv LinuxAbsoluteInputCapabilities
pack-priv LinuxEventBuffer
pack-priv BitSet
pack-priv String
public boolean
public boolean
public boolean
pack-priv boolean
isQuiet()

Asks whether the device is quiet.

public boolean
public boolean
private boolean
private void
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

pack-priv void
public String

Returns:

a string describing this input device
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

absCapsback to summary
private Map<Integer, LinuxAbsoluteInputCapabilities> absCaps
bufferback to summary
private final LinuxEventBuffer buffer
capabilitiesback to summary
private Map<String, BitSet> capabilities
devNodeback to summary
private File devNode
eventback to summary
private final ByteBuffer event
fdback to summary
private long fd
inback to summary
private ReadableByteChannel in
inputProcessorback to summary
private LinuxInputProcessor inputProcessor
processorback to summary
private LinuxInputDevice.EventProcessor processor
runnableProcessorback to summary
private RunnableProcessor runnableProcessor
sysPathback to summary
private File sysPath
systemback to summary
private static LinuxSystem system
udevManifestback to summary
private Map<String, String> udevManifest
ueventback to summary
private Map<String, String> uevent

Constructor Detail

LinuxInputDeviceback to summary
pack-priv LinuxInputDevice(File devNode, File sysPath, Map<String, String> udevManifest) throws IOException

Create a new com.sun.glass.ui.monocle.input.LinuxInputDevice on the given input node.

Parameters
devNode:File

The node on which to listen for input

sysPath:File

The sysfs path describing the device

LinuxInputDeviceback to summary
pack-priv LinuxInputDevice(Map<String, BitSet> capabilities, Map<Integer, LinuxAbsoluteInputCapabilities> absCaps, ReadableByteChannel in, Map<String, String> udevManifest, Map<String, String> uevent)

Create a new simulated LinuxInputDevice

Parameters
capabilities:Map<String, BitSet>

Simulated capabilities

absCaps:Map<Integer, LinuxAbsoluteInputCapabilities>

Simulated absolute axis capabilities

in:ReadableByteChannel

Channel f or simulated input events

uevent:Map<String, String>

Simulated uevent data

Method Detail

getAbsoluteInputCapabilitiesback to summary
pack-priv LinuxAbsoluteInputCapabilities getAbsoluteInputCapabilities(int axis)
getBufferback to summary
pack-priv LinuxEventBuffer getBuffer()
getCapabilityback to summary
pack-priv BitSet getCapability(String type)
getProductback to summary
pack-priv String getProduct()
is5Wayback to summary
public boolean is5Way()

Implements com.sun.glass.ui.monocle.InputDevice.is5Way.

Returns:boolean

Doc from com.sun.glass.ui.monocle.InputDevice.is5Way.

true if the device provides direction arrow keys (UP, DOWN, LEFT and RIGHT) and a selection key.

Annotations
@Override
isFullKeyboardback to summary
public boolean isFullKeyboard()

Implements com.sun.glass.ui.monocle.InputDevice.isFullKeyboard.

Returns:boolean

Doc from com.sun.glass.ui.monocle.InputDevice.isFullKeyboard.

true if the device provides keys for the letters 'A' through 'Z', the digits '0' through '9' and also SPACE, SHIFT and TAB keys in addition to directional arrows and a selection key.

Annotations
@Override
isMultiTouchback to summary
public boolean isMultiTouch()

Implements com.sun.glass.ui.monocle.InputDevice.isMultiTouch.

Returns:boolean

Doc from com.sun.glass.ui.monocle.InputDevice.isMultiTouch.

true if the device provides touch input for more than one touch point.

Annotations
@Override
isQuietback to summary
pack-priv boolean isQuiet()

Asks whether the device is quiet. "Quiet" means that the event reader is blocked waiting for events, the buffer is empty and the event processor is not scheduled. Called on the application thread.

isRelativeback to summary
public boolean isRelative()

Implements com.sun.glass.ui.monocle.InputDevice.isRelative.

Returns:boolean

Doc from com.sun.glass.ui.monocle.InputDevice.isRelative.

true if the device provides relative pointing events. Relative pointing events are those received from devices where the event signifies a relative change in cursor position on the screen. For example, a mouse, trackball, trackpad or joystick is a relative pointing device. A touch screen is an sbsolute pointing device.

Annotations
@Override
isTouchback to summary
public boolean isTouch()

Implements com.sun.glass.ui.monocle.InputDevice.isTouch.

Returns:boolean

Doc from com.sun.glass.ui.monocle.InputDevice.isTouch.

true if the device provides touch input for at least one touch point.

Annotations
@Override
isTouchDeclaredAsMouseback to summary
private boolean isTouchDeclaredAsMouse()
readToEventBufferback to summary
private void readToEventBuffer() throws IOException
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
setInputProcessorback to summary
pack-priv void setInputProcessor(LinuxInputProcessor inputProcessor)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string describing this input device

Annotations
@Override
com.sun.glass.ui.monocle back to summary

pack-priv Class LinuxInputDevice.EventProcessor

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

The EventProcessor is used to notify listeners of pending events. It runs on the application thread.

Field Summary

Modifier and TypeField and Description
pack-priv boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

scheduledback to summary
pack-priv boolean scheduled

Constructor Detail

EventProcessorback to summary
pack-priv EventProcessor()

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override