Added support for some of the weirder requests by adding unpadded String8.

Properly handle Bool
This commit is contained in:
Vidar Hokstad 2023-08-01 20:16:11 +01:00
parent 94301fde33
commit 80fad9a8f9

View file

@ -37,6 +37,7 @@ module X11
x + "\x00"*(-x.length & 3) x + "\x00"*(-x.length & 3)
end end
def self.unpack(socket, size) def self.unpack(socket, size)
val = socket.read(size) val = socket.read(size)
unused_padding = (4 - (size % 4)) % 4 unused_padding = (4 - (size % 4)) % 4
@ -45,9 +46,33 @@ module X11
end end
end end
class String8Unpadded
def self.pack(x)
x
end
def self.unpack(socket, size)
val = socket.read(size)
end
end
class Bool
def self.pack(x)
x ? "\x01" : "\x00"
end
def self.unpack(str)
str[0] == "0x01"
end
def self.size
1
end
end
KeyCode = Uint8 KeyCode = Uint8
Signifigance = Uint8 Signifigance = Uint8
Bool = Uint8
BitGravity = Uint8 BitGravity = Uint8
WinGravity = Uint8 WinGravity = Uint8
BackingStore = Uint8 BackingStore = Uint8