picofuse-objc

Instance Methods | Class Methods | List of all members
LinuxInput Class Reference

A Linux input device, such as a keyboard or a touchscreen, as an event source of the application, which sends a message to a target for each key and touch. More...

#import <Devices/Devices.h>

Inheritance diagram for LinuxInput:
Inheritance graph
[legend]
Collaboration diagram for LinuxInput:
Collaboration graph
[legend]

Instance Methods

(BOOL) - setTarget:selector:
 Sets what its input's sent to, or nil for nowhere. More...
 
(void) - setPointerSize:
 Sets the size of the picture a mouse's pointer moves over, turned as it was (see -setPointerSize:rotation:).
 
(NXString *) - path
 Returns the device's path.
 
(void) - setPointerSize:rotation:
 Sets the picture a mouse's pointer moves over, such as its display's: its size, which the pointer's kept within, starting in the middle, and how it's turned, as DRMDisplay takes it, so the pointer moves the way it's seen. More...
 
(void) - setPointerSpeed:
 Sets how far a mouse's pointer moves for each unit the mouse reports, such as 0.5 for half as far, or 0 for 1, which takes effect when it's next attached.
 
(void) - setExclusive:
 Sets whether it has its device's events to itself while it's attached, so nothing else, such as the console or a window system, gets them, which takes effect when it's next attached. More...
 
(BOOL) - isAttached
 Returns YES while it's attached, which is while its device is open.
 
- Instance Methods inherited from NXObject
(void) - dealloc
 Frees the instance. More...
 
(NXZone *) - zone
 Returns the zone in which the instance was allocated. More...
 
(id) - retain
 Increases the retain count of the receiver. More...
 
(void) - release
 Decreases the retain count of the receiver. More...
 
(id) - autorelease
 Releases the receiver later, when the current autorelease pool of the thread is drained. More...
 
(id) - copy
 Returns a copy which can't be changed by anything else, which the caller owns and has to release. More...
 
(uintptr_t) - hash
 Returns a number for the object, which is the same for objects which are equal by isEqual:. More...
 
(NXString *) - description
 Returns a string which describes the instance, for logging. More...
 
- Instance Methods inherited from Object
(id) - init
 Initialize the instance, after allocation. More...
 
(Class) - class
 Returns the class of the instance. More...
 
(Class) - superclass
 Returns the superclass of the instance. More...
 
(BOOL) - isEqual:
 Compares the receiver to another object for equality. More...
 
(BOOL) - isKindOfClass:
 Returns a Boolean value that indicates whether the receiver is an instance of a given class. More...
 
(BOOL) - conformsTo:
 Checks if the receiver's class conforms to a protocol. More...
 
- Instance Methods inherited from <ObjectProtocol>
(BOOL) - respondsToSelector:
 Checks if the receiver responds to a selector. More...
 

Class Methods

(LinuxInput *) + inputWithPath:target:selector:
 Returns an input for a device, which isn't attached, or nil if there's no path, or the selector isn't a method of the target which takes one object. More...
 
- Class Methods inherited from NXObject
(id) + alloc
 Allocates a new instance in the default zone, or if there isn't one, with sys_calloc(). More...
 
(id) + allocWithZone:
 Allocates a new instance in a specific zone. More...
 
(id) + new
 Allocates and initializes a new instance, as [[cls alloc] init] does. More...
 
(NXString *) + description
 Returns the name of the class.
 
- Class Methods inherited from Object
(void) + initialize
 Performs one-time initialization for the class. More...
 
(Class) + class
 Returns the class object. More...
 
(Class) + superclass
 Returns the superclass of the class. More...
 
(const char *) + name
 Returns the name of the class. More...
 
(BOOL) + conformsTo:
 Checks if the class conforms to a protocol. More...
 

Additional Inherited Members

- Protected Attributes inherited from Object
Class isa
 A pointer to the object's class structure. More...
 

Detailed Description

A Linux input device, such as a keyboard or a touchscreen, as an event source of the application, which sends a message to a target for each key and touch.

While it's attached with -[NXApplication attachEventSource:], each key pressed, repeating or released is an NXKeyEvent, and each finger pressed, moved or released is an NXMoveEvent, in a slot of its own, and a mouse is one in slot 0, which hovers when it's moved with its left button up, at the device's own coordinates, which for a Raspberry Pi's DSI touchscreen are its display's pixels, even when the display's turned with DRMDisplay's rotation. The device's read when it's ready, not polled, and the message is sent on any of the run loop's workers, with the event as its argument.

LinuxInput *touch = [LinuxInput inputWithPath:@"/dev/input/event6"
target:self
selector:@selector(input:)];

Reading a device needs root, or membership of the input group. Its event number can change between boots, so a name in /dev/input/by-id/ or /dev/input/by-path/ is steadier. Anywhere but Linux, it can't attach.

NXDeviceManager makes one from its description, such as { "@class": "LinuxInput", "path": "/dev/input/event0", "rotate": 90, "speed": 0.5 }, with "exclusive" true unless it's false, and a mouse's pointer kept within the display.

Definition at line 40 of file LinuxInput.h.

Method Documentation

◆ inputWithPath:target:selector:()

+ (LinuxInput *) inputWithPath: (NXString *)  path
target: (id)  target
selector: (SEL)  selector 

Returns an input for a device, which isn't attached, or nil if there's no path, or the selector isn't a method of the target which takes one object.

Parameters
pathThe device, such as @"/dev/input/event0", which is opened when it's attached, and closed when it's detached.
targetWhat the message is sent to, which is retained.
selectorA method of the target which has an NXInputEvent as its one argument, such as -input:.

◆ setExclusive:()

- (void) setExclusive: (BOOL)  exclusive

Sets whether it has its device's events to itself while it's attached, so nothing else, such as the console or a window system, gets them, which takes effect when it's next attached.

It doesn't attach if something else already has it so.

◆ setPointerSize:rotation:()

- (void) setPointerSize: (NXSize)  size
rotation: (uint16_t)  rotation 

Sets the picture a mouse's pointer moves over, such as its display's: its size, which the pointer's kept within, starting in the middle, and how it's turned, as DRMDisplay takes it, so the pointer moves the way it's seen.

It takes effect when it's next attached. Without it, the pointer starts at the top left, with no right or bottom edge. A touchscreen's points aren't turned by it.

◆ setTarget:selector:()

- (BOOL) setTarget: (id)  target
selector: (SEL)  selector 

Sets what its input's sent to, or nil for nowhere.

Returns
YES, or NO if the selector isn't a method of the target which takes one object.

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