aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhudyakov Alexey <alexey.skladnoy@gmail.com>2009-04-19 15:09:09 +0200
committerKhudyakov Alexey <alexey.skladnoy@gmail.com>2009-04-19 15:09:09 +0200
commit8b6cf6c8f8ee64bbdba2a1c69744352ad2366b4b (patch)
tree5061504a8d06be532dbc3f5259f55bd0095cf63a
parent3d040ddf0bdbf190c071918e3adb7be6db00b4e7 (diff)
downloadXMonadContrib-8b6cf6c8f8ee64bbdba2a1c69744352ad2366b4b.tar.gz
XMonadContrib-8b6cf6c8f8ee64bbdba2a1c69744352ad2366b4b.tar.xz
XMonadContrib-8b6cf6c8f8ee64bbdba2a1c69744352ad2366b4b.zip
Remove USE_UTF8 defines.
They are not needed any more since utf8-string is mandatory dependence. darcs-hash:20090419130909-7ba7e-9b1d2c6e54b67f29c3f52d072a661fe9c83c15c2.gz
-rw-r--r--XMonad/Util/Font.hsc15
-rw-r--r--XMonad/Util/XSelection.hs42
-rw-r--r--xmonad-contrib.cabal1
3 files changed, 1 insertions, 57 deletions
diff --git a/XMonad/Util/Font.hsc b/XMonad/Util/Font.hsc
index 9a3ea81..ea1da07 100644
--- a/XMonad/Util/Font.hsc
+++ b/XMonad/Util/Font.hsc
@@ -43,9 +43,8 @@ import Graphics.X11.Xft
import Graphics.X11.Xrender
#endif
-#if defined XFT || defined USE_UTF8
import Codec.Binary.UTF8.String (encodeString, decodeString)
-#endif
+
-- Hide the Core Font/Xft switching here
data XMonadFont = Core FontStruct
@@ -103,11 +102,7 @@ initXMF s =
return (Xft xftdraw)
else
#endif
-#ifdef USE_UTF8
fmap Utf8 $ initUtf8Font s
-#else
- fmap Core $ initCoreFont s
-#endif
#ifdef XFT
where xftPrefix = "xft:"
#endif
@@ -195,18 +190,10 @@ printStringXMF dpy drw fs@(Xft font) gc fc bc x y s = do
#endif
decodeInput :: String -> String
-#if defined XFT || defined USE_UTF8
decodeInput = decodeString
-#else
-decodeInput = id
-#endif
encodeOutput :: String -> String
-#if defined XFT || defined USE_UTF8
encodeOutput = encodeString
-#else
-encodeOutput = id
-#endif
-- | Short-hand for 'fromIntegral'
fi :: (Integral a, Num b) => a -> b
diff --git a/XMonad/Util/XSelection.hs b/XMonad/Util/XSelection.hs
index 4e702cc..14cfcac 100644
--- a/XMonad/Util/XSelection.hs
+++ b/XMonad/Util/XSelection.hs
@@ -31,49 +31,7 @@ import Data.Maybe (fromMaybe)
import XMonad
import XMonad.Util.Run (safeSpawn, unsafeSpawn)
-#ifdef USE_UTF8
import Codec.Binary.UTF8.String (decode)
-#else
-import Data.Bits (shiftL, (.&.), (.|.))
-import Data.Char (chr)
-import Data.Word (Word8)
-{- | Decode a UTF8 string packed into a list of Word8 values, directly to
- String; does not deal with CChar, hence you will want the counter-intuitive @map fromIntegral@
- UTF-8 decoding for internal use in getSelection.
-
- This code is copied from Eric Mertens's "utf-string" library <http://code.haskell.org/utf8-string/>
- (as of version 0.1),\which is BSD-3 licensed like this module.
- It'd be better to just @import Codec.Binary.UTF8.String (decode)@, but then users of this would need to install it; XMonad has enough
- dependencies already. -}
-decode :: [Word8] -> String
-decode [] = ""
-decode (c:cs)
- | c < 0x80 = chr (fromEnum c) : decode cs
- | c < 0xc0 = replacement_character : decode cs
- | c < 0xe0 = multi_byte 1 0x1f 0x80
- | c < 0xf0 = multi_byte 2 0xf 0x800
- | c < 0xf8 = multi_byte 3 0x7 0x10000
- | c < 0xfc = multi_byte 4 0x3 0x200000
- | c < 0xfe = multi_byte 5 0x1 0x4000000
- | otherwise = replacement_character : decode cs
- where
-
- replacement_character :: Char
- replacement_character = '\xfffd'
-
- multi_byte :: Int -> Word8 -> Int -> [Char]
- multi_byte i mask overlong = aux i cs (fromEnum (c .&. mask))
- where
- aux 0 rs acc
- | overlong <= acc && acc <= 0x10ffff &&
- (acc < 0xd800 || 0xdfff < acc) &&
- (acc < 0xfffe || 0xffff < acc) = chr acc : decode rs
- | otherwise = replacement_character : decode rs
- aux n (r:rs) acc
- | r .&. 0xc0 == 0x80 = aux (n-1) rs
- $ shiftL acc 6 .|. fromEnum (r .&. 0x3f)
- aux _ rs _ = replacement_character : decode rs
-#endif
{- $usage
Add @import XMonad.Util.XSelection@ to the top of Config.hs
diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal
index f961409..76ae5b3 100644
--- a/xmonad-contrib.cabal
+++ b/xmonad-contrib.cabal
@@ -52,7 +52,6 @@ library
build-depends: mtl, unix, X11>=1.4.3, xmonad>=0.8, xmonad<0.9, utf8-string
ghc-options: -Wall
extensions: ForeignFunctionInterface
- cpp-options: -DUSE_UTF8
if flag(testing)
ghc-options: -Werror