summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorKarsten Schoelzel <kuser@gmx.de>2007-09-05 21:21:25 +0200
committerKarsten Schoelzel <kuser@gmx.de>2007-09-05 21:21:25 +0200
commit4688b4e20aba76e98a5c811d9ff550206a289877 (patch)
tree6565360fdf32935596b26fc24cc9136fa98b4a1c /Operations.hs
parentb203d10fad2bd01b9ecfd2be61dfc04645e62c41 (diff)
downloadmetatile-4688b4e20aba76e98a5c811d9ff550206a289877.tar
metatile-4688b4e20aba76e98a5c811d9ff550206a289877.zip
Move lower boundary check into applySizeHints, because all users of applySizeHints
do this manually. darcs-hash:20070905192125-eb3a1-c008552fc3efe76c881502ebcc6b9832806d6399
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs12
1 files 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)