
On Fri, Feb 08, 2008 at 09:47:02PM +0100, Andrea Rossato wrote:
Fri Feb 8 21:41:20 CET 2008 Andrea Rossato
* Decoration: fix mouse dragging jump ...
please forget this one. see below.
+ decoEventHook _ (DS dwrs@(((_,r),(dw, Just dr)):_) _) ButtonEvent { ev_window = ew + , ev_event_type = ty + , ev_x = ex } + | ty == buttonPress + , dw == ew = mouseDrag (\x y -> do + let rect = Rectangle (x - fi ex) (y - rect_y dr + rect_y r) + (rect_width r) (rect_height r) + sendMessage (SetGeometry rect)) (return ())
can you please check if the reasoning is fine? 1. I have 1 point (pointer even: px,py) relative to the (absolute) decoration window's origin (dx,dy) 2. the absolute coordinates of the pointer events are: (dx + px), (dy + py) 3. the distance of the pointer event from the decorated window's origin (wx,wy) is: (dx + px) - wx, (dy + py) -wy 4. when I start grabbing I get the absolute position of the pointer (ex,ey), and so I need to subtract the above distance to set the new decorated window's origin like this: ex - (dx + px - wx), ey - (dy + py - wy) This seems to be working fine (I'm going to push within a couple of hours, but if you find a mistake please drop me a line - here or on IRC). Sorry for this noise but I find this a quite subtle issue if you are not that used to this kind of stuff... high school memories here... ;) Andrea ps: I'm going to write a small DecorationMadness module for storing, well... you'll see!