darcs patch: Changing Int to CInt and building with -D_XSERVER64 (w...

Wed Mar 28 01:24:53 CDT 2007 thedward@antejentacular.org * (Graphics.X11) Updates for (better) 64-bit compatibility Changing Int to CInt and building with -D_XSERVER64 (when appropriate) I went through and weeded out all the Ints I could find, replacing them with CInts, adding fromIntegral calls as necessary. I modified configure.ac and X11.buildinfo.in to support detecting 64-bit systems. (inspired by the test in the xorg build). All these changes seem to make X11 much more useful on 64-bit systems. Most importantly, I've got xmonad up and running beautifully.

Ok. This needs to be applied. The X11 package is basically broken on 64 bit machines without it, due to unsafe use of Int in foreign imports. -- Don thedward:
Wed Mar 28 01:24:53 CDT 2007 thedward@antejentacular.org * (Graphics.X11) Updates for (better) 64-bit compatibility
Changing Int to CInt and building with -D_XSERVER64 (when appropriate)
I went through and weeded out all the Ints I could find, replacing them with CInts, adding fromIntegral calls as necessary.
I modified configure.ac and X11.buildinfo.in to support detecting 64-bit systems. (inspired by the test in the xorg build).
All these changes seem to make X11 much more useful on 64-bit systems.
Most importantly, I've got xmonad up and running beautifully.
Content-Description: A darcs patch for your repository!
New patches:
[Changing Int to CInt and building with -D_XSERVER64 (when appropriate) thedward@antejentacular.org**20070328062453
I went through and weeded out all the Ints I could find, replacing them with CInts, adding fromIntegral calls as necessary.
I modified configure.ac and X11.buildinfo.in to support detecting 64-bit systems. (inspired by the test in the xorg build).
All these changes seem to make X11 much more useful on 64-bit systems.
Most importantly, I've got xmonad up and running beautifully.
] { hunk ./Graphics/X11/Types.hsc 794 +import Foreign.C.Types hunk ./Graphics/X11/Types.hsc 1312 -type NotifyMode = Int +type NotifyMode = CInt hunk ./Graphics/X11/Types.hsc 1322 -type NotifyDetail = Int +type NotifyDetail = CInt hunk ./Graphics/X11/Types.hsc 1334 -type Visibility = Int +type Visibility = CInt hunk ./Graphics/X11/Types.hsc 1343 -type Place = Int +type Place = CInt hunk ./Graphics/X11/Types.hsc 1349 -type Protocol = Int +type Protocol = CInt hunk ./Graphics/X11/Types.hsc 1356 -type PropertyNotification = Int +type PropertyNotification = CInt hunk ./Graphics/X11/Types.hsc 1362 -type ColormapNotification = Int +type ColormapNotification = CInt hunk ./Graphics/X11/Types.hsc 1369 -type GrabMode = Int +type GrabMode = CInt hunk ./Graphics/X11/Types.hsc 1377 -type GrabStatus = Int +type GrabStatus = CInt hunk ./Graphics/X11/Types.hsc 1387 -type AllowEvents = Int +type AllowEvents = CInt hunk ./Graphics/X11/Types.hsc 1400 -type FocusMode = Int +type FocusMode = CInt hunk ./Graphics/X11/Types.hsc 1408 -type ErrorCode = Int +type ErrorCode = CInt hunk ./Graphics/X11/Types.hsc 1432 -type Status = Int +type Status = CInt hunk ./Graphics/X11/Types.hsc 1439 -type WindowClass = Int +type WindowClass = CInt hunk ./Graphics/X11/Types.hsc 1467 -type CloseDownMode = Int +type CloseDownMode = CInt hunk ./Graphics/X11/Types.hsc 1478 -type QueryBestSizeClass = Int +type QueryBestSizeClass = CInt hunk ./Graphics/X11/Types.hsc 1491 -type GXFunction = Int +type GXFunction = CInt hunk ./Graphics/X11/Types.hsc 1511 -type LineStyle = Int +type LineStyle = CInt hunk ./Graphics/X11/Types.hsc 1518 -type CapStyle = Int +type CapStyle = CInt hunk ./Graphics/X11/Types.hsc 1526 -type JoinStyle = Int +type JoinStyle = CInt hunk ./Graphics/X11/Types.hsc 1533 -type FillStyle = Int +type FillStyle = CInt hunk ./Graphics/X11/Types.hsc 1541 -type FillRule = Int +type FillRule = CInt hunk ./Graphics/X11/Types.hsc 1547 -type SubWindowMode = Int +type SubWindowMode = CInt hunk ./Graphics/X11/Types.hsc 1554 --- type Ordering = Int +-- type Ordering = CInt hunk ./Graphics/X11/Types.hsc 1563 -type CoordinateMode = Int +type CoordinateMode = CInt hunk ./Graphics/X11/Types.hsc 1569 -type PolygonShape = Int +type PolygonShape = CInt hunk ./Graphics/X11/Types.hsc 1577 -type ArcMode = Int +type ArcMode = CInt hunk ./Graphics/X11/Types.hsc 1586 -type GCMask = Int +type GCMask = CInt hunk ./Graphics/X11/Types.hsc 1614 -type CirculationDirection = Int +type CirculationDirection = CInt hunk ./Graphics/X11/Types.hsc 1621 -type ByteOrder = Int +type ByteOrder = CInt hunk ./Graphics/X11/Types.hsc 1627 -type ColormapAlloc = Int +type ColormapAlloc = CInt hunk ./Graphics/X11/Types.hsc 1633 -type MappingRequest = Int +type MappingRequest = CInt hunk ./Graphics/X11/Types.hsc 1640 -type ChangeSaveSetMode = Int +type ChangeSaveSetMode = CInt hunk ./Graphics/X11/Types.hsc 1646 -type BitGravity = Int +type BitGravity = CInt hunk ./Graphics/X11/Types.hsc 1662 -type WindowGravity = Int +type WindowGravity = CInt hunk ./Graphics/X11/Types.hsc 1668 -type BackingStore = Int +type BackingStore = CInt hunk ./Graphics/X11/Types.hsc 1681 -type FontDirection = Int +type FontDirection = CInt hunk ./Graphics/X11/Types.hsc 1687 -type ImageFormat = Int +type ImageFormat = CInt hunk ./Graphics/X11/Xlib/Event.hsc 67 +import Foreign.C.Types hunk ./Graphics/X11/Xlib/Event.hsc 81 -type QueuedMode = Int +type QueuedMode = CInt hunk ./Graphics/X11/Xlib/Event.hsc 126 - , Int -- pointer x, y coordinates in event window - , Int -- - , Int -- coordinates relative to root - , Int -- + , CInt -- pointer x, y coordinates in event window + , CInt -- + , CInt -- coordinates relative to root + , CInt -- hunk ./Graphics/X11/Xlib/Event.hsc 162 - , Int -- pointer x, y coordinates in event window - , Int - , Int -- coordinates relative to root - , Int + , CInt -- pointer x, y coordinates in event window + , CInt + , CInt -- coordinates relative to root + , CInt hunk ./Graphics/X11/Xlib/Event.hsc 193 - , Int -- pointer x, y coordinates in event window - , Int - , Int -- coordinates relative to root - , Int + , CInt -- pointer x, y coordinates in event window + , CInt + , CInt -- coordinates relative to root + , CInt hunk ./Graphics/X11/Xlib/Event.hsc 250 - , Int -- count + , CInt -- count hunk ./Graphics/X11/Xlib/Event.hsc 311 - , Int -- count + , CInt -- count hunk ./Graphics/X11/Xlib/Event.hsc 406 - fdSet fd readfds - n <- select (fd+1) readfds nofds nofds tv_ptr + fdSet (fromIntegral fd) readfds + n <- select ((fromIntegral fd)+1) readfds nofds nofds tv_ptr hunk ./Graphics/X11/Xlib/Event.hsc 418 -foreign import ccall unsafe "HsXlib.h" fdSet :: Int -> Ptr FdSet -> IO () +foreign import ccall unsafe "HsXlib.h" fdSet :: CInt -> Ptr FdSet -> IO () hunk ./Graphics/X11/Xlib/Event.hsc 421 - Int -> Ptr FdSet -> Ptr FdSet -> Ptr FdSet -> Ptr TimeVal -> IO Int + CInt -> Ptr FdSet -> Ptr FdSet -> Ptr FdSet -> Ptr TimeVal -> IO CInt hunk ./Graphics/X11/Xlib/Event.hsc 464 - pending :: Display -> IO Int + pending :: Display -> IO CInt hunk ./Graphics/X11/Xlib/Event.hsc 468 - eventsQueued :: Display -> QueuedMode -> IO Int + eventsQueued :: Display -> QueuedMode -> IO CInt hunk ./Graphics/X11/Xlib/Font.hsc 85 - xGetGCValues :: Display -> GC -> ValueMask -> Ptr GCValues -> IO Int + xGetGCValues :: Display -> GC -> ValueMask -> Ptr GCValues -> IO CInt hunk ./Graphics/X11/Xlib/Font.hsc 136 - ( Int -- lbearing (origin to left edge of raster) - , Int -- rbearing (origin to right edge of raster) - , Int -- width (advance to next char's origin) - , Int -- ascent (baseline to top edge of raster) - , Int -- descent (baseline to bottom edge of raster) + ( 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) hunk ./Graphics/X11/Xlib/Font.hsc 167 - xTextExtents font_struct c_string nchars direction_return + xTextExtents font_struct c_string (fromIntegral nchars) direction_return hunk ./Graphics/X11/Xlib/Font.hsc 175 - xTextExtents :: FontStruct -> CString -> Int -> + xTextExtents :: FontStruct -> CString -> CInt -> hunk ./Graphics/X11/Xlib/Font.hsc 177 - Ptr CharStruct -> IO Int + Ptr CharStruct -> IO CInt hunk ./Graphics/X11/Xlib/Font.hsc 185 - xTextWidth font_struct c_string len + xTextWidth font_struct c_string (fromIntegral len) hunk ./Graphics/X11/Xlib/Font.hsc 187 - xTextWidth :: FontStruct -> CString -> Int -> IO Int32 + xTextWidth :: FontStruct -> CString -> CInt -> IO Int32 hunk ./Graphics/X11/Xlib/Misc.hsc 198 - bell :: Display -> Int -> IO () + bell :: Display -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 206 - lastKnownRequestProcessed :: Display -> IO Int + lastKnownRequestProcessed :: Display -> IO CInt hunk ./Graphics/X11/Xlib/Misc.hsc 325 - IO (Bool, Window, Window, Int, Int, Int, Int, Modifier) + IO (Bool, Window, Window, CInt, CInt, CInt, CInt, Modifier) hunk ./Graphics/X11/Xlib/Misc.hsc 346 - Ptr Window -> Ptr Window -> Ptr Int -> Ptr Int -> - Ptr Int -> Ptr Int -> Ptr Modifier -> IO Bool + Ptr Window -> Ptr Window -> Ptr CInt -> Ptr CInt -> + Ptr CInt -> Ptr CInt -> Ptr Modifier -> IO Bool hunk ./Graphics/X11/Xlib/Misc.hsc 379 --- type ErrorHandler = Display -> ErrorEvent -> IO Int +-- type ErrorHandler = Display -> ErrorEvent -> IO CInt hunk ./Graphics/X11/Xlib/Misc.hsc 382 --- type IOErrorHandler = Display -> IO Int +-- type IOErrorHandler = Display -> IO CInt hunk ./Graphics/X11/Xlib/Misc.hsc 454 -type ErrorHandler = FunPtr (Display -> Ptr XErrorEvent -> IO Int) +type ErrorHandler = FunPtr (Display -> Ptr XErrorEvent -> IO CInt) hunk ./Graphics/X11/Xlib/Misc.hsc 457 - defaultErrorHandler :: FunPtr (Display -> Ptr XErrorEvent -> IO Int) + defaultErrorHandler :: FunPtr (Display -> Ptr XErrorEvent -> IO CInt) hunk ./Graphics/X11/Xlib/Misc.hsc 550 -geometry :: Display -> Int -> String -> String -> - Dimension -> Dimension -> Dimension -> Int -> Int -> - IO (Int, Position, Position, Dimension, Dimension) +geometry :: Display -> CInt -> String -> String -> + Dimension -> Dimension -> Dimension -> CInt -> CInt -> + IO (CInt, Position, Position, Dimension, Dimension) hunk ./Graphics/X11/Xlib/Misc.hsc 570 - xGeometry :: Display -> Int -> CString -> CString -> - Dimension -> Dimension -> Dimension -> Int -> Int -> + xGeometry :: Display -> CInt -> CString -> CString -> + Dimension -> Dimension -> Dimension -> CInt -> CInt -> hunk ./Graphics/X11/Xlib/Misc.hsc 573 - Ptr Dimension -> Ptr Dimension -> IO Int + Ptr Dimension -> Ptr Dimension -> IO CInt hunk ./Graphics/X11/Xlib/Misc.hsc 577 - IO (Window, Position, Position, Dimension, Dimension, Dimension, Int) + IO (Window, Position, Position, Dimension, Dimension, Dimension, CInt) hunk ./Graphics/X11/Xlib/Misc.hsc 584 - Ptr Dimension -> Ptr Dimension -> Ptr Int -> IO Status + Ptr Dimension -> Ptr Dimension -> Ptr CInt -> IO Status hunk ./Graphics/X11/Xlib/Misc.hsc 609 -type AllowExposuresMode = Int +type AllowExposuresMode = CInt hunk ./Graphics/X11/Xlib/Misc.hsc 616 -type PreferBlankingMode = Int +type PreferBlankingMode = CInt hunk ./Graphics/X11/Xlib/Misc.hsc 623 -type ScreenSaverMode = Int +type ScreenSaverMode = CInt hunk ./Graphics/X11/Xlib/Misc.hsc 630 - IO (Int, Int, PreferBlankingMode, AllowExposuresMode) + IO (CInt, CInt, PreferBlankingMode, AllowExposuresMode) hunk ./Graphics/X11/Xlib/Misc.hsc 633 - xGetScreenSaver :: Display -> Ptr Int -> Ptr Int -> + xGetScreenSaver :: Display -> Ptr CInt -> Ptr CInt -> hunk ./Graphics/X11/Xlib/Misc.hsc 638 - setScreenSaver :: Display -> Int -> Int -> + setScreenSaver :: Display -> CInt -> CInt -> hunk ./Graphics/X11/Xlib/Misc.hsc 658 -getPointerControl :: Display -> IO (Int, Int, Int) +getPointerControl :: Display -> IO (CInt, CInt, CInt) hunk ./Graphics/X11/Xlib/Misc.hsc 661 - xGetPointerControl :: Display -> Ptr Int -> Ptr Int -> Ptr Int -> IO () + xGetPointerControl :: Display -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 702 - createPixmap :: Display -> Drawable -> Dimension -> Dimension -> Int -> IO Pixmap + createPixmap :: Display -> Drawable -> Dimension -> Dimension -> CInt -> IO Pixmap hunk ./Graphics/X11/Xlib/Misc.hsc 725 - bitmapUnit :: Display -> Int + bitmapUnit :: Display -> CInt hunk ./Graphics/X11/Xlib/Misc.hsc 729 - bitmapPad :: Display -> Int + bitmapPad :: Display -> CInt hunk ./Graphics/X11/Xlib/Misc.hsc 767 -displayKeycodes :: Display -> (Int,Int) +displayKeycodes :: Display -> (CInt,CInt) hunk ./Graphics/X11/Xlib/Misc.hsc 771 - xDisplayKeycodes :: Display -> Ptr Int -> Ptr Int -> IO () + xDisplayKeycodes :: Display -> Ptr CInt -> Ptr CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 775 - lookupKeysym :: XKeyEventPtr -> Int -> IO KeySym + lookupKeysym :: XKeyEventPtr -> CInt -> IO KeySym hunk ./Graphics/X11/Xlib/Misc.hsc 779 - keycodeToKeysym :: Display -> KeyCode -> Int -> IO KeySym + keycodeToKeysym :: Display -> KeyCode -> CInt -> IO KeySym hunk ./Graphics/X11/Xlib/Misc.hsc 819 - str <- peekCStringLen (buf, n) + str <- peekCStringLen (buf, fromIntegral n) hunk ./Graphics/X11/Xlib/Misc.hsc 823 - xLookupString :: XKeyEventPtr -> CString -> Int -> - Ptr KeySym -> Ptr XComposeStatus -> IO Int + xLookupString :: XKeyEventPtr -> CString -> CInt -> + Ptr KeySym -> Ptr XComposeStatus -> IO CInt hunk ./Graphics/X11/Xlib/Misc.hsc 929 - xSetWMProtocols display w protocol_array (length protocols) + xSetWMProtocols display w protocol_array (fromIntegral $ length protocols) hunk ./Graphics/X11/Xlib/Misc.hsc 931 - xSetWMProtocols :: Display -> Window -> Ptr Atom -> Int -> IO () + xSetWMProtocols :: Display -> Window -> Ptr Atom -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1001 - xDrawPoints display d gc point_array npoints mode + xDrawPoints display d gc point_array (fromIntegral npoints) mode hunk ./Graphics/X11/Xlib/Misc.hsc 1003 - xDrawPoints :: Display -> Drawable -> GC -> Ptr Point -> Int -> + xDrawPoints :: Display -> Drawable -> GC -> Ptr Point -> CInt -> hunk ./Graphics/X11/Xlib/Misc.hsc 1015 - xDrawLines display d gc point_array npoints mode + xDrawLines display d gc point_array (fromIntegral npoints) mode hunk ./Graphics/X11/Xlib/Misc.hsc 1017 - xDrawLines :: Display -> Drawable -> GC -> Ptr Point -> Int -> + xDrawLines :: Display -> Drawable -> GC -> Ptr Point -> CInt -> hunk ./Graphics/X11/Xlib/Misc.hsc 1024 - xDrawSegments display d gc segment_array nsegments + xDrawSegments display d gc segment_array (fromIntegral nsegments) hunk ./Graphics/X11/Xlib/Misc.hsc 1026 - xDrawSegments :: Display -> Drawable -> GC -> Ptr Segment -> Int -> IO () + xDrawSegments :: Display -> Drawable -> GC -> Ptr Segment -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1036 - xDrawRectangles display d gc rectangle_array nrectangles + xDrawRectangles display d gc rectangle_array (fromIntegral nrectangles) hunk ./Graphics/X11/Xlib/Misc.hsc 1038 - xDrawRectangles :: Display -> Drawable -> GC -> Ptr Rectangle -> Int -> IO () + xDrawRectangles :: Display -> Drawable -> GC -> Ptr Rectangle -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1049 - xDrawArcs display d gc arc_array narcs + xDrawArcs display d gc arc_array (fromIntegral narcs) hunk ./Graphics/X11/Xlib/Misc.hsc 1051 - xDrawArcs :: Display -> Drawable -> GC -> Ptr Arc -> Int -> IO () + xDrawArcs :: Display -> Drawable -> GC -> Ptr Arc -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1062 - xFillRectangles display d gc rectangle_array nrectangles + xFillRectangles display d gc rectangle_array (fromIntegral nrectangles) hunk ./Graphics/X11/Xlib/Misc.hsc 1064 - xFillRectangles :: Display -> Drawable -> GC -> Ptr Rectangle -> Int -> IO () + xFillRectangles :: Display -> Drawable -> GC -> Ptr Rectangle -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1070 - xFillPolygon display d gc point_array npoints shape mode + xFillPolygon display d gc point_array (fromIntegral npoints) shape mode hunk ./Graphics/X11/Xlib/Misc.hsc 1072 - xFillPolygon :: Display -> Drawable -> GC -> Ptr Point -> Int -> PolygonShape -> CoordinateMode -> IO () + xFillPolygon :: Display -> Drawable -> GC -> Ptr Point -> CInt -> PolygonShape -> CoordinateMode -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1083 - xFillArcs display d gc arc_array narcs + xFillArcs display d gc arc_array (fromIntegral narcs) hunk ./Graphics/X11/Xlib/Misc.hsc 1085 - xFillArcs :: Display -> Drawable -> GC -> Ptr Arc -> Int -> IO () + xFillArcs :: Display -> Drawable -> GC -> Ptr Arc -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1101 - xDrawString display d gc x y c_str len + xDrawString display d gc x y c_str (fromIntegral len) hunk ./Graphics/X11/Xlib/Misc.hsc 1103 - xDrawString :: Display -> Drawable -> GC -> Position -> Position -> CString -> Int -> IO () + xDrawString :: Display -> Drawable -> GC -> Position -> Position -> CString -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1111 - xDrawImageString display d gc x y c_str len + xDrawImageString display d gc x y c_str (fromIntegral len) hunk ./Graphics/X11/Xlib/Misc.hsc 1113 - xDrawImageString :: Display -> Drawable -> GC -> Position -> Position -> CString -> Int -> IO () + xDrawImageString :: Display -> Drawable -> GC -> Position -> Position -> CString -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1125 -storeBuffer :: Display -> String -> Int -> IO () +storeBuffer :: Display -> String -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1129 - xStoreBuffer display c_bytes nbytes buffer + xStoreBuffer display c_bytes (fromIntegral nbytes) buffer hunk ./Graphics/X11/Xlib/Misc.hsc 1131 - xStoreBuffer :: Display -> CString -> Int -> Int -> IO Status + xStoreBuffer :: Display -> CString -> CInt -> CInt -> IO Status hunk ./Graphics/X11/Xlib/Misc.hsc 1138 - xStoreBytes display c_bytes nbytes + xStoreBytes display c_bytes (fromIntegral nbytes) hunk ./Graphics/X11/Xlib/Misc.hsc 1140 - xStoreBytes :: Display -> CString -> Int -> IO Status + xStoreBytes :: Display -> CString -> CInt -> IO Status hunk ./Graphics/X11/Xlib/Misc.hsc 1143 -fetchBuffer :: Display -> Int -> IO String +fetchBuffer :: Display -> CInt -> IO String hunk ./Graphics/X11/Xlib/Misc.hsc 1149 - bytes <- peekCStringLen (c_bytes, nbytes) + bytes <- peekCStringLen (c_bytes, (fromIntegral nbytes)) hunk ./Graphics/X11/Xlib/Misc.hsc 1153 - xFetchBuffer :: Display -> Ptr Int -> Int -> IO CString + xFetchBuffer :: Display -> Ptr CInt -> CInt -> IO CString hunk ./Graphics/X11/Xlib/Misc.hsc 1162 - bytes <- peekCStringLen (c_bytes, nbytes) + bytes <- peekCStringLen (c_bytes, (fromIntegral nbytes)) hunk ./Graphics/X11/Xlib/Misc.hsc 1166 - xFetchBytes :: Display -> Ptr Int -> IO CString + xFetchBytes :: Display -> Ptr CInt -> IO CString hunk ./Graphics/X11/Xlib/Misc.hsc 1169 -rotateBuffers :: Display -> Int -> IO () +rotateBuffers :: Display -> CInt -> IO () hunk ./Graphics/X11/Xlib/Misc.hsc 1174 - xRotateBuffers :: Display -> Int -> IO Status + xRotateBuffers :: Display -> CInt -> IO Status hunk ./Graphics/X11/Xlib/Misc.hsc 1194 - #{poke XTextProperty,format} text_prop (8::Int) + #{poke XTextProperty,format} text_prop (8::CInt) hunk ./Graphics/X11/Xlib/Types.hsc 100 -type Angle = Int +type Angle = CInt hunk ./Graphics/X11/Xlib/Types.hsc 102 -type Buffer = Int +type Buffer = CInt hunk ./Graphics/X11/Xlib/Types.hsc 112 -peekPositionField :: Ptr a -> Int -> IO Position +peekPositionField :: Ptr a -> CInt -> IO Position hunk ./Graphics/X11/Xlib/Types.hsc 114 - v <- peekByteOff ptr off + v <- peekByteOff ptr (fromIntegral off) hunk ./Graphics/X11/Xlib/Types.hsc 117 -peekDimensionField :: Ptr a -> Int -> IO Dimension +peekDimensionField :: Ptr a -> CInt -> IO Dimension hunk ./Graphics/X11/Xlib/Types.hsc 119 - v <- peekByteOff ptr off + v <- peekByteOff ptr (fromIntegral off) hunk ./Graphics/X11/Xlib/Types.hsc 122 -peekAngleField :: Ptr a -> Int -> IO Angle +peekAngleField :: Ptr a -> CInt -> IO Angle hunk ./Graphics/X11/Xlib/Types.hsc 124 - v <- peekByteOff ptr off + v <- peekByteOff ptr (fromIntegral off) hunk ./Graphics/X11/Xlib/Types.hsc 127 -pokePositionField :: Ptr a -> Int -> Position -> IO () +pokePositionField :: Ptr a -> CInt -> Position -> IO () hunk ./Graphics/X11/Xlib/Types.hsc 129 - pokeByteOff ptr off (fromIntegral v::ShortPosition) + pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortPosition) hunk ./Graphics/X11/Xlib/Types.hsc 131 -pokeDimensionField :: Ptr a -> Int -> Dimension -> IO () +pokeDimensionField :: Ptr a -> CInt -> Dimension -> IO () hunk ./Graphics/X11/Xlib/Types.hsc 133 - pokeByteOff ptr off (fromIntegral v::ShortDimension) + pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortDimension) hunk ./Graphics/X11/Xlib/Types.hsc 135 -pokeAngleField :: Ptr a -> Int -> Angle -> IO () +pokeAngleField :: Ptr a -> CInt -> Angle -> IO () hunk ./Graphics/X11/Xlib/Types.hsc 137 - pokeByteOff ptr off (fromIntegral v::ShortAngle) + pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortAngle) hunk ./Graphics/X11/Xlib/Types.hsc 208 - deriving (Eq, Show, Typeable, Data) + deriving (Eq, Show, Typeable) hunk ./X11.buildinfo.in 5 -cc-options: @X_CFLAGS@ +cc-options: @X_CFLAGS@ @XSERVER64@ hunk ./configure.ac 47 + + AC_CHECK_SIZEOF([unsigned long]) + if test "$ac_cv_sizeof_unsigned_long" = 8; then + AC_SUBST(XSERVER64,["-D_XSERVER64"]) + fi }
Context:
[README about building from darcs Ross Paterson
**20070218110201] [Warning police: Remove redundant export/import sven.panne@aedion.de**20070106162533] [bump version to 1.2 (added thread-related functions) Simon Marlow **20070105153426] [XNextEvent should be *safe*, for correct behaviour with threads Simon Marlow **20070105152519] [add initThreads, lockDisplay, unlockDisplay (threads support) Simon Marlow **20070105152456] [also compile Graphics.X11 (it was missing) Simon Marlow **20070105151541] [make it work inplace Simon Marlow **20070105144721] [Extended the set of Xutil.h macros which should better be functions sven.panne@aedion.de**20061124175235] [Try to get a prototype (and not a macro) with recent X11 headers sven.panne@aedion.de**20061124174842] [undef XDestroyImage instead of defining XUTIL_DEFINE_FUNCTIONS Ross Paterson **20061108142602 Comment in the file: Xutil.h overrides some functions with macros. In recent versions of X this can be turned off with
#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 safe for functions with return type int.
] [re-export Graphics.X11.Xlib.Image Ross Paterson
**20061106085901] [haddock tweaks Ross Paterson **20061106085832] [Graphics.X11.Xlib.Image doesn't need hsc2hs or -fglasgow-exts Ross Paterson **20061106084512] [The X11 image functions should not be macros sven.panne@aedion.de**20061105112751] [add Graphics/X11/Xlib/Image.hsc mistakenly omitted from last patch Ross Paterson **20061103143538] [fill in Image routines in X11 (#982 from Frederik Eaton) Ross Paterson **20061103103559] [note CPP extension Ross Paterson **20060908233707] [includes -> install-includes Ross Paterson **20060829123744] [exclude Setup.hs even if not building package Ross Paterson **20060825222701] [increment version number Ross Paterson **20060825162304] [exclude Setup.hs from build Ross Paterson **20060824183533] [add boilerplate Setup.hs Ross Paterson **20060824115019] [add --enable/disable-x11 flag to configure Simon Marlow **20060316162346 submitted by Duncan Coutts. ] [TAG Initial conversion from CVS complete John Goerzen **20060112154138] Patch bundle hash: 98a709436f6d93642c27393c75780fba99bfb300
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

thedward@antejentacular.org writes:
Wed Mar 28 01:24:53 CDT 2007 thedward@antejentacular.org * (Graphics.X11) Updates for (better) 64-bit compatibility
Changing Int to CInt and building with -D_XSERVER64 (when appropriate)
I am not sure if defining _XSERVER64 is the right fix. The Xlib headers say that: /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ Apparently on the server, XID should be 32-bit but in client code it should be 64-bit (see, for example, http://lists.freedesktop.org/archives/xorg/2006-August/017515.html). This seems to cause a real problem in Xmonad, for example. If I have many windows open and start Xmonad, it scans for windows to manage via XQueryTree. I get the following list: [6291457,0,6291469,0,6291735,0,6291780,0,6292217,0,6292266] Each window has a 64-bit XID, but now the X11 bindings are processing them as an array of 32-bit numbers, so I lose half of my windows (and causes the list to be interspersed with zeroes; these are the upper 32 bits of each number).

Chris Mears
thedward@antejentacular.org writes:
Wed Mar 28 01:24:53 CDT 2007 thedward@antejentacular.org * (Graphics.X11) Updates for (better) 64-bit compatibility
Changing Int to CInt and building with -D_XSERVER64 (when appropriate)
I am not sure if defining _XSERVER64 is the right fix. The Xlib headers say that: [blah, blah]
An update: I turned off _XSERVER64 and my windows were properly managed again. However, an old bug returned: key modifiers are reported incorrectly. I have found the source of this error. The problem is that, in the KeyEvent data type, the "state" member has type "Mask" (64 bits). But in the C Xlib headers, the "state" member of the struct in unsigned int (32 bits)! This mucks everything up, in particular, the peek offsets. The fix is to use CUInt instead of Modifier or Mask for that value. I have hacked up a patch, but I will need to clean it up before posting it here. It requires changes to X11 and X11-extras. So, now Xmonad appears to behave correctly.

On Thu, Mar 29, 2007 at 06:35:48PM +1000, Chris Mears wrote:
I am not sure if defining _XSERVER64 is the right fix. The Xlib headers say that: [blah, blah]
You are absolutely correct. In retrospect, it seems more obvious.
An update: I turned off _XSERVER64 and my windows were properly managed again. However, an old bug returned: key modifiers are reported incorrectly. I have found the source of this error.
That is exactly the initial problem I was trying to solve.
The problem is that, in the KeyEvent data type, the "state" member has type "Mask" (64 bits). But in the C Xlib headers, the "state" member of the struct in unsigned int (32 bits)! This mucks everything up, in particular, the peek offsets.
The fix is to use CUInt instead of Modifier or Mask for that value. I have hacked up a patch, but I will need to clean it up before posting it here. It requires changes to X11 and X11-extras.
That was actually my first fix, but the other thing seemed more clever at the time. Please do send it to the list; The sooner that happens, the less likely people are to remember that my fixes caused additional problems. :)
So, now Xmonad appears to behave correctly.
Yay! It was working fine for me. Except for when I restarted it and
windows went missing, which I hadn't connected with my changes, as
I couldn't use it at all before I made them. :)
Thanks a bunch for digging into this some more.
This is why I love free software. I do a half-assed hack to make
something go, and then someone else comes along and fixes it to
make it work even better.
--
the Edward Blevins

Hello the, Thursday, March 29, 2007, 5:09:16 PM, you wrote:
This is why I love free software. I do a half-assed hack to make something go, and then someone else comes along and fixes it to make it work even better.
how the OSS hacker makes his new astonishing program: he opens project on sourceforge and waits for contributions :) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Thu, Mar 29, 2007 at 06:35:48PM +1000, Chris Mears wrote:
The problem is that, in the KeyEvent data type, the "state" member has type "Mask" (64 bits). But in the C Xlib headers, the "state" member of the struct in unsigned int (32 bits)! This mucks everything up, in particular, the peek offsets.
The fix is to use CUInt instead of Modifier or Mask for that value. I have hacked up a patch, but I will need to clean it up before posting it here. It requires changes to X11 and X11-extras.
Changing Modifier to be a CUInt works as well, and should require fewer
code changes. It also passes a cursory sanity check of where else Modifier
is used. That is, I checked what else used Modifier, and what the
appropriate type was on the C side. In all the cases I checked it was
unsigned integer.
This would also have the advantage of not requiring any changes to
X11-Extras and only a one line change to xmonad.
What do you think?
--
the Edward Blevins
participants (6)
-
Bulat Ziganshin
-
Chris Mears
-
dons@cse.unsw.edu.au
-
Simon Marlow
-
the Edward Blevins
-
thedward@antejentacular.org