diff options
author | Neil <nyamatongwe@gmail.com> | 2017-06-12 13:49:46 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-06-12 13:49:46 +1000 |
commit | c94124bb05c4386863c160bb44d5592ba4fe989e (patch) | |
tree | 5086197e32cbf91efb8edd7e87f16a7d99cfead7 /cocoa | |
parent | e015bc583b10e4f3a9889c9ae296de000d1d4646 (diff) | |
download | scintilla-mirror-c94124bb05c4386863c160bb44d5592ba4fe989e.tar.gz |
Backport: Simplify mouse and keyboard handling by only retaining the 'WithModifiers" form.
All events include a set of keyboard modifier flags.
Older calls that passed individual parameters for each key were removed.
Backport of changeset 6310:af83baede430.
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 9d08481bb..f663223da 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2412,7 +2412,9 @@ void ScintillaCocoa::MouseEntered(NSEvent* event) // Mouse location is given in screen coordinates and might also be outside of our bounds. Point location = ConvertPoint([event locationInWindow]); - ButtonMove(location); + ButtonMoveWithModifiers(location, + (int)([event timestamp] * 1000), + TranslateModifierFlags([event modifierFlags])); } } @@ -2428,23 +2430,17 @@ void ScintillaCocoa::MouseExited(NSEvent* /* event */) void ScintillaCocoa::MouseDown(NSEvent* event) { Point location = ConvertPoint([event locationInWindow]); - NSTimeInterval time = [event timestamp]; - bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; - bool shift = ([event modifierFlags] & NSShiftKeyMask) != 0; - bool alt = ([event modifierFlags] & NSAlternateKeyMask) != 0; - - ButtonDown(Point(location.x, location.y), (int) (time * 1000), shift, command, alt); + ButtonDownWithModifiers(location, + (int)([event timestamp] * 1000), + TranslateModifierFlags([event modifierFlags])); } void ScintillaCocoa::RightMouseDown(NSEvent *event) { Point location = ConvertPoint([event locationInWindow]); - NSTimeInterval time = [event timestamp]; - bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; - bool shift = ([event modifierFlags] & NSShiftKeyMask) != 0; - bool alt = ([event modifierFlags] & NSAlternateKeyMask) != 0; - - RightButtonDownWithModifiers(Point(location.x, location.y), (int) (time * 1000), ModifierFlags(shift, command, alt)); + RightButtonDownWithModifiers(location, + (int)([event timestamp] * 1000), + TranslateModifierFlags([event modifierFlags])); } //-------------------------------------------------------------------------------------------------- @@ -2453,17 +2449,16 @@ void ScintillaCocoa::MouseMove(NSEvent* event) { lastMouseEvent = event; - ButtonMoveWithModifiers(ConvertPoint([event locationInWindow]), TranslateModifierFlags([event modifierFlags])); + ButtonMoveWithModifiers(ConvertPoint([event locationInWindow]), (int)([event timestamp] * 1000), TranslateModifierFlags([event modifierFlags])); } //-------------------------------------------------------------------------------------------------- void ScintillaCocoa::MouseUp(NSEvent* event) { - NSTimeInterval time = [event timestamp]; - bool control = ([event modifierFlags] & NSControlKeyMask) != 0; - - ButtonUp(ConvertPoint([event locationInWindow]), (int) (time * 1000), control); + ButtonUpWithModifiers(ConvertPoint([event locationInWindow]), + (int)([event timestamp] * 1000), + TranslateModifierFlags([event modifierFlags])); } //-------------------------------------------------------------------------------------------------- @@ -2505,7 +2500,7 @@ void ScintillaCocoa::SelectAll() void ScintillaCocoa::DeleteBackward() { - KeyDown(SCK_BACK, false, false, false, nil); + KeyDownWithModifiers(SCK_BACK, 0, nil); } void ScintillaCocoa::Cut() |