Source

libgxim / utils / xev2pos.rb

Full commit
a = [
		"\0",
		"KeyPress\0",
		"KeyRelease\0",
		"ButtonPress\0",
		"ButtonRelease\0",
		"MotionNotify\0",
		"EnterNotify\0",
		"LeaveNotify\0",
		"FocusIn\0",
		"FocusOut\0",
		"KeymapNotify\0",
		"Expose\0",
		"GraphicsExpose\0",
		"NoExpose\0",
		"VisibilityNotify\0",
		"CreateNotify\0",
		"DestroyNotify\0",
		"UnmapNotify\0",
		"MapNotify\0",
		"ReparentNotify\0",
		"ConfigureNotify\0",
		"ConfigureRequest\0",
		"GravityNotify\0",
		"ResizeRequest\0",
		"CirculateNotify\0",
		"CirculateRequest\0",
		"PropertyNotify\0",
		"SelectionClear\0",
		"SelectionRequest\0",
		"SelectionNotify\0",
		"ColormapNotify\0",
		"ClientMessage\0",
		"MappingNotify\0"
]
c = 0
r = []
re = []
r << c
a.each do |i|
  c += i.length
  re << c
  r << c
end
p r
p re
l = a.join
re << l.length
(0..(r.length-1)).each do |i|
  p l.slice(r[i], re[i] - r[i])
end