FIX handle garbage in data field of clientmessage events
This commit is contained in:
parent
ae87f6e10b
commit
efdae569d1
|
@ -25,10 +25,17 @@ sendXMsg magic tag = do
|
||||||
flush dpy
|
flush dpy
|
||||||
where
|
where
|
||||||
m = str2digit magic
|
m = str2digit magic
|
||||||
t = str2digit tag
|
t = str2digit $ tag ++ [garbageDelim]
|
||||||
|
|
||||||
|
-- WORKAROUND: setClientMessageEvent seems to put garbage on the end
|
||||||
|
-- of the data field (which is probably some yucky c problem I don't
|
||||||
|
-- understand). Easy solution, put something at the end of the tag to
|
||||||
|
-- separate the tag from the garbage
|
||||||
|
garbageDelim :: Char
|
||||||
|
garbageDelim = '~'
|
||||||
|
|
||||||
splitXMsg :: (Integral a) => [a] -> (String, String)
|
splitXMsg :: (Integral a) => [a] -> (String, String)
|
||||||
splitXMsg s = (magic, filter isAlphaNum tag)
|
splitXMsg s = (magic, filter isAlphaNum . takeWhile (/= garbageDelim) $ tag)
|
||||||
where
|
where
|
||||||
(magic, tag) = splitAt 5 $ map (chr . fromInteger . toInteger) s
|
(magic, tag) = splitAt 5 $ map (chr . fromInteger . toInteger) s
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue