[[project @ 2003-06-03 09:24:14 by reid] reid**20030603092414 Finished first draft of documentation ] { hunk ./doc/HSX11.sgml 188 - - - - - - - hunk ./doc/HSX11.sgml 211 - Haskell ... + We consistently raise exceptions when a function returns an error + code. In practice, this only affects the following functions + because most Xlib functions do not return error codes. + +allocColor +allocNamedColor +fetchBuffer +fetchBytes +fontFromGC +getGeometry +getIconName +iconifyWindow +loadQueryFont +lookupColor +openDisplay +parseColor +queryBestCursor +queryBestSize +queryBestStipple +queryBestTile +rotateBuffers +selectInput +storeBuffer +storeBytes +withdrawWindow + + The Xlib library reports most errors by invoking a user-provided + error handler. The function + +setDefaultErrorHandler :: IO () + +installs this error handler. + +int defaultErrorHandler(Display *d, XErrorEvent *ev) +{ + char buffer[1000]; + XGetErrorText(d,ev->error_code,buffer,1000); + printf("Error: %s\n", buffer); + return 0; +} + hunk ./doc/HSX11.sgml 259 - For example, the C function with type: + As an example of how these rules are applied in generating a + function type, the C function with type: hunk ./doc/HSX11.sgml 292 - +waitForEvent :: Display -> Word32 -> IO Bool + +reads an event with a timeout (in microseconds). +% +It is sometimes useful in conjunction with this function: + +gettimeofday_in_milliseconds :: IO Integer + hunk ./doc/HSX11.sgml 309 - +set_background_pixmap :: XSetWindowAttributesPtr -> Pixmap -> IO () +set_background_pixel :: XSetWindowAttributesPtr -> Pixel -> IO () +set_border_pixmap :: XSetWindowAttributesPtr -> Pixmap -> IO () +set_border_pixel :: XSetWindowAttributesPtr -> Pixel -> IO () +set_bit_gravity :: XSetWindowAttributesPtr -> BitGravity -> IO () +set_win_gravity :: XSetWindowAttributesPtr -> WindowGravity -> IO () +set_backing_store :: XSetWindowAttributesPtr -> BackingStore -> IO () +set_backing_planes :: XSetWindowAttributesPtr -> Pixel -> IO () +set_backing_pixel :: XSetWindowAttributesPtr -> Pixel -> IO () +set_save_under :: XSetWindowAttributesPtr -> Bool -> IO () +set_event_mask :: XSetWindowAttributesPtr -> EventMask -> IO () +set_do_not_propagate_mask :: XSetWindowAttributesPtr -> EventMask -> IO () +set_override_redirect :: XSetWindowAttributesPtr -> Bool -> IO () +set_colormap :: XSetWindowAttributesPtr -> Colormap -> IO () +set_cursor :: XSetWindowAttributesPtr -> Cursor -> IO () + hunk ./doc/HSX11.sgml 339 - - - - Example - }