Commit 2e25ba48 authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

winemac.drv: Create a protocol to represent a cursor clipping handler.

parent 1c80eb5e
......@@ -67,8 +67,8 @@ enum {
@class WineEventQueue;
@class WineEventTapClipCursorHandler;
@class WineWindow;
@protocol WineClipCursorHandler;
@interface WineApplicationController : NSObject <NSApplicationDelegate>
......@@ -121,7 +121,7 @@ enum {
NSTimeInterval lastSetCursorPositionTime;
WineEventTapClipCursorHandler* clipCursorHandler;
id<WineClipCursorHandler> clipCursorHandler;
NSImage* applicationIcon;
......
......@@ -1148,10 +1148,13 @@ static NSString* WineLocalizedString(unsigned int stringID)
if ([windowsBeingDragged count])
ret = FALSE;
else if (self.clippingCursor)
else if (self.clippingCursor && [clipCursorHandler respondsToSelector:@selector(setCursorPosition:)])
ret = [clipCursorHandler setCursorPosition:pos];
else
{
if (self.clippingCursor)
[clipCursorHandler clipCursorLocation:&pos];
// Annoyingly, CGWarpMouseCursorPosition() effectively disassociates
// the mouse from the cursor position for 0.25 seconds. This means
// that mouse movement during that interval doesn't move the cursor
......
......@@ -21,15 +21,8 @@
#import <AppKit/AppKit.h>
@interface WineEventTapClipCursorHandler : NSObject
{
BOOL clippingCursor;
CGRect cursorClipRect;
CFMachPortRef cursorClippingEventTap;
NSMutableArray* warpRecords;
CGPoint synthesizedLocation;
NSTimeInterval lastEventTapEventTime;
}
@protocol WineClipCursorHandler <NSObject>
@property (readonly, nonatomic) BOOL clippingCursor;
@property (readonly, nonatomic) CGRect cursorClipRect;
......@@ -41,6 +34,24 @@
- (void) setRetinaMode:(int)mode;
@optional
/* If provided, should reposition the cursor as needed given the current
* clipping rect. If not provided, the location will be clipped by
* -clipCursorLocation, and the cursor will be warped normally.
*/
- (BOOL) setCursorPosition:(CGPoint)pos;
@end
@interface WineEventTapClipCursorHandler : NSObject <WineClipCursorHandler>
{
BOOL clippingCursor;
CGRect cursorClipRect;
CFMachPortRef cursorClippingEventTap;
NSMutableArray* warpRecords;
CGPoint synthesizedLocation;
NSTimeInterval lastEventTapEventTime;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment