Fix global/local coordinates issue.

Hello, 

Thanks for the fix (and the quick reply), it worked well for most cases, but we found an issue when the left side of the window  is out of the screen (the coordinates become negative). The issue was due to local vs global coordinates, here's a patch that fixes it on our end, if you want to have a look.

Best regards,
Francois.