CIrrDeviceWin32.cpp and CIrrDeviceLinux.cpp set the MouseInput.Shift and MouseInput.Control variables for a mouse event, but CIrrDeviceOSX.mm does not. This patch adds these assignments to postMouseEvent.
I can't test here, but sounds good to me. Just wondering if it really belongs outside the if/else part as the code in else doesn't seem to refer to event otherwise but creates an "ourEvent". Did you check if it works in both cases?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've tested it with Minetest on macOS 10.14, not sure if Window is NULL though.
Both parts set MouseInput.X and Y, so it looks like windowed mode / invisible (e.g. console application), the later retrives global display coordinates.
OK, thanks! I've looked at it some more and it should be fine. Added it in 1.8 branch in [r5869] and in trunk in [r5870].
Made a tiny change so it's only set when "post" is true as it's otherwise not used anyway.
Thought I'm not quite sure why it doesn't pass on negative coordinate values anyway (if I remember right other devices are also not unified yet in that regard).
Variable ievent in postMouseEvent should probably be const ref by now, but not going to change that without any OSX-user testing (I'm not familiar with objective-c myself).
I can't test here, but sounds good to me. Just wondering if it really belongs outside the if/else part as the code in else doesn't seem to refer to event otherwise but creates an "ourEvent". Did you check if it works in both cases?
I've tested it with Minetest on macOS 10.14, not sure if
Window
is NULL though.Both parts set MouseInput.X and Y, so it looks like windowed mode / invisible (e.g. console application), the later retrives global display coordinates.
https://developer.apple.com/documentation/coregraphics/1455788-cgeventgetlocation?language=objc
Last edit: Zero King 2019-10-05
So better to move it into first if? If you have a test-case, please check if that works, then I'll do that.
CGEventCreate(NULL) returns a new Quartz event using a default source, and CGEventGetLocation returns global display coordinates of the mouse.
So I think both cases are valid mouse events and the modifier key state should be applied to both of them.
I don't have a test case at hand, but the patch works well with Minetest.
OK, thanks! I've looked at it some more and it should be fine. Added it in 1.8 branch in [r5869] and in trunk in [r5870].
Made a tiny change so it's only set when "post" is true as it's otherwise not used anyway.
Thought I'm not quite sure why it doesn't pass on negative coordinate values anyway (if I remember right other devices are also not unified yet in that regard).
Variable ievent in postMouseEvent should probably be const ref by now, but not going to change that without any OSX-user testing (I'm not familiar with objective-c myself).
Related
Commit: [r5869]
Commit: [r5870]