Skip to content

Commit

Permalink
Add support for mouse drag events (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper committed Jan 7, 2017
1 parent b6ad515 commit ffcd01a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ All of the following mouse events receive the corresponding `Point`-object as th
- `mouseDidMove` triggered when the mouse has moved
- `mouseDidLeftClick` triggered when the mouse did left click
- `mouseDidRightClick` triggered when the mouse did right click
- `mouseDidLeftDrag` triggered when the mouse did left drag
- `mouseDidRightDrag` triggered when the mouse did right drag

### App

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Release: dd.mm.yyyy
### New

- Add “Edit configuration” status menu item ([#156](https://github.com/kasper/phoenix/pull/156)).
- Add support for mouse drag events ([#159](https://github.com/kasper/phoenix/issues/159)).

### API

#### Events

- New: Event `mouseDidLeftDrag` is triggered when the mouse did left drag ([#159](https://github.com/kasper/phoenix/issues/159)).
- New: Event `mouseDidRightDrag` is triggered when the mouse did right drag ([#159](https://github.com/kasper/phoenix/issues/159)).

2.4
---
Expand Down
2 changes: 2 additions & 0 deletions Phoenix/PHEventConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ static NSString * const PHEventWillTerminateNotification = @"PHEventWillTerminat
static NSString * const PHMouseDidMoveNotification = @"PHMouseDidMoveNotification";
static NSString * const PHMouseDidLeftClickNotification = @"PHMouseDidLeftClickNotification";
static NSString * const PHMouseDidRightClickNotification = @"PHMouseDidRightClickNotification";
static NSString * const PHMouseDidLeftDragNotification = @"PHMouseDidLeftDragNotification";
static NSString * const PHMouseDidRightDragNotification = @"PHMouseDidRightDragNotification";
2 changes: 2 additions & 0 deletions Phoenix/PHEventTranslator.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ + (NSString *) notificationForEvent:(NSString *)event {
@"mouseDidMove": PHMouseDidMoveNotification,
@"mouseDidLeftClick": PHMouseDidLeftClickNotification,
@"mouseDidRightClick": PHMouseDidRightClickNotification,
@"mouseDidLeftDrag": PHMouseDidLeftDragNotification,
@"mouseDidRightDrag": PHMouseDidRightDragNotification,

/* 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 @@ -53,7 +53,9 @@ - (void) dealloc {

masks = @[ @(NSMouseMovedMask),
@(NSLeftMouseUpMask),
@(NSRightMouseUpMask) ];
@(NSRightMouseUpMask),
@(NSLeftMouseDraggedMask),
@(NSRightMouseDraggedMask) ];
});

return masks;
Expand All @@ -70,7 +72,9 @@ - (void) dealloc {

notifications = @{ @(NSMouseMoved): PHMouseDidMoveNotification,
@(NSLeftMouseUp): PHMouseDidLeftClickNotification,
@(NSRightMouseUp): PHMouseDidRightClickNotification };
@(NSRightMouseUp): PHMouseDidRightClickNotification,
@(NSLeftMouseDragged): PHMouseDidLeftDragNotification,
@(NSRightMouseDragged): PHMouseDidRightDragNotification };
});

return notifications;
Expand Down

0 comments on commit ffcd01a

Please sign in to comment.