Skip to content

Commit

Permalink
Add “mouseDidOtherClick” and “mouseDidOtherDrag” for mouse tertiary c…
Browse files Browse the repository at this point in the history
…lick and drag events (#322)
  • Loading branch information
kasper committed Mar 24, 2023
1 parent 1fa7227 commit 276b38c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Release: dd.mm.yyyy

### API

#### Events

- New: Event `mouseDidOtherClick` is triggered when the mouse did tertiary click ([#322](https://github.com/kasper/phoenix/issues/322)).
- New: Event `mouseDidOtherDrag` is triggered when the mouse did tertiary drag ([#322](https://github.com/kasper/phoenix/issues/322)).

#### Window

- Change: Clarify function `screen()` can return `undefined` if a window is out of bounds of any screen ([#321](https://github.com/kasper/phoenix/issues/321)).
Expand Down
2 changes: 2 additions & 0 deletions Phoenix/PHEventConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ static NSString* const PHEventWillTerminateNotification = @"PHEventWillTerminate
static NSString* const PHMouseDidMoveNotification = @"PHMouseDidMoveNotification";
static NSString* const PHMouseDidLeftClickNotification = @"PHMouseDidLeftClickNotification";
static NSString* const PHMouseDidRightClickNotification = @"PHMouseDidRightClickNotification";
static NSString* const PHMouseDidOtherClickNotification = @"PHMouseDidOtherClickNotification";
static NSString* const PHMouseDidLeftDragNotification = @"PHMouseDidLeftDragNotification";
static NSString* const PHMouseDidRightDragNotification = @"PHMouseDidRightDragNotification";
static NSString* const PHMouseDidOtherDragNotification = @"PHMouseDidOtherDragNotification";
2 changes: 2 additions & 0 deletions Phoenix/PHEventTranslator.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ + (NSString *)notificationForEvent:(NSString *)event {
@"mouseDidMove": PHMouseDidMoveNotification,
@"mouseDidLeftClick": PHMouseDidLeftClickNotification,
@"mouseDidRightClick": PHMouseDidRightClickNotification,
@"mouseDidOtherClick": PHMouseDidOtherClickNotification,
@"mouseDidLeftDrag": PHMouseDidLeftDragNotification,
@"mouseDidRightDrag": PHMouseDidRightDragNotification,
@"mouseDidOtherDrag": PHMouseDidOtherDragNotification,

/* App Notifications */

Expand Down
8 changes: 6 additions & 2 deletions Phoenix/PHGlobalEventMonitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ - (void)dealloc {
@(NSEventMaskMouseMoved),
@(NSEventMaskLeftMouseUp),
@(NSEventMaskRightMouseUp),
@(NSEventMaskOtherMouseUp),
@(NSEventMaskLeftMouseDragged),
@(NSEventMaskRightMouseDragged)
@(NSEventMaskRightMouseDragged),
@(NSEventMaskOtherMouseDragged)
];
});

Expand All @@ -70,8 +72,10 @@ - (void)dealloc {
@(NSEventTypeMouseMoved): PHMouseDidMoveNotification,
@(NSEventTypeLeftMouseUp): PHMouseDidLeftClickNotification,
@(NSEventTypeRightMouseUp): PHMouseDidRightClickNotification,
@(NSEventTypeOtherMouseUp): PHMouseDidOtherClickNotification,
@(NSEventTypeLeftMouseDragged): PHMouseDidLeftDragNotification,
@(NSEventTypeRightMouseDragged): PHMouseDidRightDragNotification
@(NSEventTypeRightMouseDragged): PHMouseDidRightDragNotification,
@(NSEventTypeOtherMouseDragged): PHMouseDidOtherDragNotification
};
});

Expand Down
5 changes: 5 additions & 0 deletions docs/docs/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ All of the following mouse events receive the corresponding `Point` object as th
- `mouseDidLeftDrag` triggered when the mouse did left drag
- `mouseDidRightDrag` triggered when the mouse did right drag

### 4.0.0+

- `mouseDidOtherClick` triggered when the mouse did tertiary click
- `mouseDidOtherDrag` triggered when the mouse did tertiary drag

## App

All of the following app events receive the corresponding `App` instance as the first argument for the callback function.
Expand Down

0 comments on commit 276b38c

Please sign in to comment.