packages feed

xmonad-utils 0.1.3 → 0.1.3.1

raw patch · 2 files changed

+55/−1 lines, 2 files

Files

+ src/Utils.hs view
@@ -0,0 +1,51 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Utils+-- Copyright   :  (c) Andrea Rossato+-- License     :  BSD3+-- +-- Maintainer  :  Andrea Rossato <andrea.rossato@unibz.it>+-- Stability   :  unstable+-- Portability :  unportable+--+--  Utilities for xmonad-utils+--+-----------------------------------------------------------------------------++module Utils where++import Control.Concurrent+import Control.Monad+import Graphics.X11.Xlib+import System.Posix.Types (Fd(..))++-- creates an invisible cursor+nullCursor :: Display -> Window -> IO Cursor+nullCursor d w = do+  let c = Color 0 0 0 0 0+  p <- createPixmap d w 1 1 1+  cursor <- createPixmapCursor d p p c c 0 0+  freePixmap d p+  return cursor++initColor :: Display -> String -> IO Pixel+initColor dpy color = do+  let colormap = defaultColormap dpy (defaultScreen dpy)+  (apros,_) <- allocNamedColor dpy colormap color+  return $ color_pixel apros++waitASecond :: Int -> IO ()+waitASecond i =+    threadDelay (i*1000000)++-- A version of maskEvent that does not block in foreign calls.+maskEvent' :: Display -> EventMask -> XEventPtr -> IO ()+maskEvent' d m p = do+  pend <- pending d+  if pend /= 0+     then maskEvent d m p+     else do+       threadWaitRead (Fd fd)+       maskEvent' d m p+ where+   fd = connectionNumber d
xmonad-utils.cabal view
@@ -1,5 +1,5 @@ Name:               xmonad-utils-Version:            0.1.3+Version:            0.1.3.1 License:            BSD3 License-file:       LICENSE Author:             Andrea Rossato@@ -26,6 +26,7 @@ Cabal-version:      >=1.6 tested-with:        GHC==7.4.2 + Executable hxsel   Build-depends:      base<5, X11>=1.3, ghc>=6.8, unix, random>=1.0   Main-is:            Hxsel.hs@@ -43,6 +44,7 @@ Executable hslock   Build-depends:      base<5, X11>=1.3, ghc>=6.8, unix, random>=1.0   Main-is:            Hslock.hs+  Other-Modules:      Utils   extensions:         ForeignFunctionInterface   hs-source-dirs:     src   extra-libraries:    crypt@@ -59,6 +61,7 @@ Executable hhp   Build-depends:      base<5, X11>=1.3, ghc>=6.8, unix, random>=1.0   Main-is:            Hhp.hs+  Other-Modules:      Utils   hs-source-dirs:     src   ghc-options:        -funbox-strict-fields -Wall   ghc-prof-options:   -prof -auto-all