Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemCocoa.mm
| Show First 20 Lines • Show All 765 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| GHOST_TSuccess GHOST_SystemCocoa::disposeContext(GHOST_IContext *context) | GHOST_TSuccess GHOST_SystemCocoa::disposeContext(GHOST_IContext *context) | ||||
| { | { | ||||
| delete context; | delete context; | ||||
| return GHOST_kSuccess; | return GHOST_kSuccess; | ||||
| } | } | ||||
| GHOST_IWindow *GHOST_SystemCocoa::getWindowUnderCursor(int32_t x, | |||||
| int32_t y, | |||||
| const GHOST_IWindow *below_window) { | |||||
| NSPoint scr_co = NSMakePoint(x, y); | |||||
| NSInteger window_number = 0; | |||||
| if (below_window) { | |||||
| const NSWindow *nswindom_top = (const NSWindow *)below_window->getOSWindow(); | |||||
| window_number = [nswindom_top windowNumber]; | |||||
| } | |||||
| int windowNumberAtPoint = [NSWindow windowNumberAtPoint:scr_co belowWindowWithWindowNumber:window_number]; | |||||
| NSWindow *nswindow = [NSApp windowWithWindowNumber:windowNumberAtPoint]; | |||||
| if (nswindow == nil) { | |||||
| return nil; | |||||
| } | |||||
| return m_windowManager->getWindowAssociatedWithOSWindow((void *)nswindow); | |||||
| } | |||||
| /** | /** | ||||
| * \note : returns coordinates in Cocoa screen coordinates | * \note : returns coordinates in Cocoa screen coordinates | ||||
| */ | */ | ||||
| GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(int32_t &x, int32_t &y) const | GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(int32_t &x, int32_t &y) const | ||||
| { | { | ||||
| NSPoint mouseLoc = [NSEvent mouseLocation]; | NSPoint mouseLoc = [NSEvent mouseLocation]; | ||||
| // Returns the mouse location in screen coordinates | // Returns the mouse location in screen coordinates | ||||
| ▲ Show 20 Lines • Show All 1,186 Lines • Show Last 20 Lines | |||||