Clipboard 2.2.0.1 → 2.2.0.2
raw patch · 2 files changed
+34/−17 lines, 2 files
Files
- Clipboard.cabal +15/−14
- System/Clipboard.hs +19/−3
Clipboard.cabal view
@@ -1,11 +1,12 @@ Name: Clipboard -Version: 2.2.0.1 +Version: 2.2.0.2 Author: Sævar Berg, Daniel Díaz -Homepage: http://dhelta.net/hprojects/Clipboard +Homepage: http://haskell.org/haskellwiki/Clipboard License: BSD3 License-file: license -Maintainer: Daniel Diaz [danieldiaz `at` dhelta `dot` net] +Maintainer: Daniel Díaz [dhelta `dot` diaz `at` gmail `dot` com] Category: System +Stability: Stable Synopsis: System clipboard interface. Bug-reports: https://github.com/Daniel-Diaz/Clipboard/issues Description: @@ -14,22 +15,18 @@ . For example, if you type: . - > setClipboardString "Hello, World!" + > $ setClipboardString "Hello, World!" . - Then you have @\"Hello, World!\"@ available to be pasted where you want. + Then you have @\"Hello, World!\"@ available to be pasted wherever you want. . Now, if you type: . - > modifyClipboardString reverse + > $ modifyClipboardString reverse . You will have @\"!dlroW ,olleH\"@ in your clipboard. So: . - >>> getClipboardString - "!dlroW ,olleH" - . - Changes from last version: - . - * New documentation with examples. + > $ getClipboardString + > "!dlroW ,olleH" Build-type: Simple Cabal-version: >= 1.6 Extra-source-files: README.md @@ -40,5 +37,9 @@ Library Exposed-modules: System.Clipboard - Build-depends: base == 4.* - , Win32 == 2.2.*+ Extensions: CPP + if os(windows) + Build-depends: base == 4.* + , Win32 == 2.2.* + else + Build-depends: base == 4.*
System/Clipboard.hs view
@@ -1,16 +1,30 @@+ +{-# LANGUAGE CPP #-} + -- | System clipboard interface with unicode support. -- -- For more information, see "Graphics.Win32.GDI.Clip" -- or documentation for /GetClipboardData/ on MSDN. module System.Clipboard - ( -- * Clipboard interface + ( +#if defined(mingw32_HOST_OS) || defined(__MINGW32__) + -- * Clipboard interface setClipboardString - , getClipboardString + , getClipboardString , modifyClipboardString -- * Clipboard format , cF_UNICODETEXT +#else + -- * Undefined + + -- | This library currently only works in Windows. + -- If you want to contribute, please, don't hesitate + -- in visit the Git repository at <https://github.com/Daniel-Diaz/Clipboard>. +#endif ) where +#if defined(mingw32_HOST_OS) || defined(__MINGW32__) + import System.Win32.Mem (globalAlloc, globalLock, globalUnlock, copyMemory, gHND) import Graphics.Win32.GDI.Clip @@ -78,4 +92,6 @@ s <- getClipboardString case s of Nothing -> return False - Just sc -> setClipboardString (f sc) >> return True+ Just sc -> setClipboardString (f sc) >> return True + +#endif