winemac.drv: Create a protocol to represent a cursor clipping handler.
Signed-off-by: Tim Clem <tclem@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1c80eb5e5b
commit
2e25ba489a
|
@ -67,8 +67,8 @@
|
||||||
|
|
||||||
|
|
||||||
@class WineEventQueue;
|
@class WineEventQueue;
|
||||||
@class WineEventTapClipCursorHandler;
|
|
||||||
@class WineWindow;
|
@class WineWindow;
|
||||||
|
@protocol WineClipCursorHandler;
|
||||||
|
|
||||||
|
|
||||||
@interface WineApplicationController : NSObject <NSApplicationDelegate>
|
@interface WineApplicationController : NSObject <NSApplicationDelegate>
|
||||||
|
@ -121,7 +121,7 @@ @interface WineApplicationController : NSObject <NSApplicationDelegate>
|
||||||
|
|
||||||
NSTimeInterval lastSetCursorPositionTime;
|
NSTimeInterval lastSetCursorPositionTime;
|
||||||
|
|
||||||
WineEventTapClipCursorHandler* clipCursorHandler;
|
id<WineClipCursorHandler> clipCursorHandler;
|
||||||
|
|
||||||
NSImage* applicationIcon;
|
NSImage* applicationIcon;
|
||||||
|
|
||||||
|
|
|
@ -1148,10 +1148,13 @@ - (BOOL) setCursorPosition:(CGPoint)pos
|
||||||
|
|
||||||
if ([windowsBeingDragged count])
|
if ([windowsBeingDragged count])
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
else if (self.clippingCursor)
|
else if (self.clippingCursor && [clipCursorHandler respondsToSelector:@selector(setCursorPosition:)])
|
||||||
ret = [clipCursorHandler setCursorPosition:pos];
|
ret = [clipCursorHandler setCursorPosition:pos];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (self.clippingCursor)
|
||||||
|
[clipCursorHandler clipCursorLocation:&pos];
|
||||||
|
|
||||||
// Annoyingly, CGWarpMouseCursorPosition() effectively disassociates
|
// Annoyingly, CGWarpMouseCursorPosition() effectively disassociates
|
||||||
// the mouse from the cursor position for 0.25 seconds. This means
|
// the mouse from the cursor position for 0.25 seconds. This means
|
||||||
// that mouse movement during that interval doesn't move the cursor
|
// that mouse movement during that interval doesn't move the cursor
|
||||||
|
|
|
@ -21,15 +21,8 @@
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
@interface WineEventTapClipCursorHandler : NSObject
|
|
||||||
{
|
@protocol WineClipCursorHandler <NSObject>
|
||||||
BOOL clippingCursor;
|
|
||||||
CGRect cursorClipRect;
|
|
||||||
CFMachPortRef cursorClippingEventTap;
|
|
||||||
NSMutableArray* warpRecords;
|
|
||||||
CGPoint synthesizedLocation;
|
|
||||||
NSTimeInterval lastEventTapEventTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (readonly, nonatomic) BOOL clippingCursor;
|
@property (readonly, nonatomic) BOOL clippingCursor;
|
||||||
@property (readonly, nonatomic) CGRect cursorClipRect;
|
@property (readonly, nonatomic) CGRect cursorClipRect;
|
||||||
|
@ -41,6 +34,24 @@ - (void) clipCursorLocation:(CGPoint*)location;
|
||||||
|
|
||||||
- (void) setRetinaMode:(int)mode;
|
- (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;
|
- (BOOL) setCursorPosition:(CGPoint)pos;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface WineEventTapClipCursorHandler : NSObject <WineClipCursorHandler>
|
||||||
|
{
|
||||||
|
BOOL clippingCursor;
|
||||||
|
CGRect cursorClipRect;
|
||||||
|
CFMachPortRef cursorClippingEventTap;
|
||||||
|
NSMutableArray* warpRecords;
|
||||||
|
CGPoint synthesizedLocation;
|
||||||
|
NSTimeInterval lastEventTapEventTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in New Issue