Tue Jan 6 22:09:56 EST 2009 Peter Gavin <pg...@gm...>
* gtk: make NativeWindowId a newtype; under Win32 it's a pointer, not an integer
hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 103
- (fromIntegral (fromMaybe 0 socketId))
+ (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))
hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 115
- liftM fromIntegral $
+ liftM toNativeWindowId $
hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 158
- (fromIntegral windowId)
+ (fromNativeWindowId windowId)
hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 169
- liftM fromIntegral $
+ liftM toNativeWindowId $
hunk ./gtk/Graphics/UI/Gtk/Gdk/DrawWindow.chs.pp 526
- liftM castPtr $ {#call gdk_window_foreign_new#} (fromIntegral anid)
+ liftM castPtr $ {#call gdk_window_foreign_new#} (fromNativeWindowId anid)
hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 51
+ toNativeWindowId,
+ fromNativeWindowId,
+ nativeWindowIdNone,
hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 570
-type NativeWindowId = #type GdkNativeWindow
+#ifdef GDK_NATIVE_WINDOW_POINTER
+newtype NativeWindowId = NativeWindowId (Ptr ()) deriving (Eq, Show)
+unNativeWindowId :: NativeWindowId -> Ptr a
+unNativeWindowId (NativeWindowId id) = castPtr id
+toNativeWindowId :: Ptr a -> NativeWindowId
+toNativeWindowId = NativeWindowId . castPtr
+fromNativeWindowId :: NativeWindowId -> Ptr a
+fromNativeWindowId = castPtr . unNativeWindowId
+nativeWindowIdNone :: NativeWindowId
+nativeWindowIdNone = NativeWindowId nullPtr
+#else
+newtype NativeWindowId = NativeWindowId #{type GdkNativeWindow} deriving (Eq, Show)
+unNativeWindowId :: Integral a => NativeWindowId -> a
+unNativeWindowId (NativeWindowId id) = fromIntegral id
+toNativeWindowId :: Integral a => a -> NativeWindowId
+toNativeWindowId = NativeWindowId . fromIntegral
+fromNativeWindowId :: Integral a => NativeWindowId -> a
+fromNativeWindowId = fromIntegral . unNativeWindowId
+nativeWindowIdNone :: NativeWindowId
+nativeWindowIdNone = NativeWindowId 0
+#endif
|