ui/cocoa: Fix handling of absolute positioning devices
commitf61c387ea627079b33a635f5d203a2c2bccc86c6
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 23 Jun 2014 09:35:24 +0000 (23 10:35 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Sun, 29 Jun 2014 21:00:33 +0000 (29 22:00 +0100)
tree55bc325aca861e975c9e8bbe30abefc30d422700
parent5dd45bee5816ef1e941fdf1122943e4ab345f388
ui/cocoa: Fix handling of absolute positioning devices

Fix handling of absolute positioning devices, which were basically
unusable for two separate reasons:
 (1) as soon as you pressed the left mouse button we would call
     CGAssociateMouseAndMouseCursorPosition(FALSE), which means that
     the absolute coordinates of the mouse events are never updated
 (2) we didn't account for MacOSX coordinate origin being bottom left
     rather than top right, and so all the Y values sent to the guest
     were inverted

We fix (1) by aligning our behaviour with the SDL UI backend for
absolute devices:
 * when the mouse moves into the window we do a grab (which means
   hiding the host cursor and sending special keys to the guest)
 * when the mouse moves out of the window we un-grab
and fix (2) by doing the correct transformation in the call to
qemu_input_queue_abs().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1403516125-14568-4-git-send-email-peter.maydell@linaro.org
ui/cocoa.m