packages feed

fltkhs 0.5.3.5 → 0.5.3.6

raw patch · 5 files changed

+31/−11 lines, 5 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Graphics.UI.FLTK.LowLevel.FL: glVisual :: (Mode) -> IO ((Bool))
+ Graphics.UI.FLTK.LowLevel.FL: glVisualWithAlist :: (Mode) -> (Ptr CInt) -> IO ((Bool))
+ Graphics.UI.FLTK.LowLevel.FL: setUseHighResGL :: Bool -> IO ()
+ Graphics.UI.FLTK.LowLevel.FL: useHighResGL :: IO Bool
+ Graphics.UI.FLTK.LowLevel.Fl_Enumerations: ModeOpenGL3 :: Mode
+ Graphics.UI.FLTK.LowLevel.Utils: withText :: Text -> (CString -> IO a) -> IO a

Files

fltkhs.cabal view
@@ -1,5 +1,5 @@ name : fltkhs-version : 0.5.3.5+version : 0.5.3.6 synopsis : FLTK bindings description: Low level bindings for the FLTK GUI toolkit. For installation and quick start instruction please scroll all the way down to the README. license : MIT
src/Fluid/Generate.hs view
@@ -286,7 +286,7 @@                              (\(Shortcut s) ->                                  maybe                                  (shortcutCode  "Nothing")-                                 (\ks -> shortcutCode (show ks))+                                 (\ks -> shortcutCode ("Just (KeySequence (" ++ show ks ++ "))"))                                  (cIntToKeySequence ((read s) :: CInt)))                              (shortcutCode "Nothing")                              False
src/Graphics/UI/FLTK/LowLevel/Tree.chs view
@@ -63,21 +63,22 @@ {# fun Fl_Tree_show_self as showSelf' { id `Ptr ()' } -> `()' #} instance (impl ~ ( IO ()) ) => Op (ShowSelf ()) Tree orig impl where   runOp _ _ tree = withRef tree $ \treePtr -> showSelf' treePtr-{# fun Fl_Tree_root_label as rootLabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}+{# fun Fl_Tree_root_label as rootLabel' { id `Ptr ()',id `Ptr CChar' } -> `()' #} instance (impl ~ (T.Text ->  IO ()) ) => Op (RootLabel ()) Tree orig impl where-  runOp _ _ tree new_label = withRef tree $ \treePtr -> rootLabel' treePtr new_label+  runOp _ _ tree new_label = withRef tree $ \treePtr -> withText new_label (\new_labelPtr -> rootLabel' treePtr new_labelPtr) {# fun Fl_Tree_root as root' { id `Ptr ()' } -> `Ptr ()' id #} instance (impl ~ ( IO (Maybe (Ref TreeItem))) ) => Op (Root ()) Tree orig impl where   runOp _ _  tree = withRef tree $ \treePtr -> root' treePtr >>= toMaybeRef-{# fun Fl_Tree_add as add' { id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}-{# fun Fl_Tree_add_with_item_name as addWithItemName' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #}+{# fun Fl_Tree_add as add' { id `Ptr ()',id `Ptr CChar' } -> `Ptr ()' id #}+{# fun Fl_Tree_add_with_item_name as addWithItemName' { id `Ptr ()',id `Ptr ()', id `Ptr CChar' } -> `Ptr ()' id #} instance (impl ~ (T.Text ->  IO (Maybe (Ref TreeItem)))) => Op (Add ()) Tree orig impl where-  runOp _ _  tree path' = withRef tree $ \treePtr -> add' treePtr path' >>= toMaybeRef+  runOp _ _  tree path' = withRef tree $ \treePtr -> withText path' (\pathPtr' -> add' treePtr pathPtr' >>= toMaybeRef ) instance (Parent a TreeItem, impl ~ (T.Text -> Ref a -> IO (Maybe (Ref TreeItem)))) => Op (AddAt ()) Tree orig impl where   runOp _ _ tree path' item' =     withRef tree  $ \treePtr ->     withRef item' $ \itemPtr ->-    addWithItemName' treePtr itemPtr path' >>= toMaybeRef+    withText path' $ \pathPtr ->+    addWithItemName' treePtr itemPtr pathPtr >>= toMaybeRef {# fun Fl_Tree_insert_above as insertAbove' { id `Ptr ()',id `Ptr ()',unsafeToCString `T.Text' } -> `Ptr ()' id #} instance (Parent a TreeItem, impl ~ (Ref a -> T.Text ->  IO (Maybe (Ref a)))) => Op (InsertAbove ()) Tree orig impl where   runOp _ _  tree above name = withRef tree $ \treePtr -> withRef above $ \abovePtr -> insertAbove' treePtr abovePtr name >>= toMaybeRef
src/Graphics/UI/FLTK/LowLevel/TreeItem.chs view
@@ -81,9 +81,9 @@   runOp _ _ tree_item indent = case indent of     Just s' -> withRef tree_item $ \tree_itemPtr -> showSelfWithIndent' tree_itemPtr s'     Nothing -> withRef tree_item $ \tree_itemPtr -> showSelfWithIndent' tree_itemPtr ""-{# fun Fl_Tree_Item_set_label as setLabel' { id `Ptr ()',unsafeToCString `T.Text' } -> `()' #}+{# fun Fl_Tree_Item_set_label as setLabel' { id `Ptr ()',id `Ptr CChar ' } -> `()' #} instance (impl ~ ( T.Text ->  IO ())) => Op (SetLabel ()) TreeItem orig impl where-  runOp _ _ tree_item val = withRef tree_item $ \tree_itemPtr -> setLabel' tree_itemPtr val+  runOp _ _ tree_item val = withRef tree_item $ \tree_itemPtr -> withText val (\valPtr -> setLabel' tree_itemPtr valPtr) {# fun Fl_Tree_Item_label as label' { id `Ptr ()' } -> `T.Text' unsafeFromCString #} instance (impl ~ (IO T.Text)) => Op (GetLabel ()) TreeItem orig impl where   runOp _ _ tree_item = withRef tree_item $ \tree_itemPtr -> label' tree_itemPtr
src/Graphics/UI/FLTK/LowLevel/Utils.hs view
@@ -341,7 +341,23 @@      (\ptr -> f ptr width' height')  withStrings :: [T.Text] -> (Ptr (Ptr CChar) -> IO a) -> IO a-withStrings ss f = TF.withCStringLen (T.concat ss) (\(cstring,_) -> new cstring >>= f) -- withByteStrings (map C.pack ss) f+withStrings ss f = do+  copies <- mapM+             (+               \s ->+                 B.useAsCStringLen+                   (E.encodeUtf8 s)+                   (+                     \(ptr, len) -> do+                         arrPtr <- mallocArray len+                         copyArray arrPtr ptr len+                         return arrPtr+                   )+             )+             ss+  result <- allocaArray (length copies) f+  mapM_ free copies+  return result  copyByteStringToCString :: B.ByteString -> IO CString copyByteStringToCString bs =@@ -357,3 +373,6 @@   let bs = E.encodeUtf8 t   in     copyByteStringToCString bs++withText :: T.Text -> (CString -> IO a) -> IO a+withText t f = B.useAsCString (E.encodeUtf8 t) f