diff options
author | gwern0 <gwern0@gmail.com> | 2007-10-10 04:06:16 +0200 |
---|---|---|
committer | gwern0 <gwern0@gmail.com> | 2007-10-10 04:06:16 +0200 |
commit | cea13d71e7ceb1742d60ceec512d33fa2ffa7635 (patch) | |
tree | d8ab29a8bfa43987b57a39132612b5e2b6d96fa4 | |
parent | 64a60e9f5577a7d42806fb166f4b2c11c60766bc (diff) | |
download | XMonadContrib-cea13d71e7ceb1742d60ceec512d33fa2ffa7635.tar.gz XMonadContrib-cea13d71e7ceb1742d60ceec512d33fa2ffa7635.tar.xz XMonadContrib-cea13d71e7ceb1742d60ceec512d33fa2ffa7635.zip |
XSelection.hs: Implement Andrea's idea for handling non-UTF-8 string cases
darcs-hash:20071010020616-f7719-c516e74e6e7d37e73b2926a7cea30b97d65128f6.gz
Diffstat (limited to '')
-rw-r--r-- | XSelection.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/XSelection.hs b/XSelection.hs index dfd235c..5c93b14 100644 --- a/XSelection.hs +++ b/XSelection.hs @@ -41,6 +41,7 @@ import Graphics.X11.Xlib.Extras (currentTime, ev_event_type, getEvent, getWindow import Data.Maybe (fromMaybe) import Control.Concurrent (forkIO) import Data.Char (chr, ord) +import Control.Exception as E (catch) -- promptSelection's imports: import XMonad (io, spawn, X ()) @@ -57,13 +58,11 @@ getSelection = do rootw <- rootWindow dpy dflt win <- createSimpleWindow dpy rootw 0 0 200 100 0 0 0 p <- internAtom dpy "PRIMARY" True - ty <- internAtom dpy "UTF8_STRING" False --- import Control.Exception as E (catch) -{- ty <- E.catch + ty <- E.catch (E.catch - (internAtom dpy "sTring" False) + (internAtom dpy "UTF8_STRING" False) (\_ -> internAtom dpy "COMPOUND_TEXT" False)) - (\_ -> internAtom dpy "UTF8_STRING" False) -} + (\_ -> internAtom dpy "sTring" False) clp <- internAtom dpy "BLITZ_SEL_STRING" False xConvertSelection dpy p ty clp win currentTime allocaXEvent $ \e -> do |