module GI.Vte.Callbacks
(
SelectionFunc ,
SelectionFuncC ,
mkSelectionFunc ,
noSelectionFunc ,
selectionFuncClosure ,
selectionFuncWrapper ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Vte.Types
selectionFuncClosure :: SelectionFunc -> IO Closure
selectionFuncClosure cb = newCClosure =<< mkSelectionFunc wrapped
where wrapped = selectionFuncWrapper Nothing cb
type SelectionFuncC =
Ptr Terminal ->
Int64 ->
Int64 ->
Ptr () ->
IO CInt
foreign import ccall "wrapper"
mkSelectionFunc :: SelectionFuncC -> IO (FunPtr SelectionFuncC)
type SelectionFunc =
Terminal ->
Int64 ->
Int64 ->
IO Bool
noSelectionFunc :: Maybe SelectionFunc
noSelectionFunc = Nothing
selectionFuncWrapper ::
Maybe (Ptr (FunPtr (SelectionFuncC))) ->
SelectionFunc ->
Ptr Terminal ->
Int64 ->
Int64 ->
Ptr () ->
IO CInt
selectionFuncWrapper funptrptr _cb terminal column row _ = do
terminal' <- (newObject Terminal) terminal
result <- _cb terminal' column row
maybeReleaseFunPtr funptrptr
let result' = (fromIntegral . fromEnum) result
return result'