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 | 1995e565ce6566fced7a383d8114319da57974d5 (patch) | |
| tree | abd53d2e1d51cabb86852e9999822e7957b3fce2 /cocoa | |
| parent | e57183504381c137e851265b0083c429ac65246f (diff) | |
| download | scintilla-mirror-1995e565ce6566fced7a383d8114319da57974d5.tar.gz | |
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.
Diffstat (limited to 'cocoa')
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index a9283686d..c849b39a1 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2262,7 +2262,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)); } } @@ -2276,22 +2278,16 @@ 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)); } //-------------------------------------------------------------------------------------------------- @@ -2299,16 +2295,17 @@ void ScintillaCocoa::RightMouseDown(NSEvent *event) { 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)); } //-------------------------------------------------------------------------------------------------- @@ -2344,7 +2341,7 @@ void ScintillaCocoa::SelectAll() { } void ScintillaCocoa::DeleteBackward() { - KeyDown(SCK_BACK, false, false, false, nil); + KeyDownWithModifiers(SCK_BACK, 0, nil); } void ScintillaCocoa::Cut() { |
