class GPM

Defined in:

gpm.cr

Constant Summary

ENDIAN = IO::ByteFormat::SystemEndian

GPM writes its raw C structs onto the socket, so all multi-byte fields are in the host's native byte order (little-endian on x86/most ARM).

MAGIC = 1198550348_u32
SOCKET = "/dev/gpmctl"
USE_MAGIC = false
VERSION = "1.0.5"

Constructors

Instance Method Summary

Constructor Detail

def self.new(file : String = SOCKET, use_magic : Bool = USE_MAGIC, magic : UInt32 = MAGIC) #

[View source]

Instance Method Detail

def config : Config #

[View source]
def config=(config : Config) #

[View source]
def file : String #

[View source]
def file=(file : String) #

[View source]
def get_event(raw = @socket) #

Reads one event from the socket. Returns nil once the connection is closed (e.g. GPM exits), so callers can use while e = gpm.get_event.

Pulls the whole 28-byte Gpm_Event struct with one read_fully and decodes fields from that stack buffer, instead of a buffered read per field.


[View source]
def magic : UInt32 #

[View source]
def magic=(magic : UInt32) #

[View source]
def send_config(config = @config, socket = @socket) #

[View source]
def socket : UNIXSocket #

[View source]
def socket=(socket : UNIXSocket) #

[View source]
def stop #

[View source]
def use_magic=(use_magic : Bool) #

[View source]
def use_magic? : Bool #

[View source]