X11 1.6.1.2 → 1.10.3
raw patch · 27 files changed
Files
- CHANGES.md +46/−0
- Graphics/X11.hs +3/−3
- Graphics/X11/ExtraTypes.hs +12/−12
- Graphics/X11/ExtraTypes/HP.hsc +1/−1
- Graphics/X11/ExtraTypes/XF86.hsc +253/−2
- Graphics/X11/Types.hsc +9/−9
- Graphics/X11/XScreenSaver.hsc +5/−14
- Graphics/X11/Xinerama.hsc +2/−2
- Graphics/X11/Xlib.hs +12/−12
- Graphics/X11/Xlib/Color.hs +0/−1
- Graphics/X11/Xlib/Context.hs +0/−1
- Graphics/X11/Xlib/Event.hsc +3/−3
- Graphics/X11/Xlib/Extras.hsc +119/−20
- Graphics/X11/Xlib/Font.hsc +52/−52
- Graphics/X11/Xlib/Image.hs +23/−7
- Graphics/X11/Xlib/Misc.hsc +3/−18
- Graphics/X11/Xlib/Types.hsc +16/−0
- Graphics/X11/Xlib/Window.hs +0/−1
- Graphics/X11/Xrandr.hsc +183/−7
- README.md +33/−0
- Setup.hs +1/−5
- X11.buildinfo.in +1/−0
- X11.cabal +77/−57
- configure +118/−117
- configure.ac +8/−17
- include/HsXlib.h +1/−4
- include/XlibExtras.h +0/−3
+ 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 (@@ -688,6 +689,146 @@ #else -- Skipping xF86XK_Music because your X doesn't define it #endif+#ifdef XF86XK_Battery+ xF86XK_Battery, -- Display battery information+#else+ -- Skipping XF86XK_Battery because your X doesn't define it+#endif+#ifdef XF86XK_Bluetooth+ xF86XK_Bluetooth, -- Enable/disable Bluetooth+#else+ -- Skipping XF86XK_Bluetooth because your X doesn't define it+#endif+#ifdef XF86XK_WLAN+ xF86XK_WLAN, -- Enable/disable WLAN+#else+ -- Skipping XF86XK_WLAN because your X doesn't define it+#endif+#ifdef XF86XK_UWB+ xF86XK_UWB, -- Enable/disable UWB+#else+ -- Skipping XF86XK_UWB because your X doesn't define it+#endif+#ifdef XF86XK_AudioForward+ xF86XK_AudioForward, -- Fast-forward audio track+#else+ -- Skipping XF86XK_AudioForward because your X doesn't define it+#endif+#ifdef XF86XK_AudioRepeat+ xF86XK_AudioRepeat, -- Toggle repeat mode+#else+ -- Skipping XF86XK_AudioRepeat because your X doesn't define it+#endif+#ifdef XF86XK_AudioRandomPlay+ xF86XK_AudioRandomPlay, -- Toggle shuffle mode+#else+ -- Skipping XF86XK_AudioRandomPlay because your X doesn't define it+#endif+#ifdef XF86XK_Subtitle+ xF86XK_Subtitle, -- Cycle through subtitle+#else+ -- Skipping XF86XK_Subtitle because your X doesn't define it+#endif+#ifdef XF86XK_AudioCycleTrack+ xF86XK_AudioCycleTrack, -- Cycle through audio tracks+#else+ -- Skipping XF86XK_AudioCycleTrack because your X doesn't define it+#endif+#ifdef XF86XK_CycleAngle+ xF86XK_CycleAngle, -- Cycle through angles+#else+ -- Skipping XF86XK_CycleAngle because your X doesn't define it+#endif+#ifdef XF86XK_FrameBack+ xF86XK_FrameBack, -- Video: go one frame back+#else+ -- Skipping XF86XK_FrameBack because your X doesn't define it+#endif+#ifdef XF86XK_FrameForward+ xF86XK_FrameForward, -- Video: go one frame forward+#else+ -- Skipping XF86XK_FrameForward because your X doesn't define it+#endif+#ifdef XF86XK_Time+ xF86XK_Time, -- Display, or shows an entry for time seeking+#else+ -- Skipping XF86XK_Time because your X doesn't define it+#endif+#ifdef XF86XK_Select+ xF86XK_Select, -- Select button on joypads and remotes+#else+ -- Skipping XF86XK_Select because your X doesn't define it+#endif+#ifdef XF86XK_View+ xF86XK_View, -- Show a view options/properties+#else+ -- Skipping XF86XK_View because your X doesn't define it+#endif+#ifdef XF86XK_TopMenu+ xF86XK_TopMenu, -- Go to a top-level menu in a video+#else+ -- Skipping XF86XK_TopMenu because your X doesn't define it+#endif+#ifdef XF86XK_Red+ xF86XK_Red, -- Red button+#else+ -- Skipping XF86XK_Red because your X doesn't define it+#endif+#ifdef XF86XK_Green+ xF86XK_Green, -- Green button+#else+ -- Skipping XF86XK_Green because your X doesn't define it+#endif+#ifdef XF86XK_Yellow+ xF86XK_Yellow, -- Yellow button+#else+ -- Skipping XF86XK_Yellow because your X doesn't define it+#endif+#ifdef XF86XK_Blue+ xF86XK_Blue, -- Blue button+#else+ -- Skipping XF86XK_Blue because your X doesn't define it+#endif+#ifdef XF86XK_Suspend+ xF86XK_Suspend, -- Sleep to RAM+#else+ -- Skipping XF86XK_Suspend because your X doesn't define it+#endif+#ifdef XF86XK_Hibernate+ xF86XK_Hibernate, -- Sleep to disk+#else+ -- Skipping XF86XK_Hibernate because your X doesn't define it+#endif+#ifdef XF86XK_TouchpadToggle+ xF86XK_TouchpadToggle, -- Toggle between touchpad/trackstick+#else+ -- Skipping XF86XK_TouchpadToggle because your X doesn't define it+#endif+#ifdef XF86XK_TouchpadOn+ xF86XK_TouchpadOn, -- The touchpad got switched on+#else+ -- Skipping XF86XK_TouchpadOn because your X doesn't define it+#endif+#ifdef XF86XK_TouchpadOff+ xF86XK_TouchpadOff, -- The touchpad got switched off+#else+ -- Skipping XF86XK_TouchpadOff because your X doesn't define it+#endif+#ifdef XF86XK_AudioMicMute+ xF86XK_AudioMicMute, -- Mute the Mic from the system+#else+ -- Skipping XF86XK_AudioMicMute because your X doesn't define it+#endif+#ifdef XF86XK_LogWindowTree+ xF86XK_LogWindowTree, -- Print window tree to log+#else+ -- Skipping XF86XK_LogWindowTree because your X doesn't define it+#endif+#ifdef XF86XK_LogGrabInfo+ xF86XK_LogGrabInfo, -- Print all active grabs to log+#else+ -- Skipping XF86XK_LogGrabInfo because your X doesn't define it+#endif #ifdef XF86XK_Switch_VT_1 xF86XK_Switch_VT_1, #else@@ -772,8 +913,6 @@ import Graphics.X11.Types -#include "HsAllKeysyms.h"- #ifdef XF86XK_ModeLock xF86XK_ModeLock :: KeySym xF86XK_ModeLock = #const XF86XK_ModeLock@@ -1305,6 +1444,118 @@ #ifdef XF86XK_Music xF86XK_Music :: KeySym xF86XK_Music = #const XF86XK_Music+#endif+#ifdef XF86XK_Battery+xF86XK_Battery :: KeySym+xF86XK_Battery = #const XF86XK_Battery+#endif+#ifdef XF86XK_Bluetooth+xF86XK_Bluetooth :: KeySym+xF86XK_Bluetooth = #const XF86XK_Bluetooth+#endif+#ifdef XF86XK_WLAN+xF86XK_WLAN :: KeySym+xF86XK_WLAN = #const XF86XK_WLAN+#endif+#ifdef XF86XK_UWB+xF86XK_UWB :: KeySym+xF86XK_UWB = #const XF86XK_UWB+#endif+#ifdef XF86XK_AudioForward+xF86XK_AudioForward :: KeySym+xF86XK_AudioForward = #const XF86XK_AudioForward+#endif+#ifdef XF86XK_AudioRepeat+xF86XK_AudioRepeat :: KeySym+xF86XK_AudioRepeat = #const XF86XK_AudioRepeat+#endif+#ifdef XF86XK_AudioRandomPlay+xF86XK_AudioRandomPlay :: KeySym+xF86XK_AudioRandomPlay = #const XF86XK_AudioRandomPlay+#endif+#ifdef XF86XK_Subtitle+xF86XK_Subtitle :: KeySym+xF86XK_Subtitle = #const XF86XK_Subtitle+#endif+#ifdef XF86XK_AudioCycleTrack+xF86XK_AudioCycleTrack :: KeySym+xF86XK_AudioCycleTrack = #const XF86XK_AudioCycleTrack+#endif+#ifdef XF86XK_CycleAngle+xF86XK_CycleAngle :: KeySym+xF86XK_CycleAngle = #const XF86XK_CycleAngle+#endif+#ifdef XF86XK_FrameBack+xF86XK_FrameBack :: KeySym+xF86XK_FrameBack = #const XF86XK_FrameBack+#endif+#ifdef XF86XK_FrameForward+xF86XK_FrameForward :: KeySym+xF86XK_FrameForward = #const XF86XK_FrameForward+#endif+#ifdef XF86XK_Time+xF86XK_Time :: KeySym+xF86XK_Time = #const XF86XK_Time+#endif+#ifdef XF86XK_Select+xF86XK_Select :: KeySym+xF86XK_Select = #const XF86XK_Select+#endif+#ifdef XF86XK_View+xF86XK_View :: KeySym+xF86XK_View = #const XF86XK_View+#endif+#ifdef XF86XK_TopMenu+xF86XK_TopMenu :: KeySym+xF86XK_TopMenu = #const XF86XK_TopMenu+#endif+#ifdef XF86XK_Red+xF86XK_Red :: KeySym+xF86XK_Red = #const XF86XK_Red+#endif+#ifdef XF86XK_Green+xF86XK_Green :: KeySym+xF86XK_Green = #const XF86XK_Green+#endif+#ifdef XF86XK_Yellow+xF86XK_Yellow :: KeySym+xF86XK_Yellow = #const XF86XK_Yellow+#endif+#ifdef XF86XK_Blue+xF86XK_Blue :: KeySym+xF86XK_Blue = #const XF86XK_Blue+#endif+#ifdef XF86XK_Suspend+xF86XK_Suspend :: KeySym+xF86XK_Suspend = #const XF86XK_Suspend+#endif+#ifdef XF86XK_Hibernate+xF86XK_Hibernate :: KeySym+xF86XK_Hibernate = #const XF86XK_Hibernate+#endif+#ifdef XF86XK_TouchpadToggle+xF86XK_TouchpadToggle :: KeySym+xF86XK_TouchpadToggle = #const XF86XK_TouchpadToggle+#endif+#ifdef XF86XK_TouchpadOn+xF86XK_TouchpadOn :: KeySym+xF86XK_TouchpadOn = #const XF86XK_TouchpadOn+#endif+#ifdef XF86XK_TouchpadOff+xF86XK_TouchpadOff :: KeySym+xF86XK_TouchpadOff = #const XF86XK_TouchpadOff+#endif+#ifdef XF86XK_AudioMicMute+xF86XK_AudioMicMute :: KeySym+xF86XK_AudioMicMute = #const XF86XK_AudioMicMute+#endif+#ifdef XF86XK_LogWindowTree+xF86XK_LogWindowTree :: KeySym+xF86XK_LogWindowTree = #const XF86XK_LogWindowTree+#endif+#ifdef XF86XK_LogGrabInfo+xF86XK_LogGrabInfo :: KeySym+xF86XK_LogGrabInfo = #const XF86XK_LogGrabInfo #endif #ifdef XF86XK_Switch_VT_1 xF86XK_Switch_VT_1 :: 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
@@ -4,9 +4,9 @@ -- Module : Graphics.X11.XScreenSaver -- Copyright : (c) Joachim Breitner -- (c) Jochen Keil--- License : GPL2+-- License : BSD3 ----- Maintainer: Jochen Keil <jochen dot keil at gmail dot com>+-- Maintainer: Joachim Breitner <mail@joachim-breitner.de> -- Stability : provisional -- Portability: portable --@@ -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/Color.hs view
@@ -35,7 +35,6 @@ import Foreign import Foreign.C-import Foreign.C.Types ---------------------------------------------------------------- -- Color and Colormaps
Graphics/X11/Xlib/Context.hs view
@@ -46,7 +46,6 @@ import Foreign import Foreign.C-import Foreign.C.Types ---------------------------------------------------------------- -- Graphics contexts
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@@ -191,6 +189,15 @@ , ev_property :: !Atom , ev_time :: !Time }+ | SelectionClear+ { ev_event_type :: !EventType+ , ev_serial :: !CULong+ , ev_send_event :: !Bool+ , ev_event_display :: Display+ , ev_window :: !Window+ , ev_selection :: !Atom+ , ev_time :: !Time+ } | PropertyEvent { ev_event_type :: !EventType , ev_serial :: !CULong@@ -213,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@@ -288,7 +304,6 @@ , ev_timestamp :: !Time , ev_rr_state :: !CInt }-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H | ScreenSaverNotifyEvent { ev_event_type :: !EventType , ev_serial :: !CULong@@ -301,7 +316,6 @@ , ev_forced :: !Bool , ev_time :: !Time }-#endif deriving ( Show, Typeable ) eventTable :: [(EventType, String)]@@ -340,9 +354,7 @@ , (clientMessage , "ClientMessage") , (mappingNotify , "MappingNotify") , (lASTEvent , "LASTEvent")-#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H , (screenSaverNotify , "ScreenSaverNotify")-#endif ] eventName :: Event -> String@@ -641,6 +653,22 @@ } -------------------------+ -- SelectionClearEvent:+ -------------------------+ | type_ == selectionClear -> do+ window <- #{peek XSelectionClearEvent, window } p+ atom <- #{peek XSelectionClearEvent, selection } p+ time <- #{peek XSelectionClearEvent, time } p+ return $ SelectionClear+ { ev_event_type = type_+ , ev_serial = serial+ , ev_send_event = send_event+ , ev_event_display = display+ , ev_window = window+ , ev_selection = atom+ , ev_time = time+ }+ ------------------------- -- PropertyEvent ------------------------- | type_ == propertyNotify -> do@@ -683,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@@ -749,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@@ -827,7 +872,6 @@ , ev_subtype = subtype } -#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H ----------------- -- ScreenSaverNotifyEvent: -----------------@@ -839,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.@@ -877,7 +920,7 @@ #{poke XWindowChanges, border_width} p $ wc_border_width wc #{poke XWindowChanges, sibling } p $ wc_sibling wc #{poke XWindowChanges, stack_mode } p $ wc_stack_mode wc- + peek p = return WindowChanges `ap` (#{peek XWindowChanges, x} p) `ap` (#{peek XWindowChanges, y} p)@@ -927,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@@ -937,11 +980,16 @@ -- TODO: this data type is incomplete wrt. the C struct data WindowAttributes = WindowAttributes { wa_x, wa_y, wa_width, wa_height, wa_border_width :: CInt+ , 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 } --- +-- -- possible map_states' -- waIsUnmapped, waIsUnviewable, waIsViewable :: CInt@@ -959,7 +1007,12 @@ `ap` (#{peek XWindowAttributes, width } p) `ap` (#{peek XWindowAttributes, height } p) `ap` (#{peek XWindowAttributes, border_width } p)+ `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@@ -967,7 +1020,12 @@ #{poke XWindowAttributes, width } p $ wa_width wa #{poke XWindowAttributes, height } p $ wa_height wa #{poke XWindowAttributes, border_width } p $ wa_border_width wa+ #{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"@@ -975,7 +1033,7 @@ getWindowAttributes :: Display -> Window -> IO WindowAttributes getWindowAttributes d w = alloca $ \p -> do- _ <- xGetWindowAttributes d w p+ _ <- throwIfZero "getWindowAttributes" $ xGetWindowAttributes d w p peek p -- | interface to the X11 library function @XChangeWindowAttributes()@.@@ -1200,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@@ -1256,7 +1322,7 @@ ------------------------------------------------------------------------ -- XErrorEvents--- +-- -- I'm too lazy to write the binding -- @@ -1291,6 +1357,9 @@ foreign import ccall unsafe "XlibExtras.h XChangeProperty" xChangeProperty :: Display -> Window -> Atom -> Atom -> CInt -> CInt -> Ptr CUChar -> CInt -> IO Status +foreign import ccall unsafe "XlibExtras.h XDeleteProperty"+ xDeleteProperty :: Display -> Window -> Atom -> IO Status+ foreign import ccall unsafe "XlibExtras.h XGetWindowProperty" xGetWindowProperty :: Display -> Window -> Atom -> CLong -> CLong -> Bool -> Atom -> Ptr Atom -> Ptr CInt -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CUChar) -> IO Status @@ -1358,6 +1427,11 @@ propModePrepend = #{const PropModePrepend} propModeAppend = #{const PropModeAppend} +deleteProperty :: Display -> Window -> Atom -> IO ()+deleteProperty dpy w prop = do+ _ <- xDeleteProperty dpy w prop+ return ()+ -- Windows foreign import ccall unsafe "XlibExtras.h XUnmapWindow"@@ -1454,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@@ -1475,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/Image.hs view
@@ -17,15 +17,19 @@ createImage, putImage, destroyImage,+ getImage,+ xGetPixel,+ getPixel ) where import Graphics.X11.Types import Graphics.X11.Xlib.Types -import Foreign--- import Foreign.C+import Foreign (Ptr, throwIfNull) import Foreign.C.Types +import System.IO.Unsafe (unsafePerformIO)+ ---------------------------------------------------------------- -- Image ----------------------------------------------------------------@@ -36,7 +40,7 @@ image <- throwIfNull "createImage" (xCreateImage display vis depth format offset dat width height bitmap_pad bytes_per_line) return (Image image) foreign import ccall unsafe "HsXlib.h XCreateImage"- xCreateImage :: Display -> Visual -> CInt -> ImageFormat -> CInt -> + xCreateImage :: Display -> Visual -> CInt -> ImageFormat -> CInt -> Ptr CChar -> Dimension -> Dimension -> CInt -> CInt -> IO (Ptr Image) -- | interface to the X11 library function @XPutImage()@.@@ -48,13 +52,25 @@ foreign import ccall unsafe "HsXlib.h XDestroyImage" destroyImage :: Image -> IO () +-- | interface to the X11 library function @XGetImage()@.+getImage :: Display -> Drawable -> CInt -> CInt -> CUInt -> CUInt -> CULong -> ImageFormat -> IO Image+getImage display d x y width height plane_mask format = do+ image <- throwIfNull "getImage" (xGetImage display d x y width height plane_mask format)+ return (Image image)++foreign import ccall unsafe "HsXlib.h XGetImage"+ xGetImage :: Display -> Drawable -> CInt -> CInt -> CUInt -> CUInt -> CULong -> ImageFormat -> IO (Ptr Image)++foreign import ccall unsafe "HsXlib.h XGetPixel"+ xGetPixel :: Image -> CInt -> CInt -> IO CULong++-- | interface to the X11 library function @XGetPixel()@.+getPixel :: Image -> CInt -> CInt -> CULong+getPixel i x y = unsafePerformIO (xGetPixel i x y)+ {- don't need XInitImage since Haskell users probably won't be setting members of the XImage structure themselves -} -- XInitImage omitted -{- these two functions are for fetching image data from a drawable-back into an image struct. i'm not exactly sure when they would be-used -}--- XGetImage omitted -- XGetSubImage omitted
Graphics/X11/Xlib/Misc.hsc view
@@ -189,7 +189,6 @@ import Foreign (Storable, Ptr, alloca, peek, throwIfNull, with, withArrayLen, allocaBytes, pokeByteOff, withArray, FunPtr, nullPtr, Word32, peekArray) import Foreign.C -import Data.Default import System.IO.Unsafe #if __GLASGOW_HASKELL__@@ -269,11 +268,11 @@ -- | interface to the X11 library function @XGrabKey()@. foreign import ccall unsafe "HsXlib.h XGrabKey"- grabKey :: Display -> KeyCode -> ButtonMask -> Window -> Bool -> GrabMode -> GrabMode -> IO ()+ grabKey :: Display -> KeyCode -> KeyMask -> Window -> Bool -> GrabMode -> GrabMode -> IO () -- | interface to the X11 library function @XUngrabKey()@. foreign import ccall unsafe "HsXlib.h XUngrabKey"- ungrabKey :: Display -> KeyCode -> ButtonMask -> Window -> IO ()+ ungrabKey :: Display -> KeyCode -> KeyMask -> Window -> IO () -- | interface to the X11 library function @XGrabKeyboard()@. foreign import ccall unsafe "HsXlib.h XGrabKeyboard"@@ -695,20 +694,6 @@ foreign import ccall unsafe "HsXlib.h XVisualIDFromVisual" visualIDFromVisual :: Visual -> IO VisualID -instance Default VisualInfo where- def = VisualInfo {- visualInfo_visual = Visual nullPtr,- visualInfo_visualID = 0,- visualInfo_screen = 0,- visualInfo_depth = 0,- visualInfo_class = 0,- visualInfo_redMask = 0,- visualInfo_greenMask = 0,- visualInfo_blueMask = 0,- visualInfo_colormapSize = 0,- visualInfo_bitsPerRGB = 0- }- type VisualInfoMask = CLong #{enum VisualInfoMask, , visualNoMask = VisualNoMask@@ -768,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,6 +35,8 @@ import Data.Data #endif +import Data.Default.Class+ #include "HsXlib.h" ----------------------------------------------------------------@@ -107,6 +109,20 @@ #else deriving (Eq, Show) #endif++instance Default VisualInfo where+ def = VisualInfo {+ visualInfo_visual = Visual nullPtr,+ visualInfo_visualID = 0,+ visualInfo_screen = 0,+ visualInfo_depth = 0,+ visualInfo_class = 0,+ visualInfo_redMask = 0,+ visualInfo_greenMask = 0,+ visualInfo_blueMask = 0,+ visualInfo_colormapSize = 0,+ visualInfo_bitsPerRGB = 0+ } instance Storable VisualInfo where sizeOf _ = #size XVisualInfo
Graphics/X11/Xlib/Window.hs view
@@ -53,7 +53,6 @@ import Foreign import Foreign.C-import Foreign.C.Types ---------------------------------------------------------------- -- Windows
Graphics/X11/Xrandr.hsc view
@@ -23,6 +23,8 @@ XRRScreenResources(..), XRROutputInfo(..), XRRCrtcInfo(..),+ XRRPropertyInfo(..),+ XRRMonitorInfo(..), compiledWithXrandr, Rotation, Reflection,@@ -53,7 +55,13 @@ xrrGetScreenResourcesCurrent, xrrSetOutputPrimary, xrrGetOutputPrimary,- xrrListOutputProperties+ xrrListOutputProperties,+ xrrQueryOutputProperty,+ xrrConfigureOutputProperty,+ xrrChangeOutputProperty,+ xrrGetOutputProperty,+ xrrDeleteOutputProperty,+ xrrGetMonitors, ) where import Foreign@@ -133,6 +141,28 @@ , xrr_ci_possible :: [RROutput] } deriving (Eq, Show) +-- | Representation of the XRRPropertyInfo struct+data XRRPropertyInfo = XRRPropertyInfo+ { xrr_pi_pending :: !Bool+ , xrr_pi_range :: !Bool+ , xrr_pi_immutable :: !Bool+ , 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@@ -201,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?@@ -317,6 +379,27 @@ (#{peek XRRCrtcInfo, possible } p) +instance Storable XRRPropertyInfo where+ sizeOf _ = #{size XRRPropertyInfo}+ -- FIXME: Is this right?+ alignment _ = alignment (undefined :: CInt)++ poke p xrr_pi = do+ #{poke XRRPropertyInfo, pending } p $ xrr_pi_pending xrr_pi+ #{poke XRRPropertyInfo, range } p $ xrr_pi_range xrr_pi+ #{poke XRRPropertyInfo, immutable } p $ xrr_pi_immutable xrr_pi+ -- see comment in Storable XRRScreenResources about dynamic resource allocation+ #{poke XRRPropertyInfo, num_values } p ( 0 :: CInt )+ #{poke XRRPropertyInfo, values } p ( nullPtr :: Ptr CLong )++ peek p = return XRRPropertyInfo+ `ap` ( #{peek XRRPropertyInfo, pending } p )+ `ap` ( #{peek XRRPropertyInfo, range } p )+ `ap` ( #{peek XRRPropertyInfo, immutable } p )+ `ap` peekCArrayIO ( #{peek XRRPropertyInfo, num_values} p)+ ( #{peek XRRPropertyInfo, values} p)++ xrrQueryExtension :: Display -> IO (Maybe (CInt, CInt)) xrrQueryExtension dpy = wrapPtr2 (cXRRQueryExtension dpy) go where go False _ _ = Nothing@@ -383,7 +466,6 @@ sizes <- if nsizes == 0 then return Nothing else peekArray (fromIntegral nsizes) p >>= return . Just- _ <- xFree p return sizes foreign import ccall "XRRConfigSizes" cXRRConfigSizes :: XRRScreenConfiguration -> Ptr CInt -> IO (Ptr XRRScreenSize)@@ -398,7 +480,6 @@ rates <- if nrates == 0 then return Nothing else peekArray (fromIntegral nrates) p >>= return . Just- _ <- xFree p return rates foreign import ccall "XRRConfigRates" cXRRConfigRates :: XRRScreenConfiguration -> CInt -> Ptr CInt -> IO (Ptr CShort)@@ -427,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 =@@ -451,7 +532,6 @@ sizes <- if nsizes == 0 then return Nothing else peekArray (fromIntegral nsizes) p >>= return . Just- _ <- xFree p return sizes foreign import ccall "XRRSizes" cXRRSizes :: Display -> CInt -> Ptr CInt -> IO (Ptr XRRScreenSize)@@ -466,7 +546,6 @@ rates <- if nrates == 0 then return Nothing else peekArray (fromIntegral nrates) p >>= return . Just- _ <- xFree p return rates foreign import ccall "XRRRates" cXRRRates :: Display -> CInt -> CInt -> Ptr CInt -> IO (Ptr CShort)@@ -582,6 +661,103 @@ foreign import ccall "XRRListOutputProperties" cXRRListOutputProperties :: Display -> RROutput -> Ptr CInt -> IO (Ptr Atom)++xrrQueryOutputProperty :: Display -> RROutput -> Atom -> IO (Maybe XRRPropertyInfo)+xrrQueryOutputProperty dpy rro prop = do+ p <- cXRRQueryOutputProperty dpy rro prop+ if p == nullPtr+ then return Nothing+ else do+ res <- peek p+ _ <- xFree p+ return $ Just res++foreign import ccall "XRRQueryOutputProperty"+ cXRRQueryOutputProperty :: Display -> RROutput -> Atom -> IO (Ptr XRRPropertyInfo)++xrrConfigureOutputProperty :: Display -> RROutput -> Atom -> Bool -> Bool -> [CLong] -> IO ()+xrrConfigureOutputProperty dpy rro prop pend range xs = withArrayLen xs $+ cXRRConfigureOutputProperty dpy rro prop pend range . fromIntegral++foreign import ccall "XRRConfigureOutputProperty"+ cXRRConfigureOutputProperty :: Display -> RROutput -> Atom -> Bool -> Bool -> CInt -> Ptr CLong -> IO ()++xrrChangeOutputProperty :: Display -> RROutput -> Atom -> Atom -> CInt -> CInt -> [Word32] -> IO ()+xrrChangeOutputProperty dpy rro prop typ format mode xs = withPool $ \pool -> do+ ptr <- case format of+ 8 -> pooledNewArray pool (map fromIntegral xs :: [Word8])+ 16 -> castPtr `fmap` pooledNewArray pool (map fromIntegral xs :: [Word16])+ 32 -> castPtr `fmap` pooledNewArray pool xs+ _ -> error "invalid format"++ cXRRChangeOutputProperty dpy rro prop typ format mode ptr (fromIntegral $ length xs)++foreign import ccall "XRRChangeOutputProperty"+ cXRRChangeOutputProperty :: Display -> RROutput -> Atom -> Atom -> CInt -> CInt -> Ptr Word8 -> CInt -> IO ()++-- | @xrrGetOutputProperty display output property offset length delete pending propertyType@+-- | returns @Maybe (actualType, format, bytesAfter, data)@.+xrrGetOutputProperty ::+ Display -> RROutput -> Atom -> CLong -> CLong -> Bool -> Bool -> Atom ->+ IO (Maybe (Atom, Int, CULong, [Word32]))+xrrGetOutputProperty dpy rro prop offset len delete preferPending reqType = withPool $ \pool -> do+ actualTypep <- pooledMalloc pool+ actualFormatp <- pooledMalloc pool+ nItemsp <- pooledMalloc pool+ bytesAfterp <- pooledMalloc pool+ datapp <- pooledMalloc pool+ status <- cXRRGetOutputProperty dpy rro prop offset len+ delete preferPending reqType+ actualTypep actualFormatp nItemsp bytesAfterp datapp++ if status /= 0+ then return Nothing+ else do+ format <- fmap fromIntegral (peek actualFormatp)+ nitems <- fmap fromIntegral (peek nItemsp)+ ptr <- peek datapp++ dat <- case format of+ 0 -> return []+ 8 -> fmap (map fromIntegral) $ peekArray nitems ptr+ 16 -> fmap (map fromIntegral) $ peekArray nitems (castPtr ptr :: Ptr Word16)+ 32 -> peekArray nitems (castPtr ptr :: Ptr Word32)+ _ -> error $ "impossible happened: prop format is not in 0,8,16,32 (" ++ show format ++ ")"++ _ <- if format /= 0+ then xFree ptr+ else return 0++ typ <- peek actualTypep+ bytesAfter <- peek bytesAfterp+ return $ Just (typ, format, bytesAfter, dat)++foreign import ccall "XRRGetOutputProperty"+ cXRRGetOutputProperty :: Display -> RROutput -> Atom -> CLong -> CLong -> Bool -> Bool+ -> Atom -> Ptr Atom -> Ptr CInt -> Ptr CULong -> Ptr CULong -> Ptr (Ptr Word8) -> IO CInt++xrrDeleteOutputProperty :: Display -> RROutput -> Atom -> IO ()+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 [](https://hackage.haskell.org/package/X11) [](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,68 +1,88 @@ name: X11-version: 1.6.1.2+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>-homepage: https://github.com/haskell-pkg-janitors/X11+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-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.2+homepage: https://github.com/xmonad/X11+bug-reports: https://github.com/xmonad/X11/issues build-type: Configure+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 >= 3 && < 5, data-default+ include-dirs: include ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-binds- ghc-prof-options: -prof -auto-all++ if flag(pedantic)+ ghc-options: -Werror
configure view
@@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.68 for Haskell X11 package 1.4.6.+# Generated by GNU Autoconf 2.69 for Haskell X11 package 1.4.6. # # Report bugs to <dons@galois.com>. # #-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software-# Foundation, Inc.+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation@@ -136,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall+ # into an infinite loop, continuously re-executing ourselves.+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then+ _as_can_reexec=no; export _as_can_reexec;+ # We cannot yet assume a decent shell, so we have to provide a+# neutralization value for shells without unset; and this also+# works around shells that cannot unset nonexistent variables.+# Preserve -v and -x to the replacement shell.+BASH_ENV=/dev/null+ENV=/dev/null+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV+case $- in # ((((+ *v*x* | *x*v* ) as_opts=-vx ;;+ *v* ) as_opts=-v ;;+ *x* ) as_opts=-x ;;+ * ) as_opts= ;;+esac+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}+# Admittedly, this is quite paranoid, since all the known shells bail+# out after a failed `exec'.+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2+as_fn_exit 255+ fi+ # We don't want this to propagate to other subprocesses.+ { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh@@ -169,7 +192,8 @@ else exitcode=1; echo positional parameters were not saved. fi-test x\$exitcode = x0 || exit 1"+test x\$exitcode = x0 || exit 1+test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&@@ -214,21 +238,25 @@ if test "x$CONFIG_SHELL" != x; then :- # We cannot yet assume a decent shell, so we have to provide a- # neutralization value for shells without unset; and this also- # works around shells that cannot unset nonexistent variables.- # Preserve -v and -x to the replacement shell.- BASH_ENV=/dev/null- ENV=/dev/null- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV- export CONFIG_SHELL- case $- in # ((((- *v*x* | *x*v* ) as_opts=-vx ;;- *v* ) as_opts=-v ;;- *x* ) as_opts=-x ;;- * ) as_opts= ;;- esac- exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}+ export CONFIG_SHELL+ # We cannot yet assume a decent shell, so we have to provide a+# neutralization value for shells without unset; and this also+# works around shells that cannot unset nonexistent variables.+# Preserve -v and -x to the replacement shell.+BASH_ENV=/dev/null+ENV=/dev/null+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV+case $- in # ((((+ *v*x* | *x*v* ) as_opts=-vx ;;+ *v* ) as_opts=-v ;;+ *x* ) as_opts=-x ;;+ * ) as_opts= ;;+esac+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}+# Admittedly, this is quite paranoid, since all the known shells bail+# out after a failed `exec'.+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2+exit 255 fi if test x$as_have_required = xno; then :@@ -331,6 +359,14 @@ } # as_fn_mkdir_p++# as_fn_executable_p FILE+# -----------------------+# Test if FILE is an executable regular file.+as_fn_executable_p ()+{+ test -f "$1" && test -x "$1"+} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take@@ -452,6 +488,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have+ # already done that, so ensure we don't try to do so again and fall+ # in an infinite loop. This has already happened in practice.+ _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this).@@ -486,16 +526,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.- # In both cases, we have to default to `cp -p'.+ # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||- as_ln_s='cp -p'+ as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else- as_ln_s='cp -p'+ as_ln_s='cp -pR' fi else- as_ln_s='cp -p'+ as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null@@ -507,28 +547,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then- as_test_x='test -x'-else- if ls -dL / >/dev/null 2>&1; then- as_ls_L_option=L- else- as_ls_L_option=- fi- as_test_x='- eval sh -c '\''- if test -d "$1"; then- test -d "$1/.";- else- case $1 in #(- -*)set "./$1";;- esac;- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((- ???[sx]*):;;*)false;;esac;fi- '\'' sh- '-fi-as_executable_p=$as_test_x+as_test_x='test -x'+as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"@@ -604,6 +624,7 @@ ac_subst_vars='LTLIBOBJS LIBOBJS+X_LIBRARIES EXTRA_LIBRARIES EGREP GREP@@ -641,6 +662,7 @@ docdir oldincludedir includedir+runstatedir localstatedir sharedstatedir sysconfdir@@ -666,7 +688,6 @@ enable_x11 with_x with_xinerama-with_xscreensaver with_xorg_keysym ' ac_precious_vars='build_alias@@ -717,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}'@@ -969,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=* \@@ -1106,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.@@ -1134,8 +1165,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe- $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.- If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi@@ -1261,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]@@ -1302,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:@@ -1383,9 +1412,9 @@ if $ac_init_version; then cat <<\_ACEOF Haskell X11 package configure 1.4.6-generated by GNU Autoconf 2.68+generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc.+Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF@@ -1498,7 +1527,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes ||- $as_test_x conftest$ac_exeext+ test -x conftest$ac_exeext }; then : ac_retval=0 else@@ -1752,7 +1781,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by Haskell X11 package $as_me 1.4.6, which was-generated by GNU Autoconf 2.68. Invocation command line was+generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2142,7 +2171,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2@@ -2182,7 +2211,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2@@ -2235,7 +2264,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2@@ -2276,7 +2305,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue@@ -2334,7 +2363,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2@@ -2378,7 +2407,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2@@ -2824,8 +2853,7 @@ /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h>-#include <sys/types.h>-#include <sys/stat.h>+struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int);@@ -3818,7 +3846,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue+ as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in@@ -3884,7 +3912,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue+ as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in@@ -4098,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 :@@ -4124,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; }@@ -4280,6 +4290,9 @@ +X_LIBRARIES="$x_libraries"++ ac_config_files="$ac_config_files config.mk X11.buildinfo" cat >confcache <<\_ACEOF@@ -4689,16 +4702,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.- # In both cases, we have to default to `cp -p'.+ # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||- as_ln_s='cp -p'+ as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else- as_ln_s='cp -p'+ as_ln_s='cp -pR' fi else- as_ln_s='cp -p'+ as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null@@ -4758,29 +4771,17 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then- as_test_x='test -x'-else- if ls -dL / >/dev/null 2>&1; then- as_ls_L_option=L- else- as_ls_L_option=- fi- as_test_x='- eval sh -c '\''- if test -d "$1"; then- test -d "$1/.";- else- case $1 in #(- -*)set "./$1";;- esac;- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((- ???[sx]*):;;*)false;;esac;fi- '\'' sh- '-fi-as_executable_p=$as_test_x +# as_fn_executable_p FILE+# -----------------------+# Test if FILE is an executable regular file.+as_fn_executable_p ()+{+ test -f "$1" && test -x "$1"+} # as_fn_executable_p+as_test_x='test -x'+as_executable_p=as_fn_executable_p+ # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4801,7 +4802,7 @@ # values after options handling. ac_log=" This file was extended by Haskell X11 package $as_me 1.4.6, which was-generated by GNU Autoconf 2.68. Invocation command line was+generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS@@ -4863,10 +4864,10 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ Haskell X11 package config.status 1.4.6-configured by $0, generated by GNU Autoconf 2.68,+configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc.+Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4954,7 +4955,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL'
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