old_contents:
{-# LANGUAGE CPP, FlexibleContexts #-}

module Graphics.UI.FLTK.LowLevel.X (flcOpenDisplay, flcXid, openCallback) where
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
import Graphics.UI.FLTK.LowLevel.Utils
import Foreign.Ptr
import qualified Data.Text as T
#include "Fl_C.h"
#include "xC.h"

{# fun flc_open_display as flcOpenDisplay {} -> `()' #}

{# fun flc_xid as flcXid' {`Ptr ()'} -> `Ptr ()' #}
flcXid :: (Parent a WindowBase) => Ref a -> IO (Maybe WindowHandle)
flcXid win =
  withRef
    win
    (
      \winPtr -> do
         res <- flcXid' winPtr
         if (res == nullPtr)
         then return Nothing
         else return (Just (WindowHandle res))
    )

{# fun flc_open_callback as openCallback' { id `FunPtr OpenCallbackPrim' } -> `()' #}

openCallback :: Maybe OpenCallback -> IO ()
openCallback Nothing   = openCallback' nullFunPtr
openCallback (Just cb) = do
  ptr <- mkOpenCallbackPtr $ \cstr -> do
    txt <- cStringToText cstr
    cb txt
  openCallback' ptr

new_contents:
{-# LANGUAGE CPP, FlexibleContexts #-}

module Graphics.UI.FLTK.LowLevel.X (flcOpenDisplay, flcXid, openCallback) where
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
import Graphics.UI.FLTK.LowLevel.Utils
import Foreign.Ptr
#include "Fl_C.h"
#include "xC.h"

{# fun flc_open_display as flcOpenDisplay {} -> `()' #}

{# fun flc_xid as flcXid' {`Ptr ()'} -> `Ptr ()' #}
flcXid :: (Parent a WindowBase) => Ref a -> IO (Maybe WindowHandle)
flcXid win =
  withRef
    win
    (
      \winPtr -> do
         res <- flcXid' winPtr
         if (res == nullPtr)
         then return Nothing
         else return (Just (WindowHandle res))
    )

{# fun flc_open_callback as openCallback' { id `FunPtr OpenCallbackPrim' } -> `()' #}

openCallback :: Maybe OpenCallback -> IO (Maybe (FunPtr OpenCallbackPrim))
openCallback Nothing   = openCallback' nullFunPtr >> return Nothing
openCallback (Just cb) = do
  ptr <- mkOpenCallbackPtr $ \cstr -> do
    txt <- cStringToText cstr
    cb txt
  openCallback' ptr
  return (Just ptr)

subject: Return the open callback function pointer so it can be freed on the Haskell side.

license: mit

repos: deech/fltkhs,deech/fltkhs,deech/fltkhs


old_contents:
module Graphics.UI.Gtk.WebKit.DOM.StorageInfo
       (cTEMPORARY, cPERSISTENT, StorageInfo, StorageInfoClass,
        castToStorageInfo, gTypeStorageInfo, toStorageInfo)
       where
import System.Glib.FFI
import System.Glib.UTFString
import Control.Applicative
{#import Graphics.UI.Gtk.WebKit.Types#}
import System.Glib.GError
import Graphics.UI.Gtk.WebKit.DOM.EventM
cTEMPORARY = 0
cPERSISTENT = 1

new_contents:
module Graphics.UI.Gtk.WebKit.DOM.StorageInfo
       (
#if WEBKIT_CHECK_VERSION(1,10,0)
        cTEMPORARY, cPERSISTENT, StorageInfo, StorageInfoClass,
        castToStorageInfo, gTypeStorageInfo, toStorageInfo
#endif
       ) where
import System.Glib.FFI
import System.Glib.UTFString
import Control.Applicative
{#import Graphics.UI.Gtk.WebKit.Types#}
import System.Glib.GError
import Graphics.UI.Gtk.WebKit.DOM.EventM
cTEMPORARY = 0
cPERSISTENT = 1

subject: Fix for older versions of webkit

message: Fix for older versions of webkit