packages feed

X11 1.8 → 1.10.3

raw patch · 23 files changed

Files

+ CHANGES.md view
@@ -0,0 +1,46 @@+# Change Log / Release Notes++## 1.10.3 (2022-09-14)++  * Added `cWX`, `cWY`, `cWWidth`, `cWHeight` constants (`AttributeMask`) (#82)++  * Added `FocusChangeEvent` to `data Event` (#81)++  * Added `setWMNormalHints` (#83)++## 1.10.2 (2021-10-24)++  * Restored compatibility with GHC 7.10 (and possibly even older) (#80)++## 1.10.1 (2021-08-15)++  * Fixed possible high CPU usage of some blocking calls with the threaded RTS (#78)++## 1.10 (2021-05-31)++  * Added `setClientMessageEvent'` (#71)++  * Fixed type of `xrrUpdateConfiguration` (#72)++  * Fixed bottom when deserializing XRRNotifyEvent in `getEvent` (#72)++  * Added `xrrGetMonitors` and `XRRMonitorInfo` (#42)++  * Added `setClassHint` (#76)++  * Added a few missing event mask fields to `WindowAttributes` (#77)++## 1.9.2 (2020-08-25)++  * Make sure that X11 search paths determined by autoconf are actually passed+    through to Cabal. The fix was contributed by Greg Steuck (#53, #69).++  * Locate the include statement for `HsAllKeysyms.h` above the relevant ifdefs+    to avoid issues during cross compilation. The fix was contributed by+    Vanessa McHale (#65)++## 1.8 (February 9, 2017)++  * Added `deleteProperty`++  * Add SelectionClear event to xlib Extra
Graphics/X11.hs view
@@ -3,7 +3,7 @@ -- Module      :  Graphics.X11 -- Copyright   :  (c) Alastair Reid, 1999-2003 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  provisional -- Portability :  portable@@ -12,11 +12,11 @@ -- ----------------------------------------------------------------------------- -module Graphics.X11 +module Graphics.X11         ( module Graphics.X11.Xlib         ) where -import Graphics.X11.Xlib +import Graphics.X11.Xlib  ---------------------------------------------------------------- -- End
Graphics/X11/ExtraTypes.hs view
@@ -3,7 +3,7 @@ -- Module      :  Graphics.X11.ExtraTypes -- Copyright   :  (c) Alastair Reid, 1999-2003 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  unstable -- Portability :  unportable@@ -13,24 +13,24 @@ -----------------------------------------------------------------------------  module Graphics.X11.ExtraTypes-	(-	  -- * Types-	  module Graphics.X11.ExtraTypes.AP,-	  module Graphics.X11.ExtraTypes.DEC,-	  module Graphics.X11.ExtraTypes.HP,-	  module Graphics.X11.ExtraTypes.Sun,-	  module Graphics.X11.ExtraTypes.XF86,-	  module Graphics.X11.ExtraTypes.XorgDefault,-          -	) where+        (+          -- * Types+          module Graphics.X11.ExtraTypes.AP,+          module Graphics.X11.ExtraTypes.DEC,+          module Graphics.X11.ExtraTypes.HP,+          module Graphics.X11.ExtraTypes.Sun,+          module Graphics.X11.ExtraTypes.XF86,+          module Graphics.X11.ExtraTypes.XorgDefault, +        ) where+ import Graphics.X11.ExtraTypes.AP import Graphics.X11.ExtraTypes.DEC import Graphics.X11.ExtraTypes.HP import Graphics.X11.ExtraTypes.Sun import Graphics.X11.ExtraTypes.XF86 import Graphics.X11.ExtraTypes.XorgDefault-          + ---------------------------------------------------------------- -- End ----------------------------------------------------------------
Graphics/X11/ExtraTypes/HP.hsc view
@@ -1,5 +1,5 @@ -------------------------------------------------------------------------------- +-- -- Module      :  Graphics.X11.ExtraTypes.HP -- Copyright   :  (c) Open Group 1987,1998, DEC 1987 -- License     :  X11 (see below) due to X headers
Graphics/X11/ExtraTypes/XF86.hsc view
@@ -19,6 +19,7 @@ -- Presumably XFree86/X.org has copyright on the header but it's not -- explicit in the file. +#include "HsAllKeysyms.h"  module Graphics.X11.ExtraTypes.XF86         (@@ -708,7 +709,7 @@ #else          -- Skipping XF86XK_UWB because your X doesn't define it #endif-#ifdef XF86XK_AudioForward,+#ifdef XF86XK_AudioForward          xF86XK_AudioForward,        --  Fast-forward audio track #else          -- Skipping XF86XK_AudioForward because your X doesn't define it@@ -911,8 +912,6 @@         ) where  import Graphics.X11.Types--#include "HsAllKeysyms.h"  #ifdef XF86XK_ModeLock xF86XK_ModeLock             :: KeySym
Graphics/X11/Types.hsc view
@@ -58,7 +58,7 @@         xK_Delete,         xK_Multi_key, -	-- SunOS does not define these.+        -- SunOS does not define these. #ifdef XK_Codeinput         xK_Codeinput, #endif@@ -435,10 +435,8 @@         rrCrtcChangeNotifyMask,         rrOutputChangeNotifyMask,         rrOutputPropertyNotifyMask,-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H         screenSaverCycleMask,         screenSaverNotifyMask,-#endif          -- ** Event types         EventType,@@ -481,9 +479,7 @@         rrNotifyOutputChange,         rrNotifyOutputProperty,         lASTEvent,-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H         screenSaverNotify,-#endif          -- ** Modifiers         Modifier,@@ -651,6 +647,10 @@         cWDontPropagate,         cWColormap,         cWCursor,+        cWX,+        cWY,+        cWWidth,+        cWHeight,          -- ** Close down modes         CloseDownMode,@@ -1296,10 +1296,8 @@  , rrCrtcChangeNotifyMask       = RRCrtcChangeNotifyMask  , rrOutputChangeNotifyMask     = RROutputChangeNotifyMask  , rrOutputPropertyNotifyMask   = RROutputPropertyNotifyMask-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H  , screenSaverCycleMask         = ScreenSaverCycleMask  , screenSaverNotifyMask        = ScreenSaverNotifyMask-#endif  }  type EventType          = Word32@@ -1343,9 +1341,7 @@  , rrNotifyOutputChange = RRNotify_OutputChange  , rrNotifyOutputProperty=RRNotify_OutputProperty  , lASTEvent            = LASTEvent-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H  , screenSaverNotify    = ScreenSaverNotify-#endif  }  type Modifier           = CUInt@@ -1544,6 +1540,10 @@  , cWDontPropagate      = CWDontPropagate  , cWColormap           = CWColormap  , cWCursor             = CWCursor+ , cWX                  = CWX+ , cWY                  = CWY+ , cWWidth              = CWWidth+ , cWHeight             = CWHeight  }  -- Used in ChangeCloseDownMode
Graphics/X11/XScreenSaver.hsc view
@@ -15,10 +15,6 @@ -- Interface to XScreenSaver API -- -#include <HsX11Config.h>--#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H- module Graphics.X11.XScreenSaver (     getXIdleTime,     XScreenSaverState(..),@@ -106,10 +102,12 @@ getXIdleTime dpy =     maybe 0 (fromIntegral . xssi_idle) `fmap` xScreenSaverQueryInfo dpy --- We have XScreenSaver, so the library will actually work+-- | We have XScreenSaver, so the library will actually work compiledWithXScreenSaver :: Bool compiledWithXScreenSaver = True+{-# DEPRECATED compiledWithXScreenSaver "X11 now always compiles with XScreenSaver support" #-} + -- for XFree() (already included from scrnsaver.h, but I don't know if I can -- count on that.) #include <X11/Xlib.h>@@ -425,10 +423,3 @@  foreign import ccall "XScreenSaverSuspend"     cXScreenSaverSuspend :: Display -> Bool -> IO ()--#else-module Graphics.X11.XScreenSaver where--compiledWithXScreenSaver :: Bool-compiledWithXScreenSaver = False-#endif
Graphics/X11/Xinerama.hsc view
@@ -104,10 +104,10 @@         go True major minor = Just (fromIntegral major, fromIntegral minor)  xineramaQueryScreens :: Display -> IO (Maybe [XineramaScreenInfo])-xineramaQueryScreens dpy = +xineramaQueryScreens dpy =   withPool $ \pool -> do intp <- pooledMalloc pool                          p <- cXineramaQueryScreens dpy intp-                         if p == nullPtr +                         if p == nullPtr                             then return Nothing                             else do nscreens <- peek intp                                     screens <- peekArray (fromIntegral nscreens) p
Graphics/X11/Xlib.hs view
@@ -3,7 +3,7 @@ -- Module      :  Graphics.X11.Xlib -- Copyright   :  (c) Alastair Reid, 1999-2003 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  provisional -- Portability :  portable@@ -19,18 +19,18 @@ -- ----------------------------------------------------------------------------- -module Graphics.X11.Xlib -	( -- * Conventions-	  -- $conventions+module Graphics.X11.Xlib+        ( -- * Conventions+          -- $conventions -	  -- * Types-	  module Graphics.X11.Types,+          -- * Types+          module Graphics.X11.Types,           -- module Graphics.X11.Xlib.Types,-	  Display(..), Screen, Visual, GC, SetWindowAttributes, VisualInfo(..),-	  Point(..), Rectangle(..), Arc(..), Segment(..), Color(..),-	  Pixel, Position, Dimension, Angle, ScreenNumber, Buffer,+          Display(..), Screen, Visual, GC, SetWindowAttributes, VisualInfo(..),+          Point(..), Rectangle(..), Arc(..), Segment(..), Color(..),+          Pixel, Position, Dimension, Angle, ScreenNumber, Buffer, -	  -- * X11 library functions+          -- * X11 library functions           module Graphics.X11.Xlib.Event,           module Graphics.X11.Xlib.Display,           module Graphics.X11.Xlib.Screen,@@ -43,8 +43,8 @@           module Graphics.X11.Xlib.Region,           module Graphics.X11.Xlib.Image,           module Graphics.X11.Xlib.Misc,-          -	) where++        ) where  import Graphics.X11.Types import Graphics.X11.Xlib.Types
Graphics/X11/Xlib/Event.hsc view
@@ -494,7 +494,7 @@                 XEventPtr -> IO Status  -- | interface to the X11 library function @XWindowEvent()@.-foreign import ccall unsafe "HsXlib.h XWindowEvent"+foreign import ccall safe "HsXlib.h XWindowEvent"         windowEvent :: Display -> Window -> EventMask -> XEventPtr -> IO ()  -- | interface to the X11 library function @XCheckWindowEvent()@.@@ -503,7 +503,7 @@                 XEventPtr -> IO Bool  -- | interface to the X11 library function @XMaskEvent()@.-foreign import ccall unsafe "HsXlib.h XMaskEvent"+foreign import ccall safe "HsXlib.h XMaskEvent"         maskEvent :: Display -> EventMask -> XEventPtr -> IO ()  -- | interface to the X11 library function @XCheckMaskEvent()@.@@ -524,7 +524,7 @@         putBackEvent :: Display -> XEventPtr -> IO ()  -- | interface to the X11 library function @XPeekEvent()@.-foreign import ccall unsafe "HsXlib.h XPeekEvent"+foreign import ccall safe "HsXlib.h XPeekEvent"         peekEvent :: Display -> XEventPtr -> IO ()  -- XFilterEvent omitted (can't find documentation)
Graphics/X11/Xlib/Extras.hsc view
@@ -19,13 +19,11 @@ import Data.Maybe import Data.Typeable ( Typeable ) import Graphics.X11.Xrandr-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H import Graphics.X11.XScreenSaver-#endif import Graphics.X11.Xlib import Graphics.X11.Xlib.Internal import Graphics.X11.Xlib.Types-import Foreign (Storable, Ptr, peek, poke, peekElemOff, pokeElemOff, peekByteOff, pokeByteOff, peekArray, throwIfNull, nullPtr, sizeOf, alignment, alloca, with, throwIf, Word8, Word16, #{type unsigned long}, Int32, plusPtr, castPtr, withArrayLen, setBit, testBit, allocaBytes, FunPtr)+import Foreign (Storable, Ptr, peek, poke, pokeArray, peekElemOff, peekByteOff, pokeByteOff, peekArray, throwIfNull, nullPtr, sizeOf, alignment, alloca, with, throwIf, Word8, Word16, #{type unsigned long}, Int32, plusPtr, castPtr, withArrayLen, setBit, testBit, allocaBytes, FunPtr) import Foreign.C.Types import Foreign.C.String import Control.Monad@@ -222,6 +220,15 @@         , ev_height                :: !CInt         , ev_count                 :: !CInt         }+    | FocusChangeEvent+        { ev_event_type            :: !EventType+        , ev_serial                :: !CULong+        , ev_send_event            :: !Bool+        , ev_event_display         :: Display+        , ev_window                :: !Window+        , ev_mode                  :: !NotifyMode+        , ev_detail                :: !NotifyDetail+        }     | ClientMessageEvent         { ev_event_type            :: !EventType         , ev_serial                :: !CULong@@ -297,7 +304,6 @@         , ev_timestamp             :: !Time         , ev_rr_state              :: !CInt         }-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H     | ScreenSaverNotifyEvent         { ev_event_type            :: !EventType         , ev_serial                :: !CULong@@ -310,7 +316,6 @@         , ev_forced                :: !Bool         , ev_time                  :: !Time         }-#endif     deriving ( Show, Typeable )  eventTable :: [(EventType, String)]@@ -349,9 +354,7 @@     , (clientMessage        , "ClientMessage")     , (mappingNotify        , "MappingNotify")     , (lASTEvent            , "LASTEvent")-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H     , (screenSaverNotify    , "ScreenSaverNotify")-#endif     ]  eventName :: Event -> String@@ -708,6 +711,23 @@                         }            -------------------------+          -- FocusChangeEvent+          -------------------------+          | type_ == focusIn || type_ == focusOut -> do+            window <- #{peek XFocusChangeEvent, window } p+            mode   <- #{peek XFocusChangeEvent, mode   } p+            detail <- #{peek XFocusChangeEvent, detail } p+            return $ FocusChangeEvent+                        { ev_event_type    = type_+                        , ev_serial        = serial+                        , ev_send_event    = send_event+                        , ev_event_display = display+                        , ev_window        = window+                        , ev_mode          = mode+                        , ev_detail        = detail+                        }++          -------------------------           -- ClientMessageEvent           -------------------------           | type_ == clientMessage -> do@@ -774,7 +794,7 @@             type_ == rrEventBase + rrNotify -> do             window   <- #{peek XRRNotifyEvent, window  } p             subtype  <- #{peek XRRNotifyEvent, subtype } p-            let subtype_ = fromIntegral subtype_+            let subtype_ = fromIntegral subtype             case () of                 _ | subtype_ == rrNotifyCrtcChange -> do                     crtc           <- #{peek XRRCrtcChangeNotifyEvent, crtc     } p@@ -852,7 +872,6 @@                                 , ev_subtype       = subtype                                 } -#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H           -----------------           -- ScreenSaverNotifyEvent:           -----------------@@ -864,7 +883,6 @@                 `ap` (#{peek XScreenSaverNotifyEvent, kind       } p )                 `ap` (#{peek XScreenSaverNotifyEvent, forced     } p )                 `ap` (#{peek XScreenSaverNotifyEvent, time       } p )-#endif            -- We don't handle this event specifically, so return the generic           -- AnyEvent.@@ -952,7 +970,7 @@     alloca $ \parent_return ->     alloca $ \children_return ->     alloca $ \nchildren_return -> do-        _ <- xQueryTree d w root_return parent_return children_return nchildren_return+        _ <- throwIfZero "queryTree" $ 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@@ -965,6 +983,9 @@             , wa_colormap :: Colormap             , wa_map_installed :: Bool             , wa_map_state :: CInt+            , wa_all_event_masks :: EventMask+            , wa_your_event_mask :: EventMask+            , wa_do_not_propagate_mask :: EventMask             , wa_override_redirect :: Bool             } @@ -989,6 +1010,9 @@                 `ap` (#{peek XWindowAttributes, colormap         } p)                 `ap` (#{peek XWindowAttributes, map_installed    } p)                 `ap` (#{peek XWindowAttributes, map_state        } p)+                `ap` (#{peek XWindowAttributes, all_event_masks  } p)+                `ap` (#{peek XWindowAttributes, your_event_mask  } p)+                `ap` (#{peek XWindowAttributes, do_not_propagate_mask } p)                 `ap` (#{peek XWindowAttributes, override_redirect} p)     poke p wa = do         #{poke XWindowAttributes, x                } p $ wa_x wa@@ -999,6 +1023,9 @@         #{poke XWindowAttributes, colormap         } p $ wa_colormap wa         #{poke XWindowAttributes, map_installed    } p $ wa_map_installed wa         #{poke XWindowAttributes, map_state        } p $ wa_map_state wa+        #{poke XWindowAttributes, all_event_masks  } p $ wa_all_event_masks wa+        #{poke XWindowAttributes, your_event_mask  } p $ wa_your_event_mask wa+        #{poke XWindowAttributes, do_not_propagate_mask } p $ wa_do_not_propagate_mask wa         #{poke XWindowAttributes, override_redirect} p $ wa_override_redirect wa  foreign import ccall unsafe "XlibExtras.h XGetWindowAttributes"@@ -1231,14 +1258,22 @@ -- Should have a Storable instance for XEvent/Event? setClientMessageEvent :: XEventPtr -> Window -> Atom -> CInt -> Atom -> Time -> IO () setClientMessageEvent p window message_type format l_0_ l_1_ = do+    setClientMessageEvent' p window message_type format [fromIntegral l_0_, fromIntegral l_1_]++-- slightly less hacky way to set up an XClientMessageEvent+setClientMessageEvent' :: XEventPtr -> Window -> Atom -> CInt -> [CInt] -> IO ()+setClientMessageEvent' p window message_type format dat = do     #{poke XClientMessageEvent, window}         p window     #{poke XClientMessageEvent, message_type}   p message_type     #{poke XClientMessageEvent, format}         p format-    let datap = #{ptr XClientMessageEvent, data} p :: Ptr CLong-    poke        datap   (fromIntegral l_0_) -- does this work?-    pokeElemOff datap 1 (fromIntegral l_1_)--    return ()+    case format of+        8  -> do let datap = #{ptr XClientMessageEvent, data} p :: Ptr Word8+                 pokeArray datap $ take 20 $ map fromIntegral dat ++ repeat 0+        16 -> do let datap = #{ptr XClientMessageEvent, data} p :: Ptr Word16+                 pokeArray datap $ take 10 $ map fromIntegral dat ++ repeat 0+        32 -> do let datap = #{ptr XClientMessageEvent, data} p :: Ptr CLong+                 pokeArray datap $ take 5  $ map fromIntegral dat ++ repeat 0+        _  -> error "X11.Extras.setClientMessageEvent': illegal format"  setConfigureEvent :: XEventPtr -> Window -> Window -> CInt -> CInt -> CInt -> CInt -> CInt -> Window -> Bool -> IO () setConfigureEvent p ev win x y w h bw abv org = do@@ -1493,7 +1528,20 @@             0 -> return (SizeHints Nothing Nothing Nothing Nothing Nothing Nothing)             _ -> peek sh +foreign import ccall "XlibExtras.h XAllocSizeHints"+    xAllocSizeHints :: IO (Ptr SizeHints) +foreign import ccall unsafe "XlibExtras.h XSetWMNormalHints"+    xSetWMNormalHints :: Display -> Window -> Ptr SizeHints -> IO ()++setWMNormalHints :: Display -> Window -> SizeHints -> IO ()+setWMNormalHints dpy win hints = do+    ptr_hints <- throwIfNull "xAllocSizeHints" xAllocSizeHints+    poke ptr_hints hints+    xSetWMNormalHints dpy win ptr_hints+    _ <- xFree ptr_hints+    return ()+ data ClassHint = ClassHint                         { resName  :: String                         , resClass :: String@@ -1514,6 +1562,18 @@  foreign import ccall unsafe "XlibExtras.h XGetClassHint"     xGetClassHint :: Display -> Window -> Ptr ClassHint -> IO Status++-- | Set the @WM_CLASS@ property for the given window.+setClassHint :: Display -> Window -> ClassHint -> IO ()+setClassHint dpy win (ClassHint name cl) =+    allocaBytes (#{size XClassHint}) $ \ptr -> do+        withCString name $ \c_name -> withCString cl $ \c_cl -> do+            #{poke XClassHint, res_name } ptr c_name+            #{poke XClassHint, res_class} ptr c_cl+            xSetClassHint dpy win ptr++foreign import ccall unsafe "XlibExtras.h XSetClassHint"+    xSetClassHint :: Display -> Window -> Ptr ClassHint -> IO ()  ------------------------------------------------------------------------ -- WM Hints
Graphics/X11/Xlib/Font.hsc view
@@ -20,7 +20,7 @@         fontFromGC,         loadQueryFont,         freeFont,-	FontStruct,+        FontStruct,         fontFromFontStruct,         ascentFromFontStruct,         descentFromFontStruct,@@ -55,9 +55,9 @@ -- | pointer to an X11 @XFontStruct@ structure newtype FontStruct = FontStruct (Ptr FontStruct) #if __GLASGOW_HASKELL__-	deriving (Eq, Ord, Show, Typeable, Data)+        deriving (Eq, Ord, Show, Typeable, Data) #else-	deriving (Eq, Ord, Show)+        deriving (Eq, Ord, Show) #endif  -- Disnae exist: %fun LoadFont       :: Display -> String -> IO Font@@ -70,7 +70,7 @@  -- | interface to the X11 library function @XQueryFont()@. foreign import ccall unsafe "HsXlib.h XQueryFont"-	queryFont     :: Display -> Font -> IO FontStruct+        queryFont     :: Display -> Font -> IO FontStruct  -- Note that this _WILL NOT WORK_ unless you have explicitly set the font. -- I'm slowly but surely coming to the conclusion that Xlib is a pile of@@ -79,40 +79,40 @@ -- | interface to the X11 library function @XGetGCValues()@. fontFromGC :: Display -> GC -> IO Font fontFromGC display gc =-	allocaBytes #{size XGCValues} $ \ values -> do-	throwIfZero "fontFromGC" $-		xGetGCValues display gc #{const GCFont} values-	#{peek XGCValues,font} values+        allocaBytes #{size XGCValues} $ \ values -> do+        throwIfZero "fontFromGC" $+                xGetGCValues display gc #{const GCFont} values+        #{peek XGCValues,font} values foreign import ccall unsafe "HsXlib.h XGetGCValues"-	xGetGCValues :: Display -> GC -> ValueMask -> Ptr GCValues -> IO CInt+        xGetGCValues :: Display -> GC -> ValueMask -> Ptr GCValues -> IO CInt  type ValueMask = #{type unsigned long}  -- | interface to the X11 library function @XLoadQueryFont()@. loadQueryFont :: Display -> String -> IO FontStruct loadQueryFont display name =-	withCString name $ \ c_name -> do-	fs <- throwIfNull "loadQueryFont" $ xLoadQueryFont display c_name-	return (FontStruct fs)+        withCString name $ \ c_name -> do+        fs <- throwIfNull "loadQueryFont" $ xLoadQueryFont display c_name+        return (FontStruct fs) foreign import ccall unsafe "HsXlib.h XLoadQueryFont"-	xLoadQueryFont :: Display -> CString -> IO (Ptr FontStruct)+        xLoadQueryFont :: Display -> CString -> IO (Ptr FontStruct)  -- | interface to the X11 library function @XFreeFont()@. foreign import ccall unsafe "HsXlib.h XFreeFont"-	freeFont      :: Display -> FontStruct -> IO ()+        freeFont      :: Display -> FontStruct -> IO () -- %fun XSetFontPath  :: Display -> ListString  -> IO () using XSetFontPath(arg1,arg2,arg2_size)  fontFromFontStruct :: FontStruct -> Font fontFromFontStruct (FontStruct fs) = unsafePerformIO $-	#{peek XFontStruct,fid} fs+        #{peek XFontStruct,fid} fs  ascentFromFontStruct :: FontStruct -> Int32 ascentFromFontStruct (FontStruct fs) = unsafePerformIO $-	#{peek XFontStruct,ascent} fs+        #{peek XFontStruct,ascent} fs  descentFromFontStruct :: FontStruct -> Int32 descentFromFontStruct (FontStruct fs) = unsafePerformIO $-	#{peek XFontStruct,descent} fs+        #{peek XFontStruct,descent} fs  -- %prim XGetFontPath :: Display -> IO ListString --Int r_size;@@ -135,58 +135,58 @@  -- We marshall this across right away because it's usually one-off info type CharStruct =-	( CInt            -- lbearing (origin to left edge of raster)-	, CInt            -- rbearing (origin to right edge of raster)-	, CInt            -- width    (advance to next char's origin)-	, CInt            -- ascent   (baseline to top edge of raster)-	, CInt            -- descent  (baseline to bottom edge of raster)-	-- attributes omitted-	)+        ( CInt            -- lbearing (origin to left edge of raster)+        , CInt            -- rbearing (origin to right edge of raster)+        , CInt            -- width    (advance to next char's origin)+        , CInt            -- ascent   (baseline to top edge of raster)+        , CInt            -- descent  (baseline to bottom edge of raster)+        -- attributes omitted+        )  peekCharStruct :: Ptr CharStruct -> IO CharStruct peekCharStruct p = do-	lbearing <- #{peek XCharStruct,lbearing} p-	rbearing <- #{peek XCharStruct,rbearing} p-	width    <- #{peek XCharStruct,width} p-	ascent   <- #{peek XCharStruct,ascent} p-	descent  <- #{peek XCharStruct,descent} p-	return (fromIntegral (lbearing::CShort),-		fromIntegral (rbearing::CShort),-		fromIntegral (width::CShort),-		fromIntegral (ascent::CShort),-		fromIntegral (descent::CShort))+        lbearing <- #{peek XCharStruct,lbearing} p+        rbearing <- #{peek XCharStruct,rbearing} p+        width    <- #{peek XCharStruct,width} p+        ascent   <- #{peek XCharStruct,ascent} p+        descent  <- #{peek XCharStruct,descent} p+        return (fromIntegral (lbearing::CShort),+                fromIntegral (rbearing::CShort),+                fromIntegral (width::CShort),+                fromIntegral (ascent::CShort),+                fromIntegral (descent::CShort))  -- No need to put this in the IO monad - this info is essentially constant  -- | interface to the X11 library function @XTextExtents()@. textExtents :: FontStruct -> String -> (FontDirection, Int32, Int32, CharStruct) textExtents font_struct string = unsafePerformIO $-	withCStringLen string $ \ (c_string, nchars) ->-	alloca $ \ direction_return ->-	alloca $ \ font_ascent_return ->-	alloca $ \ font_descent_return ->-	allocaBytes #{size XCharStruct} $ \ overall_return -> do-	_ <- 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-	descent <- peek font_descent_return-	cs <- peekCharStruct overall_return-	return (direction, ascent, descent, cs)+        withCStringLen string $ \ (c_string, nchars) ->+        alloca $ \ direction_return ->+        alloca $ \ font_ascent_return ->+        alloca $ \ font_descent_return ->+        allocaBytes #{size XCharStruct} $ \ overall_return -> do+        _ <- 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+        descent <- peek font_descent_return+        cs <- peekCharStruct overall_return+        return (direction, ascent, descent, cs) foreign import ccall unsafe "HsXlib.h XTextExtents"-	xTextExtents :: FontStruct -> CString -> CInt ->-		Ptr FontDirection -> Ptr Int32 -> Ptr Int32 ->-		Ptr CharStruct -> IO CInt+        xTextExtents :: FontStruct -> CString -> CInt ->+                Ptr FontDirection -> Ptr Int32 -> Ptr Int32 ->+                Ptr CharStruct -> IO CInt  -- No need to put ths in the IO monad - this info is essentially constant  -- | interface to the X11 library function @XTextWidth()@. textWidth :: FontStruct -> String -> Int32 textWidth font_struct string = unsafePerformIO $-	withCStringLen string $ \ (c_string, len) ->-	xTextWidth font_struct c_string (fromIntegral len)+        withCStringLen string $ \ (c_string, len) ->+        xTextWidth font_struct c_string (fromIntegral len) foreign import ccall unsafe "HsXlib.h XTextWidth"-	xTextWidth :: FontStruct -> CString -> CInt -> IO Int32+        xTextWidth :: FontStruct -> CString -> CInt -> IO Int32  -- XTextExtents16 omitted -- XTextWidth16 omitted
Graphics/X11/Xlib/Misc.hsc view
@@ -753,7 +753,7 @@ foreign import ccall unsafe "HsXlib.h XLockDisplay"         lockDisplay :: Display -> IO () -foreign import ccall unsafe "HsXlib.h XLockDisplay"+foreign import ccall unsafe "HsXlib.h XUnlockDisplay"         unlockDisplay :: Display -> IO ()  ----------------------------------------------------------------
Graphics/X11/Xlib/Types.hsc view
@@ -35,7 +35,7 @@ import Data.Data #endif -import Data.Default+import Data.Default.Class  #include "HsXlib.h" 
Graphics/X11/Xrandr.hsc view
@@ -24,6 +24,7 @@   XRROutputInfo(..),   XRRCrtcInfo(..),   XRRPropertyInfo(..),+  XRRMonitorInfo(..),   compiledWithXrandr,   Rotation,   Reflection,@@ -59,7 +60,8 @@   xrrConfigureOutputProperty,   xrrChangeOutputProperty,   xrrGetOutputProperty,-  xrrDeleteOutputProperty+  xrrDeleteOutputProperty,+  xrrGetMonitors,   ) where  import Foreign@@ -147,6 +149,20 @@     , xrr_pi_values       :: [CLong]     } deriving (Eq, Show) +-- | Representation of the XRRMonitorInfo struct+data XRRMonitorInfo = XRRMonitorInfo+   { xrr_moninf_name      :: !Atom+   , xrr_moninf_primary   :: !Bool+   , xrr_moninf_automatic :: !Bool+   , xrr_moninf_x         :: !CInt+   , xrr_moninf_y         :: !CInt+   , xrr_moninf_width     :: !CInt+   , xrr_moninf_height    :: !CInt+   , xrr_moninf_mwidth    :: !CInt+   , xrr_moninf_mheight   :: !CInt+   , xrr_moninf_outputs   :: [RROutput]+   } deriving (Eq, Show)+ -- We have Xrandr, so the library will actually work compiledWithXrandr :: Bool compiledWithXrandr = True@@ -215,7 +231,39 @@                               (#{peek XRRModeInfo, name       } p)         `ap` ( #{peek XRRModeInfo, modeFlags  } p ) +instance Storable XRRMonitorInfo where+    sizeOf _ = #{size XRRMonitorInfo}+    -- FIXME: Is this right?+    alignment _ = alignment (undefined :: CInt) +    poke p xrr_moninf = do+        #{poke XRRMonitorInfo, name      } p $ xrr_moninf_name      xrr_moninf+        #{poke XRRMonitorInfo, primary   } p $ xrr_moninf_primary   xrr_moninf+        #{poke XRRMonitorInfo, automatic } p $ xrr_moninf_automatic xrr_moninf+        #{poke XRRMonitorInfo, x         } p $ xrr_moninf_x         xrr_moninf+        #{poke XRRMonitorInfo, y         } p $ xrr_moninf_y         xrr_moninf+        #{poke XRRMonitorInfo, width     } p $ xrr_moninf_width     xrr_moninf+        #{poke XRRMonitorInfo, height    } p $ xrr_moninf_height    xrr_moninf+        #{poke XRRMonitorInfo, mwidth    } p $ xrr_moninf_mwidth    xrr_moninf+        #{poke XRRMonitorInfo, mheight   } p $ xrr_moninf_mheight   xrr_moninf+        -- see comment in Storable XRRScreenResources about dynamic resource allocation+        #{poke XRRMonitorInfo, noutput } p ( 0 :: CInt )+        #{poke XRRMonitorInfo, outputs } p ( nullPtr :: Ptr RROutput )++    peek p = return XRRMonitorInfo+        `ap` ( #{peek XRRMonitorInfo, name      } p )+        `ap` ( #{peek XRRMonitorInfo, primary   } p )+        `ap` ( #{peek XRRMonitorInfo, automatic } p )+        `ap` ( #{peek XRRMonitorInfo, x         } p )+        `ap` ( #{peek XRRMonitorInfo, y         } p )+        `ap` ( #{peek XRRMonitorInfo, width     } p )+        `ap` ( #{peek XRRMonitorInfo, height    } p )+        `ap` ( #{peek XRRMonitorInfo, mwidth    } p )+        `ap` ( #{peek XRRMonitorInfo, mheight   } p )+        `ap` peekCArrayIO (#{peek XRRMonitorInfo, noutput } p)+                          (#{peek XRRMonitorInfo, outputs } p)++ instance Storable XRRScreenResources where     sizeOf _ = #{size XRRScreenResources}     -- FIXME: Is this right?@@ -460,10 +508,10 @@ foreign import ccall "XRRSelectInput"   cXRRSelectInput :: Display -> Window -> CInt -> IO () -xrrUpdateConfiguration :: XEvent -> IO CInt+xrrUpdateConfiguration :: XEventPtr -> IO CInt xrrUpdateConfiguration = cXRRUpdateConfiguration foreign import ccall "XRRUpdateConfiguration"-  cXRRUpdateConfiguration :: XEvent -> IO CInt+  cXRRUpdateConfiguration :: XEventPtr -> IO CInt  xrrRotations :: Display -> CInt -> IO (Rotation, Rotation) xrrRotations dpy screen =@@ -692,6 +740,24 @@ xrrDeleteOutputProperty = cXRRDeleteOutputProperty foreign import ccall "XRRDeleteOutputProperty"     cXRRDeleteOutputProperty :: Display -> RROutput -> Atom -> IO ()++xrrGetMonitors :: Display -> Drawable -> Bool -> IO (Maybe [XRRMonitorInfo])+xrrGetMonitors dpy draw get_active = withPool $ \pool -> do+    intp <- pooledMalloc pool+    p <- cXRRGetMonitors dpy draw get_active intp+    if p == nullPtr+        then return Nothing+        else do+            nmonitors <- peek intp+            res <- fmap Just $ peekCArray nmonitors p+            cXRRFreeMonitors p+            return res++foreign import ccall "XRRGetMonitors"+    cXRRGetMonitors :: Display -> Drawable -> Bool -> Ptr CInt -> IO (Ptr XRRMonitorInfo)++foreign import ccall "XRRFreeMonitors"+    cXRRFreeMonitors :: Ptr XRRMonitorInfo -> IO ()  wrapPtr2 :: (Storable a, Storable b) => (Ptr a -> Ptr b -> IO c) -> (c -> a -> b -> d) -> IO d wrapPtr2 cfun f =
+ README.md view
@@ -0,0 +1,33 @@+# Haskell binding to the X11 graphics library [![Hackage](https://img.shields.io/hackage/v/X11.svg?style=flat)](https://hackage.haskell.org/package/X11) [![Build Status](https://img.shields.io/travis/xmonad/X11.svg?style=flat)](https://travis-ci.org/xmonad/X11)++To build this package using Cabal directly from Git, you must run+`autoreconf` before the usual Cabal build steps (configure/build/install).+`autoreconf` is included in the GNU autoconf tools.  There is no need to run+the `configure` script: the `cabal configure` step will do this for you.++If you are building from a source tarball, you can just use the standard Cabal+installation stanza:++    cabal configure+    cabal build+    cabal install++Xinerama support is enabled by default if Xinerama headers are detected.  To+disable Xinerama support, add the `--without-xinerama` flag to+`configure-option`:++    cabal configure --configure-option="--without-xinerama"++However, if you are building from Git, X11 uses `autoconf`, so you need+to have `autoconf` installed and run `autoconf`/`autoheader` before building:++    autoconf+    autoheader++or++    autoreconf++You will need development versions of at least the X11, xrandr, and XScreenSaver+libraries installed for the build to succeed; having the development version of+the Xinerama library will enable some optional bindings.
Setup.hs view
@@ -1,6 +1,2 @@-module Main (main) where- import Distribution.Simple--main :: IO ()-main = defaultMainWithHooks defaultUserHooks+main = defaultMainWithHooks autoconfUserHooks
X11.buildinfo.in view
@@ -5,3 +5,4 @@ cc-options: @X_CFLAGS@ @CPPFLAGS@ ld-options: @X_LIBS@ @LDFLAGS@ extra-libraries: @EXTRA_LIBRARIES@+extra-lib-dirs: @X_LIBRARIES@
X11.cabal view
@@ -1,75 +1,88 @@ name:               X11-version:            1.8+version:            1.10.3+synopsis:           A binding to the X11 graphics library+description:        A Haskell binding to the X11 graphics library. The binding is a direct+                    translation of the C binding; for documentation of these calls, refer+                    to \"The Xlib Programming Manual\", available online at+                    <http://tronche.com/gui/x/xlib/>. 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.+copyright:          Alastair Reid, 1999-2003, libraries@haskell.org 2003-2007,+                    Don Stewart 2007-2009, Spencer Janssen 2007-2009, Daniel Wagner 2009-2011. maintainer:         Daniel Wagner <daniel@wagner-home.com>+tested-with:        GHC == 7.10.3 || == 8.0.2 || == 8.2.2 || == 8.4.4 || == 8.6.5 || == 8.8.4 || == 8.10.7 || == 9.0.2 || == 9.2.2+category:           Graphics homepage:           https://github.com/xmonad/X11 bug-reports:        https://github.com/xmonad/X11/issues-category:           Graphics-synopsis:           A binding to the X11 graphics library-description:        A Haskell binding to the X11 graphics library.-    The binding is a direct translation of the C binding; for-    documentation of these calls, refer to "The Xlib Programming-    Manual", available online at <http://tronche.com/gui/x/xlib/>.-extra-source-files:-    configure.ac configure-    config.mk.in X11.buildinfo.in include/HsX11Config.h.in-    include/HsXlib.h include/XlibExtras.h include/X11_extras_config.h.in-    include/HsAllKeysyms.h-extra-tmp-files:-    config.log config.status autom4te.cache-    config.mk X11.buildinfo include/HsX11Config.h-    include/X11_extras_config.h-Cabal-Version: >= 1.6 build-type:         Configure-tested-with: GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.1+extra-tmp-files:    config.log+                    config.status+                    autom4te.cache+                    config.mk+                    X11.buildinfo+                    include/HsX11Config.h+                    include/X11_extras_config.h+extra-source-files: CHANGES.md+                    README.md+                    configure.ac+                    configure+                    config.mk.in+                    X11.buildinfo.in+                    include/HsX11Config.h.in+                    include/HsXlib.h+                    include/XlibExtras.h+                    include/X11_extras_config.h.in+                    include/HsAllKeysyms.h+cabal-version:      >= 1.10  source-repository head   type:     git   location: https://github.com/xmonad/X11 +flag pedantic+  description:        Be pedantic (-Werror and the like)+  default:            False+  manual:             True+ library-  exposed-modules:-      Graphics.X11,-      Graphics.X11.Types,-      Graphics.X11.Xlib,-      Graphics.X11.Xlib.Atom,-      Graphics.X11.Xlib.Color,-      Graphics.X11.Xlib.Context,-      Graphics.X11.Xlib.Cursor,-      Graphics.X11.Xlib.Display,-      Graphics.X11.Xlib.Event,-      Graphics.X11.Xlib.Font,-      Graphics.X11.Xlib.Misc,-      Graphics.X11.Xlib.Region,-      Graphics.X11.Xlib.Screen,-      Graphics.X11.Xlib.Types,-      Graphics.X11.Xlib.Window,-      Graphics.X11.Xlib.Image,-      Graphics.X11.Xlib.Extras,-      Graphics.X11.Xinerama-      Graphics.X11.Xrandr-      Graphics.X11.XScreenSaver-      Graphics.X11.ExtraTypes,-      Graphics.X11.ExtraTypes.AP,-      Graphics.X11.ExtraTypes.DEC,-      Graphics.X11.ExtraTypes.HP,-      Graphics.X11.ExtraTypes.Sun-      Graphics.X11.ExtraTypes.XF86,-      Graphics.X11.ExtraTypes.XorgDefault-  other-modules:-      Graphics.X11.Xlib.Internal-  c-sources:-      cbits/fdset.c,-      cbits/auxiliaries.c,-      cbits/XUtils.c-  extensions:         ForeignFunctionInterface, CPP-  extra-libraries:    "X11", "Xrandr", "Xext"-  include-dirs:       include+  exposed-modules:    Graphics.X11+                      Graphics.X11.ExtraTypes+                      Graphics.X11.ExtraTypes.AP+                      Graphics.X11.ExtraTypes.DEC+                      Graphics.X11.ExtraTypes.HP+                      Graphics.X11.ExtraTypes.Sun+                      Graphics.X11.ExtraTypes.XF86+                      Graphics.X11.ExtraTypes.XorgDefault+                      Graphics.X11.Types+                      Graphics.X11.XScreenSaver+                      Graphics.X11.Xinerama+                      Graphics.X11.Xlib+                      Graphics.X11.Xlib.Atom+                      Graphics.X11.Xlib.Color+                      Graphics.X11.Xlib.Context+                      Graphics.X11.Xlib.Cursor+                      Graphics.X11.Xlib.Display+                      Graphics.X11.Xlib.Event+                      Graphics.X11.Xlib.Extras+                      Graphics.X11.Xlib.Font+                      Graphics.X11.Xlib.Image+                      Graphics.X11.Xlib.Misc+                      Graphics.X11.Xlib.Region+                      Graphics.X11.Xlib.Screen+                      Graphics.X11.Xlib.Types+                      Graphics.X11.Xlib.Window+                      Graphics.X11.Xrandr+  other-modules:      Graphics.X11.Xlib.Internal+  build-depends:      base == 4.*, data-default-class == 0.1.*+  default-language:   Haskell98+  default-extensions: CPP+                      ForeignFunctionInterface+  extra-libraries:    X11, Xrandr, Xext+  c-sources:          cbits/fdset.c, cbits/auxiliaries.c, cbits/XUtils.c   includes:           HsXlib.h, HsAllKeysyms.h   install-includes:   HsXlib.h, XlibExtras.h, HsAllKeysyms.h-  build-depends: base >= 4 && < 5, data-default+  include-dirs:       include   ghc-options:        -funbox-strict-fields -Wall -fno-warn-unused-binds-  if impl(ghc >= 7.10)-    ghc-options: -fno-warn-tabs++  if flag(pedantic)+    ghc-options:      -Werror
configure view
@@ -624,6 +624,7 @@  ac_subst_vars='LTLIBOBJS LIBOBJS+X_LIBRARIES EXTRA_LIBRARIES EGREP GREP@@ -661,6 +662,7 @@ docdir oldincludedir includedir+runstatedir localstatedir sharedstatedir sysconfdir@@ -686,7 +688,6 @@ enable_x11 with_x with_xinerama-with_xscreensaver with_xorg_keysym '       ac_precious_vars='build_alias@@ -737,6 +738,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var'+runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'@@ -989,6 +991,15 @@   | -silent | --silent | --silen | --sile | --sil)     silent=yes ;; +  -runstatedir | --runstatedir | --runstatedi | --runstated \+  | --runstate | --runstat | --runsta | --runst | --runs \+  | --run | --ru | --r)+    ac_prev=runstatedir ;;+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \+  | --run=* | --ru=* | --r=*)+    runstatedir=$ac_optarg ;;+   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)     ac_prev=sbindir ;;   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \@@ -1126,7 +1137,7 @@ for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \ 		datadir sysconfdir sharedstatedir localstatedir includedir \ 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \-		libdir localedir mandir+		libdir localedir mandir runstatedir do   eval ac_val=\$$ac_var   # Remove trailing slashes.@@ -1279,6 +1290,7 @@   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]   --libdir=DIR            object code libraries [EPREFIX/lib]   --includedir=DIR        C header files [PREFIX/include]   --oldincludedir=DIR     C header files for non-gcc [/usr/include]@@ -1320,7 +1332,6 @@   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)   --with-x                use the X Window System   --without-xinerama      do not build Xinerama support-  --without-xscreensaver  do not build XScreenSaver support   --without-xorg-keysym   do not build X.org keysym support  Some influential environment variables:@@ -4115,21 +4126,7 @@     as_fn_error $? "X11/extensions/Xrandr.h (from libXrandr) is required" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build XScreenSaver" >&5-$as_echo_n "checking whether to build XScreenSaver... " >&6; }--# Check whether --with-xscreensaver was given.-if test "${with_xscreensaver+set}" = set; then :-  withval=$with_xscreensaver;-else-  with_xscreensaver=yes-fi--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_xscreensaver" >&5-$as_echo "$with_xscreensaver" >&6; }--if test "$with_xscreensaver" = yes; then-    for ac_header in X11/extensions/scrnsaver.h+for ac_header in X11/extensions/scrnsaver.h do :   ac_fn_c_check_header_mongrel "$LINENO" "X11/extensions/scrnsaver.h" "ac_cv_header_X11_extensions_scrnsaver_h" "$ac_includes_default" if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes; then :@@ -4141,14 +4138,10 @@  done -    if test "$have_xscreensaver" = yes; then-        EXTRA_LIBRARIES="Xss $EXTRA_LIBRARIES"-    else-        echo "WARNING: XScreenSaver headers not found. Building without XScreenSaver support"-    fi-else-    echo "WARNING: Building without XScreenSaver support per user request"+if ! test "$have_xscreensaver" = yes; then+    as_fn_error $? "X11/extensions/scrnsaver.h (from libXss) is required" "$LINENO" 5 fi+EXTRA_LIBRARIES="Xss $EXTRA_LIBRARIES"  { $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; }@@ -4295,6 +4288,9 @@   +++X_LIBRARIES="$x_libraries"   ac_config_files="$ac_config_files config.mk X11.buildinfo"
configure.ac view
@@ -9,7 +9,7 @@ # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsXlib.h]) -AC_CONFIG_HEADERS([include/HsX11Config.h include/X11_extras_config.h]) +AC_CONFIG_HEADERS([include/HsX11Config.h include/X11_extras_config.h])  # Check for X11 include paths and libraries AC_PATH_XTRA@@ -76,23 +76,11 @@     AC_MSG_ERROR([X11/extensions/Xrandr.h (from libXrandr) is required]) fi -AC_MSG_CHECKING([whether to build XScreenSaver])-AC_ARG_WITH(xscreensaver,-            AS_HELP_STRING([--without-xscreensaver], [do not build XScreenSaver support]),-            [],-            [with_xscreensaver=yes])-AC_MSG_RESULT([$with_xscreensaver])--if test "$with_xscreensaver" = yes; then-    AC_CHECK_HEADERS([X11/extensions/scrnsaver.h], [have_xscreensaver=yes])-    if test "$have_xscreensaver" = yes; then-        EXTRA_LIBRARIES="Xss $EXTRA_LIBRARIES"-    else-        echo "WARNING: XScreenSaver headers not found. Building without XScreenSaver support"-    fi-else-    echo "WARNING: Building without XScreenSaver support per user request"+AC_CHECK_HEADERS([X11/extensions/scrnsaver.h], [have_xscreensaver=yes])+if ! test "$have_xscreensaver" = yes; then+    AC_MSG_ERROR([X11/extensions/scrnsaver.h (from libXss) is required]) fi+EXTRA_LIBRARIES="Xss $EXTRA_LIBRARIES"  AC_MSG_CHECKING([whether to include X.org keysyms]) AC_ARG_WITH(xorg-keysym,@@ -146,6 +134,9 @@   AC_SUBST([EXTRA_LIBRARIES])++X_LIBRARIES="$x_libraries"+AC_SUBST([X_LIBRARIES])  AC_CONFIG_FILES([config.mk X11.buildinfo]) AC_OUTPUT
include/HsXlib.h view
@@ -19,15 +19,12 @@ #include <X11/Xutil.h>  #include <X11/extensions/Xrandr.h>--#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H #include <X11/extensions/scrnsaver.h>-#endif  /* Xutil.h overrides some functions with macros.  * In recent versions of X this can be turned off with  *- *	#define XUTIL_DEFINE_FUNCTIONS+ *     #define XUTIL_DEFINE_FUNCTIONS  *  * before the #include, but this doesn't work with older versions.  * As a workaround, we undef the macros here.  Note that this is only
include/XlibExtras.h view
@@ -18,10 +18,7 @@ #include <X11/Xproto.h>  #include <X11/extensions/Xrandr.h>--#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H #include <X11/extensions/scrnsaver.h>-#endif  /* Xutil.h overrides some functions with macros.  * In recent versions of X this can be turned off with