mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-26 09:41:52 -07:00
Merge pull request #17 from kurnevsky/update_pointer_bugfix
UpdatePointer bugfix.
This commit is contained in:
@@ -67,6 +67,10 @@
|
|||||||
|
|
||||||
- Fix `raiseNextMaybe` cycling between 2 workspaces only.
|
- Fix `raiseNextMaybe` cycling between 2 workspaces only.
|
||||||
|
|
||||||
|
* `XMonad.Actions.UpdatePointer`
|
||||||
|
|
||||||
|
- Fix bug when cursor gets stuck in one of the corners.
|
||||||
|
|
||||||
|
|
||||||
## 0.12 (December 14, 2015)
|
## 0.12 (December 14, 2015)
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- |
|
-- |
|
||||||
-- Module : XMonadContrib.UpdatePointer
|
-- Module : XMonadContrib.UpdatePointer
|
||||||
-- Copyright : (c) Robert Marlow <robreim@bobturf.org>
|
-- Copyright : (c) Robert Marlow <robreim@bobturf.org>, 2015 Evgeny Kurnevsky
|
||||||
-- License : BSD3-style (see LICENSE)
|
-- License : BSD3-style (see LICENSE)
|
||||||
--
|
--
|
||||||
-- Maintainer : Robert Marlow <robreim@bobturf.org>
|
-- Maintainer : Robert Marlow <robreim@bobturf.org>
|
||||||
@@ -28,6 +29,7 @@ import Control.Arrow
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import XMonad.StackSet (member, peek, screenDetail, current)
|
import XMonad.StackSet (member, peek, screenDetail, current)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Control.Exception
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
||||||
@@ -63,9 +65,13 @@ updatePointer :: (Rational, Rational) -> (Rational, Rational) -> X ()
|
|||||||
updatePointer refPos ratio = do
|
updatePointer refPos ratio = do
|
||||||
ws <- gets windowset
|
ws <- gets windowset
|
||||||
dpy <- asks display
|
dpy <- asks display
|
||||||
|
let defaultRect = screenRect $ screenDetail $ current ws
|
||||||
rect <- case peek ws of
|
rect <- case peek ws of
|
||||||
Nothing -> return $ (screenRect . screenDetail .current) ws
|
Nothing -> return defaultRect
|
||||||
Just w -> windowAttributesToRectangle `fmap` io (getWindowAttributes dpy w)
|
Just w -> do tryAttributes <- io $ try $ getWindowAttributes dpy w
|
||||||
|
return $ case tryAttributes of
|
||||||
|
Left (_ :: SomeException) -> defaultRect
|
||||||
|
Right attributes -> windowAttributesToRectangle attributes
|
||||||
root <- asks theRoot
|
root <- asks theRoot
|
||||||
mouseIsMoving <- asks mouseFocused
|
mouseIsMoving <- asks mouseFocused
|
||||||
(_sameRoot,_,currentWindow,rootX,rootY,_,_,_) <- io $ queryPointer dpy root
|
(_sameRoot,_,currentWindow,rootX,rootY,_,_,_) <- io $ queryPointer dpy root
|
||||||
|
Reference in New Issue
Block a user