diff --git a/XMonad/Util/PositionStore.hs b/XMonad/Util/PositionStore.hs index f9f51e82..c9056e36 100644 --- a/XMonad/Util/PositionStore.hs +++ b/XMonad/Util/PositionStore.hs @@ -35,7 +35,7 @@ import qualified Data.Map as M newtype PositionStore = PS (M.Map Window PosStoreRectangle) deriving (Read,Show) -data PosStoreRectangle = PSRectangle Double Double Double Double +data PosStoreRectangle = PSRectangle Double Double Dimension Dimension deriving (Read,Show) instance ExtensionClass PositionStore where @@ -54,8 +54,7 @@ posStoreInsert (PS posStoreMap) w (Rectangle x y wh ht) (Rectangle srX srY srWh offsetY = y - srY in PS $ M.insert w (PSRectangle (fromIntegral offsetX / fromIntegral srWh) (fromIntegral offsetY / fromIntegral srHt) - (fromIntegral wh / fromIntegral srWh) - (fromIntegral ht / fromIntegral srHt)) posStoreMap + (min wh srWh) (min ht srHt)) posStoreMap posStoreRemove :: PositionStore -> Window -> PositionStore posStoreRemove (PS posStoreMap) w = PS $ M.delete w posStoreMap @@ -63,12 +62,9 @@ posStoreRemove (PS posStoreMap) w = PS $ M.delete w posStoreMap posStoreQuery :: PositionStore -> Window -> Rectangle -> Maybe Rectangle posStoreQuery (PS posStoreMap) w (Rectangle srX srY srWh srHt) = do (PSRectangle x y wh ht) <- M.lookup w posStoreMap - let realWh = fromIntegral srWh * wh - realHt = fromIntegral srHt * ht - realOffsetX = fromIntegral srWh * x + let realOffsetX = fromIntegral srWh * x realOffsetY = fromIntegral srHt * y - return (Rectangle (srX + round realOffsetX) (srY + round realOffsetY) - (round realWh) (round realHt)) + return (Rectangle (srX + round realOffsetX) (srY + round realOffsetY) wh ht) posStoreMove :: PositionStore -> Window -> Position -> Position -> Rectangle -> Rectangle -> PositionStore posStoreMove posStore w x y oldSr newSr =