diff options
Diffstat (limited to 'src/Graphics/X11')
-rw-r--r-- | src/Graphics/X11/Extra.hs | 27 | ||||
-rw-r--r-- | src/Graphics/X11/Xlib/Atom/Extra.hs | 39 | ||||
-rw-r--r-- | src/Graphics/X11/Xlib/Display/Extra.hs | 20 | ||||
-rw-r--r-- | src/Graphics/X11/Xlib/Extra.hs | 7 |
4 files changed, 70 insertions, 23 deletions
diff --git a/src/Graphics/X11/Extra.hs b/src/Graphics/X11/Extra.hs index bed1ba3..ce4cb46 100644 --- a/src/Graphics/X11/Extra.hs +++ b/src/Graphics/X11/Extra.hs @@ -1,24 +1,5 @@ -module Graphics.X11.Extra where +module Graphics.X11.Extra + ( module Graphics.X11.Xlib.Extra + ) where -import Control.Exception (bracket) -import System.Environment (getEnv) -import System.IO.Unsafe (unsafePerformIO) -import qualified Graphics.X11 as X11 - - -unsafeInternAtom :: String -> Bool -> X11.Atom -unsafeInternAtom atomName onlyIfExists = - unsafePerformIO $ withDefaultDisplay $ \display -> - X11.internAtom display atomName onlyIfExists - -defaultDisplayName :: String -defaultDisplayName = - unsafePerformIO (getEnv "DISPLAY") - -withDisplay :: String -> (X11.Display -> IO a) -> IO a -withDisplay display = - bracket (X11.openDisplay display) X11.closeDisplay - -withDefaultDisplay :: (X11.Display -> IO a) -> IO a -withDefaultDisplay = - withDisplay defaultDisplayName +import Graphics.X11.Xlib.Extra diff --git a/src/Graphics/X11/Xlib/Atom/Extra.hs b/src/Graphics/X11/Xlib/Atom/Extra.hs new file mode 100644 index 0000000..8442c48 --- /dev/null +++ b/src/Graphics/X11/Xlib/Atom/Extra.hs @@ -0,0 +1,39 @@ +module Graphics.X11.Xlib.Atom.Extra where + +import Graphics.X11.Types (Atom) +import Graphics.X11.Xlib.Atom (internAtom) +import Graphics.X11.Xlib.Display.Extra (withDefaultDisplay) +import System.IO.Unsafe (unsafePerformIO) + + +unsafeInternAtom :: String -> Bool -> Atom +unsafeInternAtom atomName onlyIfExists = + unsafePerformIO $ withDefaultDisplay $ \display -> + internAtom display atomName onlyIfExists + +_NET_ACTIVE_WINDOW :: Atom +_NET_ACTIVE_WINDOW = unsafeInternAtom "_NET_ACTIVE_WINDOW" True + +_NET_CLIENT_LIST :: Atom +_NET_CLIENT_LIST = unsafeInternAtom "_NET_CLIENT_LIST" True + +_NET_CURRENT_DESKTOP :: Atom +_NET_CURRENT_DESKTOP = unsafeInternAtom "_NET_CURRENT_DESKTOP" True + +_NET_DESKTOP_NAMES :: Atom +_NET_DESKTOP_NAMES = unsafeInternAtom "_NET_DESKTOP_NAMES" True + +_NET_WM_DESKTOP :: Atom +_NET_WM_DESKTOP = unsafeInternAtom "_NET_WM_DESKTOP" True + +_NET_WM_NAME :: Atom +_NET_WM_NAME = unsafeInternAtom "_NET_WM_NAME" True + +_WIN_WORKSPACE :: Atom +_WIN_WORKSPACE = unsafeInternAtom "_WIN_WORKSPACE" True + +_WIN_WORKSPACE_NAMES :: Atom +_WIN_WORKSPACE_NAMES = unsafeInternAtom "_WIN_WORKSPACE_NAMES" True + +_WM_NAME :: Atom +_WM_NAME = unsafeInternAtom "WM_NAME" True diff --git a/src/Graphics/X11/Xlib/Display/Extra.hs b/src/Graphics/X11/Xlib/Display/Extra.hs new file mode 100644 index 0000000..16b1a74 --- /dev/null +++ b/src/Graphics/X11/Xlib/Display/Extra.hs @@ -0,0 +1,20 @@ +module Graphics.X11.Xlib.Display.Extra where + +import Control.Exception (bracket) +import System.Environment (getEnv) +import System.IO.Unsafe (unsafePerformIO) +import Graphics.X11.Xlib.Types (Display) +import Graphics.X11.Xlib.Display (closeDisplay, openDisplay) + + +defaultDisplayName :: String +defaultDisplayName = + unsafePerformIO (getEnv "DISPLAY") + +withDisplay :: String -> (Display -> IO a) -> IO a +withDisplay display = + bracket (openDisplay display) closeDisplay + +withDefaultDisplay :: (Display -> IO a) -> IO a +withDefaultDisplay = + withDisplay defaultDisplayName diff --git a/src/Graphics/X11/Xlib/Extra.hs b/src/Graphics/X11/Xlib/Extra.hs new file mode 100644 index 0000000..c2093ab --- /dev/null +++ b/src/Graphics/X11/Xlib/Extra.hs @@ -0,0 +1,7 @@ +module Graphics.X11.Xlib.Extra + ( module Graphics.X11.Xlib.Atom.Extra + , module Graphics.X11.Xlib.Display.Extra + ) where + +import Graphics.X11.Xlib.Atom.Extra +import Graphics.X11.Xlib.Display.Extra |