From 4688b4e20aba76e98a5c811d9ff550206a289877 Mon Sep 17 00:00:00 2001 From: Karsten Schoelzel Date: Wed, 5 Sep 2007 21:21:25 +0200 Subject: Move lower boundary check into applySizeHints, because all users of applySizeHints do this manually. darcs-hash:20070905192125-eb3a1-c008552fc3efe76c881502ebcc6b9832806d6399 --- Operations.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Operations.hs b/Operations.hs index ff6c19c..7611667 100644 --- a/Operations.hs +++ b/Operations.hs @@ -544,8 +544,8 @@ mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do io $ warpPointer d none w 0 0 0 0 (fromIntegral (wa_width wa)) (fromIntegral (wa_height wa)) mouseDrag (\ex ey -> do io $ resizeWindow d w `uncurry` - applySizeHints sh ((fromIntegral (max 1 (ex - fromIntegral (wa_x wa)))), - (fromIntegral (max 1 (ey - fromIntegral (wa_y wa)))))) + applySizeHints sh (ex - fromIntegral (wa_x wa), + ey - fromIntegral (wa_y wa))) (float w) -- --------------------------------------------------------------------- @@ -554,8 +554,12 @@ mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do type D = (Dimension, Dimension) -- | Reduce the dimensions if needed to comply to the given SizeHints. -applySizeHints :: SizeHints -> D -> D -applySizeHints sh = +applySizeHints :: Integral a => SizeHints -> (a,a) -> D +applySizeHints sh (w,h) = applySizeHints' sh (fromIntegral $ max 1 w, + fromIntegral $ max 1 h) + +applySizeHints' :: SizeHints -> D -> D +applySizeHints' sh = maybe id applyMaxSizeHint (sh_max_size sh) . maybe id (\(bw, bh) (w, h) -> (w+bw, h+bh)) (sh_base_size sh) . maybe id applyResizeIncHint (sh_resize_inc sh) -- cgit v1.2.3