Created
October 16, 2018 08:52
-
-
Save eyelash/cc6f82bbeda43a830551ea8db359636e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void gral_window_warp_cursor(struct gral_window *window, float x, float y) { | |
NSRect window_rect = [[(GralWindow *)window contentView] convertRect:NSMakeRect(x, y, 0, 0) toView:nil]; | |
NSRect screen_rect = [(GralWindow *)window convertRectToScreen:window_rect]; | |
//CGWarpMouseCursorPosition(screen_rect.origin); | |
CGPoint point = [[(GralWindow *)window contentView] convertPoint:NSMakePoint(x, y) toView:nil]; | |
NSRect frame = [(GralWindow *)window frame]; | |
point = CGPointMake(NSMinX(frame) + point.x, NSMaxY(NSScreen.screens[0].frame) - (NSMinY(frame) + point.y)); | |
//CGPoint display_point = CGPointMake(NSMinX(frame) + window_point.x, NSMaxY(NSScreen.screens[0].frame) - (NSMinY(frame) + window_point.y)); | |
CGWarpMouseCursorPosition(point); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment