This commit is contained in:
Vidar Hokstad 2023-12-28 17:17:22 +00:00
parent cfff274350
commit 1e241f35c9

View file

@ -58,7 +58,7 @@ module X11
class String16 class String16
def self.pack(x) def self.pack(x)
x.encode("UTF-16BE").force_encoding("ASCII-8BIT") + "\x00\x00"*(-x.length & 1) x.encode("UTF-16BE").b + "\x00\x00"*(-x.length & 1)
end end
def self.unpack(socket, size) def self.unpack(socket, size)
@ -71,28 +71,14 @@ module X11
class String8Unpadded class String8Unpadded
def self.pack(x) def self.pack(x) = x
x def self.unpack(socket, size) = socket.read(size)
end
def self.unpack(socket, size)
val = socket.read(size)
end
end end
class Bool class Bool
def self.pack(x) def self.pack(x) = (x ? "\x01" : "\x00")
x ? "\x01" : "\x00" def self.unpack(str) = (str[0] == "\x01")
end def self.size = 1
def self.unpack(str)
str[0] == "\x01"
end
def self.size
1
end
end end
KeyCode = Uint8 KeyCode = Uint8