X11 1.6.0 → 1.6.0.1
raw patch · 13 files changed
+77/−56 lines, 13 filesdep −sybdep ~base
Dependencies removed: syb
Dependency ranges changed: base
Files
- Graphics/X11/Types.hsc +1/−0
- Graphics/X11/Xinerama.hsc +1/−1
- Graphics/X11/Xlib/Display.hs +3/−1
- Graphics/X11/Xlib/Event.hsc +3/−3
- Graphics/X11/Xlib/Extras.hsc +26/−25
- Graphics/X11/Xlib/Font.hsc +6/−4
- Graphics/X11/Xlib/Misc.hsc +6/−4
- Graphics/X11/Xlib/Region.hs +2/−2
- Graphics/X11/Xlib/Types.hsc +2/−2
- Graphics/X11/Xrandr.hsc +6/−6
- X11.cabal +2/−8
- configure +16/−0
- include/HsX11Config.h.in +3/−0
Graphics/X11/Types.hsc view
@@ -1,3 +1,4 @@+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Types
Graphics/X11/Xinerama.hsc view
@@ -113,7 +113,7 @@ then return Nothing else do nscreens <- peek intp screens <- peekArray (fromIntegral nscreens) p- cXFree p+ _ <- cXFree p return (Just screens) foreign import ccall "XineramaQueryExtension"
Graphics/X11/Xlib/Display.hs view
@@ -53,8 +53,10 @@ import Graphics.X11.Types import Graphics.X11.Xlib.Types -import Foreign+import Foreign (throwIfNull, Ptr) import Foreign.C++import System.IO.Unsafe ---------------------------------------------------------------- -- Display
Graphics/X11/Xlib/Event.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xlib.Event@@ -18,7 +18,7 @@ queuedAlready, queuedAfterFlush, queuedAfterReading,- XEvent,+ XEvent(..), XEventPtr, allocaXEvent, get_EventType,@@ -67,7 +67,7 @@ import Foreign.C.Types #if __GLASGOW_HASKELL__-import Data.Generics+import Data.Data #endif #include "HsXlib.h"
Graphics/X11/Xlib/Extras.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts -fno-warn-name-shadowing #-}+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xlib.Extras@@ -18,12 +18,13 @@ import Graphics.X11.Xrandr import Graphics.X11.Xlib import Graphics.X11.Xlib.Types-import Graphics.X11.Xlib.Misc-import Foreign+import Foreign (Storable, Ptr, peek, poke, peekElemOff, pokeElemOff, peekByteOff, pokeByteOff, peekArray, throwIfNull, nullPtr, sizeOf, alignment, alloca, with, throwIf, Word8, Word16, Word64, Int32, plusPtr, castPtr, withArrayLen, setBit, testBit, allocaBytes, FunPtr) import Foreign.C.Types import Foreign.C.String import Control.Monad +import System.IO.Unsafe+ #include "XlibExtras.h" data Event@@ -877,7 +878,7 @@ configureWindow :: Display -> Window -> CULong -> WindowChanges -> IO () configureWindow d w m c = do- with c (xConfigureWindow d w m)+ _ <- with c (xConfigureWindow d w m) return () foreign import ccall unsafe "XlibExtras.h XFree"@@ -892,11 +893,11 @@ alloca $ \parent_return -> alloca $ \children_return -> alloca $ \nchildren_return -> do- xQueryTree d w root_return parent_return children_return nchildren_return+ _ <- xQueryTree d w root_return parent_return children_return nchildren_return p <- peek children_return n <- fmap fromIntegral $ peek nchildren_return ws <- peekArray n p- xFree p+ _ <- xFree p liftM3 (,,) (peek root_return) (peek parent_return) (return ws) -- TODO: this data type is incomplete wrt. the C struct@@ -940,7 +941,7 @@ getWindowAttributes :: Display -> Window -> IO WindowAttributes getWindowAttributes d w = alloca $ \p -> do- xGetWindowAttributes d w p+ _ <- xGetWindowAttributes d w p peek p -- | interface to the X11 library function @XChangeWindowAttributes()@.@@ -980,7 +981,7 @@ getTextProperty :: Display -> Window -> Atom -> IO TextProperty getTextProperty d w a = alloca $ \textp -> do- throwIf (0==) (const "getTextProperty") $ xGetTextProperty d w textp a+ _ <- throwIf (0==) (const "getTextProperty") $ xGetTextProperty d w textp a peek textp foreign import ccall unsafe "XlibExtras.h XwcTextPropertyToTextList"@@ -991,7 +992,7 @@ alloca $ \listp -> alloca $ \countp -> with prop $ \propp -> do- throwIf (success>) (const "wcTextPropertyToTextList") $+ _ <- throwIf (success>) (const "wcTextPropertyToTextList") $ xwcTextPropertyToTextList d propp listp countp count <- peek countp list <- peek listp@@ -1039,7 +1040,7 @@ withCWStringLen text $ \(textp, len) -> alloca $ \inkp -> alloca $ \logicalp -> do- xwcTextExtents fs textp (fromIntegral len) inkp logicalp+ _ <- xwcTextExtents fs textp (fromIntegral len) inkp logicalp (,) `fmap` peek inkp `ap` peek logicalp foreign import ccall unsafe "XlibExtras.h XwcDrawString"@@ -1071,13 +1072,13 @@ fetchName :: Display -> Window -> IO (Maybe String) fetchName d w = alloca $ \p -> do- xFetchName d w p+ _ <- xFetchName d w p cstr <- peek p if cstr == nullPtr then return Nothing else do str <- peekCString cstr- xFree cstr+ _ <- xFree cstr return $ Just str foreign import ccall unsafe "XlibExtras.h XGetTransientForHint"@@ -1125,7 +1126,7 @@ else do sz <- peek count_ptr atom_ptr <- peek atom_ptr_ptr atoms <- peekArray (fromIntegral sz) atom_ptr- xFree atom_ptr+ _ <- xFree atom_ptr return atoms foreign import ccall unsafe "HsXlib.h XGetWMProtocols"@@ -1241,7 +1242,7 @@ #{poke XMappingEvent, request } p $ ev_request ev #{poke XMappingEvent, first_keycode } p $ ev_first_keycode ev #{poke XMappingEvent, count } p $ ev_count ev- xRefreshKeyboardMapping p+ _ <- xRefreshKeyboardMapping p return () refreshKeyboardMapping _ = return () @@ -1286,7 +1287,7 @@ | actual_format /= bits = xFree prop_ptr >> return Nothing | otherwise = do retval <- peekArray nitems (castPtr prop_ptr)- xFree prop_ptr+ _ <- xFree prop_ptr return $ Just retval getWindowProperty8 :: Display -> Atom -> Window -> IO (Maybe [CChar])@@ -1303,19 +1304,19 @@ changeProperty8 :: Display -> Window -> Atom -> Atom -> CInt -> [CChar] -> IO () changeProperty8 dpy w prop typ mode dat = withArrayLen dat $ \ len ptr -> do- xChangeProperty dpy w prop typ 8 mode (castPtr ptr) (fromIntegral len)+ _ <- xChangeProperty dpy w prop typ 8 mode (castPtr ptr) (fromIntegral len) return () changeProperty16 :: Display -> Window -> Atom -> Atom -> CInt -> [CShort] -> IO () changeProperty16 dpy w prop typ mode dat = withArrayLen dat $ \ len ptr -> do- xChangeProperty dpy w prop typ 16 mode (castPtr ptr) (fromIntegral len)+ _ <- xChangeProperty dpy w prop typ 16 mode (castPtr ptr) (fromIntegral len) return () changeProperty32 :: Display -> Window -> Atom -> Atom -> CInt -> [CLong] -> IO () changeProperty32 dpy w prop typ mode dat = withArrayLen dat $ \ len ptr -> do- xChangeProperty dpy w prop typ 32 mode (castPtr ptr) (fromIntegral len)+ _ <- xChangeProperty dpy w prop typ 32 mode (castPtr ptr) (fromIntegral len) return () propModeReplace, propModePrepend, propModeAppend :: CInt@@ -1433,8 +1434,8 @@ res_name_p <- #{peek XClassHint, res_name} p res_class_p <- #{peek XClassHint, res_class} p res <- liftM2 ClassHint (peekCString res_name_p) (peekCString res_class_p)- xFree res_name_p- xFree res_class_p+ _ <- xFree res_name_p+ _ <- xFree res_class_p return res else return $ ClassHint "" "" @@ -1516,7 +1517,7 @@ p <- xGetWMHints dpy w if p == nullPtr then return $ WMHints 0 False 0 0 0 0 0 0 0- else do x <- peek p; xFree p; return x+ else do x <- peek p; _ <- xFree p; return x foreign import ccall unsafe "XlibExtras.h XAllocWMHints" xAllocWMHints :: IO (Ptr WMHints)@@ -1529,7 +1530,7 @@ p_wmh <- xAllocWMHints poke p_wmh wmh res <- xSetWMHints dpy w p_wmh- xFree p_wmh+ _ <- xFree p_wmh return res ------------------------------------------------------------------------@@ -1595,7 +1596,7 @@ setErrorHandler :: XErrorHandler -> IO () setErrorHandler new_handler = do _handler <- mkXErrorHandler (\d -> \e -> new_handler d e >> return 0)- _xSetErrorHandler _handler+ _ <- _xSetErrorHandler _handler return () -- |Retrieves error event data from a pointer to an XErrorEvent and@@ -1633,7 +1634,7 @@ alloca $ \argcp -> do- throwIf (success >) (\status -> "xGetCommand returned status: " ++ show status) $ xGetCommand d w argvp argcp+ _ <- throwIf (success >) (\status -> "xGetCommand returned status: " ++ show status) $ xGetCommand d w argvp argcp argc <- peek argcp argv <- peek argvp texts <- flip mapM [0 .. fromIntegral $ pred argc] $ \i -> peekElemOff argv i >>= peekCWString@@ -1653,7 +1654,7 @@ let m = fromIntegral m' pks <- #{peek XModifierKeymap, modifiermap} p :: IO (Ptr KeyCode) ks <- peekArray (m * 8) pks- xFreeModifiermap p+ _ <- xFreeModifiermap p return . zip masks . map fst . tail . iterate (splitAt m . snd) $ ([], ks) where masks = [shiftMapIndex .. mod5MapIndex]
Graphics/X11/Xlib/Font.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xlib.Font@@ -35,11 +35,13 @@ import Graphics.X11.Types import Graphics.X11.Xlib.Types -import Foreign+import Foreign (Ptr, Int32, alloca, allocaBytes, peekByteOff, Word16, Word64, peek, throwIfNull) import Foreign.C +import System.IO.Unsafe+ #if __GLASGOW_HASKELL__-import Data.Generics+import Data.Data #endif ----------------------------------------------------------------@@ -164,7 +166,7 @@ alloca $ \ font_ascent_return -> alloca $ \ font_descent_return -> allocaBytes #{size XCharStruct} $ \ overall_return -> do- xTextExtents font_struct c_string (fromIntegral nchars) direction_return+ _ <- xTextExtents font_struct c_string (fromIntegral nchars) direction_return font_ascent_return font_descent_return overall_return direction <- peek direction_return ascent <- peek font_ascent_return
Graphics/X11/Xlib/Misc.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xlib.Misc@@ -167,11 +167,13 @@ import Graphics.X11.Xlib.Event import Graphics.X11.Xlib.Font -import Foreign+import Foreign (Storable, Ptr, alloca, peek, throwIfNull, with, withArrayLen, allocaBytes, pokeByteOff, withArray, FunPtr, nullPtr, Word32) import Foreign.C +import System.IO.Unsafe+ #if __GLASGOW_HASKELL__-import Data.Generics+import Data.Data #endif #include "HsXlib.h"@@ -461,7 +463,7 @@ -- textual representation of the error. setDefaultErrorHandler :: IO () setDefaultErrorHandler = do- xSetErrorHandler defaultErrorHandler+ _ <- xSetErrorHandler defaultErrorHandler return () -- %fun XSetIOErrorHandler :: IOErrorHandler -> IO IOErrorHandler
Graphics/X11/Xlib/Region.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -cpp -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xlib.Region@@ -51,7 +51,7 @@ import Foreign.Marshal.Utils #if __GLASGOW_HASKELL__-import Data.Generics+import Data.Data #endif ----------------------------------------------------------------
Graphics/X11/Xlib/Types.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xlib.Types@@ -29,7 +29,7 @@ import Foreign.Storable( Storable(..) ) #if __GLASGOW_HASKELL__-import Data.Generics+import Data.Data #endif #include "HsXlib.h"
Graphics/X11/Xrandr.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-} -------------------------------------------------------------------- -- | -- Module : Graphics.X11.Xrandr@@ -51,7 +51,7 @@ import Graphics.X11.Types #if __GLASGOW_HASKELL__-import Data.Generics+import Data.Data #endif -- | Representation of the XRRScreenSize struct@@ -158,7 +158,7 @@ sizes <- if nsizes == 0 then return Nothing else peekArray (fromIntegral nsizes) p >>= return . Just- cXFree p+ _ <- cXFree p return sizes foreign import ccall "XRRConfigSizes" cXRRConfigSizes :: XRRScreenConfiguration -> Ptr CInt -> IO (Ptr XRRScreenSize)@@ -173,7 +173,7 @@ rates <- if nrates == 0 then return Nothing else peekArray (fromIntegral nrates) p >>= return . Just- cXFree p+ _ <- cXFree p return rates foreign import ccall "XRRConfigRates" cXRRConfigRates :: XRRScreenConfiguration -> CInt -> Ptr CInt -> IO (Ptr CShort)@@ -226,7 +226,7 @@ sizes <- if nsizes == 0 then return Nothing else peekArray (fromIntegral nsizes) p >>= return . Just- cXFree p+ _ <- cXFree p return sizes foreign import ccall "XRRSizes" cXRRSizes :: Display -> CInt -> Ptr CInt -> IO (Ptr XRRScreenSize)@@ -241,7 +241,7 @@ rates <- if nrates == 0 then return Nothing else peekArray (fromIntegral nrates) p >>= return . Just- cXFree p+ _ <- cXFree p return rates foreign import ccall "XRRRates" cXRRRates :: Display -> CInt -> CInt -> Ptr CInt -> IO (Ptr CShort)
X11.cabal view
@@ -1,5 +1,5 @@ name: X11-version: 1.6.0+version: 1.6.0.1 license: BSD3 license-file: LICENSE copyright: Alastair Reid, 1999-2003, libraries@haskell.org 2003-2007, Don Stewart 2007-2009, Spencer Janssen 2007-2009, Daniel Wagner 2009-2011.@@ -23,9 +23,6 @@ Cabal-Version: >= 1.2 build-type: Configure -flag smaller_base- description: Build with the even smaller base.- library exposed-modules: Graphics.X11,@@ -63,9 +60,6 @@ include-dirs: include includes: HsXlib.h, HsAllKeysyms.h install-includes: HsXlib.h, XlibExtras.h, HsAllKeysyms.h- if flag(smaller_base)- build-depends: base >= 4 && < 5, syb- else- build-depends: base >= 3 && < 4+ build-depends: base >= 3 && < 5 ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-binds ghc-prof-options: -prof -auto-all
configure view
@@ -4082,6 +4082,22 @@ echo "WARNING: Building without Xinerama support per user request" fi +for ac_header in X11/extensions/Xrandr.h+do :+ ac_fn_c_check_header_mongrel "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "$ac_includes_default"+if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_X11_EXTENSIONS_XRANDR_H 1+_ACEOF+ have_xrandr=yes+fi++done++if ! test "$have_xrandr" = yes; then+ as_fn_error $? "X11/extensions/Xrandr.h (from libXrandr) is required" "$LINENO" 5+fi+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include X.org keysyms" >&5 $as_echo_n "checking whether to include X.org keysyms... " >&6; }
include/HsX11Config.h.in view
@@ -39,6 +39,9 @@ /* Define to 1 if you have the <X11/extensions/Xinerama.h> header file. */ #undef HAVE_X11_EXTENSIONS_XINERAMA_H +/* Define to 1 if you have the <X11/extensions/Xrandr.h> header file. */+#undef HAVE_X11_EXTENSIONS_XRANDR_H+ /* Define to 1 if you have the <X11/HPkeysym.h> header file. */ #undef HAVE_X11_HPKEYSYM_H