Merge pull request #64 from bennofs/fix-63

fix #63: window jumping to origin position when dragging
This commit is contained in:
Brent Yorgey
2016-12-21 13:49:57 -05:00
committed by GitHub

View File

@@ -541,8 +541,11 @@ mouseMoveWindow w = whenX (isClient w) $ withDisplay $ \d -> do
(_, _, _, ox', oy', _, _, _) <- io $ queryPointer d w (_, _, _, ox', oy', _, _, _) <- io $ queryPointer d w
let ox = fromIntegral ox' let ox = fromIntegral ox'
oy = fromIntegral oy' oy = fromIntegral oy'
mouseDrag (\ex ey -> io $ moveWindow d w (fromIntegral (fromIntegral (wa_x wa) + (ex - ox))) mouseDrag (\ex ey -> do
(fromIntegral (fromIntegral (wa_y wa) + (ey - oy)))) io $ moveWindow d w (fromIntegral (fromIntegral (wa_x wa) + (ex - ox)))
(fromIntegral (fromIntegral (wa_y wa) + (ey - oy)))
float w
)
(float w) (float w)
-- | resize the window under the cursor with the mouse while it is dragged -- | resize the window under the cursor with the mouse while it is dragged
@@ -552,10 +555,12 @@ mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do
wa <- io $ getWindowAttributes d w wa <- io $ getWindowAttributes d w
sh <- io $ getWMNormalHints d w sh <- io $ getWMNormalHints d w
io $ warpPointer d none w 0 0 0 0 (fromIntegral (wa_width wa)) (fromIntegral (wa_height wa)) io $ warpPointer d none w 0 0 0 0 (fromIntegral (wa_width wa)) (fromIntegral (wa_height wa))
mouseDrag (\ex ey -> mouseDrag (\ex ey -> do
io $ resizeWindow d w `uncurry` io $ resizeWindow d w `uncurry`
applySizeHintsContents sh (ex - fromIntegral (wa_x wa), applySizeHintsContents sh (ex - fromIntegral (wa_x wa),
ey - fromIntegral (wa_y wa))) ey - fromIntegral (wa_y wa))
float w)
(float w) (float w)
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------