Add skeletal implementation of NSGestureRecognizer#364
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements skeletal implementations of several NSGestureRecognizer subclasses and enhances NSEvent to support magnification gestures. The implementation provides a comprehensive gesture recognition framework with concrete recognizers for common gesture types.
- Implements NSGestureRecognizer base class with state management, target-action patterns, and delegate support
- Adds concrete gesture recognizers for click, pan, press, rotation, and magnification gestures with complete event handling
- Extends NSEvent to support magnification properties for enhanced gesture recognition capabilities
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| NSGestureRecognizer.m | Core gesture recognizer base class implementation with state management and event handling |
| NSClickGestureRecognizer.m | Click gesture recognizer with button mask and multi-click support |
| NSPanGestureRecognizer.m | Pan gesture recognizer with translation/velocity tracking and multi-button support |
| NSPressGestureRecognizer.m | Press-and-hold gesture recognizer with timer-based duration validation |
| NSRotationGestureRecognizer.m | Rotation gesture recognizer supporting both mouse and scroll wheel input |
| NSMagnificationGestureRecognizer.m | Magnification gesture recognizer for zoom operations |
| NSEvent.m | Enhanced mouse event creation and serialization to support magnification data |
| Headers/AppKit/*.h | Updated header files with comprehensive documentation and API definitions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…gui into NSGestureRecognizer_branch
|
I think this PR is ready as well, @fredkiefer / @rfm |
| case NSOtherMouseDragged: | ||
| case NSRightMouseDragged: | ||
| [aDecoder decodeValuesOfObjCTypes: "iififff", | ||
| [aDecoder decodeValuesOfObjCTypes: "iififfff", |
There was a problem hiding this comment.
You should not change the encoding/decoding without changing the version number and checking on the version when decoding.
| deltaY: (CGFloat)deltaY | ||
| deltaZ: (CGFloat)deltaZ; | ||
| deltaZ: (CGFloat)deltaZ | ||
| magnification: (CGFloat)magnificationValue; |
There was a problem hiding this comment.
If I remember correctly we actually use this method in the MS Windows backend. Changing it here without a change there will break things. The best way to process would be to add a new method here with the additional argument, add that argument to all the backend code that uses the old method and after the next GNUstep release, remove the old method without that argument.
| */ | ||
|
|
||
| #import <AppKit/NSGestureRecognizer.h> | ||
| #import <AppKit/NSEvent.h> |
There was a problem hiding this comment.
Normally we would include the AppKit headers here with "" instead of <>. This allows local headers to be found before installed ones and could make a difference when headers change.
| if (_state == state) | ||
| return; | ||
|
|
||
| NSGestureRecognizerState oldState = _state; |
There was a problem hiding this comment.
Why store the old state when nothing gets done with it?
Implement Gesture recognition logic