Commit 9b0fdc64 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Implement ClipCursor().

parent 5c933c89
......@@ -59,7 +59,13 @@
NSTimer* cursorTimer;
BOOL cursorHidden;
BOOL clippingCursor;
CGRect cursorClipRect;
CFMachPortRef cursorClippingEventTap;
NSMutableArray* warpRecords;
CGPoint synthesizedLocation;
NSTimeInterval lastSetCursorPositionTime;
NSTimeInterval lastEventTapEventTime;
}
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
......@@ -79,6 +85,8 @@
- (void) keyboardSelectionDidChange;
- (void) flipRect:(NSRect*)rect;
- (void) wineWindow:(WineWindow*)window
ordered:(NSWindowOrderingMode)order
relativeTo:(WineWindow*)otherWindow;
......
......@@ -144,8 +144,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
@property (readwrite, nonatomic) NSInteger levelWhenActive;
+ (void) flipRect:(NSRect*)rect;
@end
......@@ -255,7 +253,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
WineContentView* contentView;
NSTrackingArea* trackingArea;
[self flipRect:&window_frame];
[NSApp flipRect:&window_frame];
window = [[[self alloc] initWithContentRect:window_frame
styleMask:style_mask_for_features(wf)
......@@ -309,11 +307,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[super dealloc];
}
+ (void) flipRect:(NSRect*)rect
{
rect->origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(*rect);
}
- (void) adjustFeaturesForState
{
NSUInteger style = normalStyleMask;
......@@ -524,7 +517,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
/* Origin is (left, top) in a top-down space. Need to convert it to
(left, bottom) in a bottom-up space. */
[[self class] flipRect:&contentRect];
[NSApp flipRect:&contentRect];
if (on_screen)
{
......@@ -1094,7 +1087,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
macdrv_event event;
NSRect frame = [self contentRectForFrameRect:[self frame]];
[[self class] flipRect:&frame];
[NSApp flipRect:&frame];
/* Coalesce events by discarding any previous ones still in the queue. */
[queue discardEventsMatchingMask:event_mask_for_type(WINDOW_FRAME_CHANGED)
......@@ -1314,7 +1307,7 @@ void macdrv_get_cocoa_window_frame(macdrv_window w, CGRect* out_frame)
NSRect frame;
frame = [window contentRectForFrameRect:[window frame]];
[[window class] flipRect:&frame];
[NSApp flipRect:&frame];
*out_frame = NSRectToCGRect(frame);
});
}
......
......@@ -122,6 +122,7 @@ extern void macdrv_beep(void) DECLSPEC_HIDDEN;
extern void macdrv_set_cursor(CFStringRef name, CFArrayRef frames) DECLSPEC_HIDDEN;
extern int macdrv_get_cursor_position(CGPoint *pos) DECLSPEC_HIDDEN;
extern int macdrv_set_cursor_position(CGPoint pos) DECLSPEC_HIDDEN;
extern int macdrv_clip_cursor(CGRect rect) DECLSPEC_HIDDEN;
/* display */
......
......@@ -736,6 +736,32 @@ void CDECL macdrv_DestroyCursorIcon(HCURSOR cursor)
/***********************************************************************
* ClipCursor (MACDRV.@)
*
* Set the cursor clipping rectangle.
*/
BOOL CDECL macdrv_ClipCursor(LPCRECT clip)
{
CGRect rect;
TRACE("%s\n", wine_dbgstr_rect(clip));
if (clip)
{
rect = CGRectMake(clip->left, clip->top, max(1, clip->right - clip->left),
max(1, clip->bottom - clip->top));
}
else
rect = CGRectInfinite;
/* FIXME: This needs to be done not just in this process but in all of the
ones for this WINEPREFIX. Broadcast a message to do that. */
return macdrv_clip_cursor(rect);
}
/***********************************************************************
* GetCursorPos (MACDRV.@)
*/
BOOL CDECL macdrv_GetCursorPos(LPPOINT pos)
......
......@@ -7,6 +7,7 @@
@ cdecl ActivateKeyboardLayout(long long) macdrv_ActivateKeyboardLayout
@ cdecl Beep() macdrv_Beep
@ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) macdrv_ChangeDisplaySettingsEx
@ cdecl ClipCursor(ptr) macdrv_ClipCursor
@ cdecl CreateDesktopWindow(long) macdrv_CreateDesktopWindow
@ cdecl CreateWindow(long) macdrv_CreateWindow
@ cdecl DestroyCursorIcon(long) macdrv_DestroyCursorIcon
......
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