Menu

#321 Fix SEvent.MouseInput.Shift and Control on macOS

closed-accepted
None
5
2019-10-06
2019-10-05
Zero King
No

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.

1 Attachments

Discussion

  • Michael Zeilfelder

    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?

     
  • Zero King

    Zero King - 2019-10-05

    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
  • Michael Zeilfelder

    So better to move it into first if? If you have a test-case, please check if that works, then I'll do that.

     
  • Zero King

    Zero King - 2019-10-06

    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.

     
  • Michael Zeilfelder

    • status: open --> closed-accepted
    • assigned_to: Michael Zeilfelder
     
  • Michael Zeilfelder

    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).

     
    👍
    1

    Related

    Commit: [r5869]
    Commit: [r5870]


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.