Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowCocoa.mm
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| clientToScreenIntern(inX, inY, outX, outY); | clientToScreenIntern(inX, inY, outX, outY); | ||||
| } | } | ||||
| void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX, | void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX, | ||||
| GHOST_TInt32 inY, | GHOST_TInt32 inY, | ||||
| GHOST_TInt32 &outX, | GHOST_TInt32 &outX, | ||||
| GHOST_TInt32 &outY) const | GHOST_TInt32 &outY) const | ||||
| { | { | ||||
| NSRect screenCoord; | NSPoint screenCoord, windowCoord; | ||||
| NSRect baseCoord; | |||||
| screenCoord.origin.x = inX; | screenCoord.x = inX; | ||||
| screenCoord.origin.y = inY; | screenCoord.y = inY; | ||||
| baseCoord = [m_window convertRectFromScreen:screenCoord]; | windowCoord = [m_window convertPointFromScreen:screenCoord]; | ||||
| outX = baseCoord.origin.x; | outX = windowCoord.x; | ||||
| outY = baseCoord.origin.y; | outY = windowCoord.y; | ||||
| } | } | ||||
| void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX, | void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX, | ||||
| GHOST_TInt32 inY, | GHOST_TInt32 inY, | ||||
| GHOST_TInt32 &outX, | GHOST_TInt32 &outX, | ||||
| GHOST_TInt32 &outY) const | GHOST_TInt32 &outY) const | ||||
| { | { | ||||
| NSRect screenCoord; | NSPoint screenCoord, windowCoord; | ||||
| NSRect baseCoord; | |||||
| baseCoord.origin.x = inX; | windowCoord.x = inX; | ||||
| baseCoord.origin.y = inY; | windowCoord.y = inY; | ||||
| screenCoord = [m_window convertRectToScreen:baseCoord]; | screenCoord = [m_window convertPointToScreen:windowCoord]; | ||||
| outX = screenCoord.origin.x; | outX = screenCoord.x; | ||||
| outY = screenCoord.origin.y; | outY = screenCoord.y; | ||||
| } | } | ||||
| NSScreen *GHOST_WindowCocoa::getScreen() | NSScreen *GHOST_WindowCocoa::getScreen() | ||||
| { | { | ||||
| return [m_window screen]; | return [m_window screen]; | ||||
| } | } | ||||
| /* called for event, when window leaves monitor to another */ | /* called for event, when window leaves monitor to another */ | ||||
| void GHOST_WindowCocoa::setNativePixelSize(void) | void GHOST_WindowCocoa::setNativePixelSize(void) | ||||
| { | { | ||||
| NSView *view = (m_openGLView) ? m_openGLView : m_metalView; | NSView *view = (m_openGLView) ? m_openGLView : m_metalView; | ||||
| NSRect backingBounds = [view convertRectToBacking:[view bounds]]; | NSRect backingBounds = [view convertRectToBacking:[view bounds]]; | ||||
| GHOST_Rect rect; | GHOST_Rect rect; | ||||
| getClientBounds(rect); | getClientBounds(rect); | ||||
| /* TODO: Just use the 'backingScaleFactor' here? */ | |||||
| m_nativePixelSize = (float)backingBounds.size.width / (float)rect.getWidth(); | m_nativePixelSize = (float)backingBounds.size.width / (float)rect.getWidth(); | ||||
| } | } | ||||
| /** | /** | ||||
| * \note Fullscreen switch is not actual fullscreen with display capture. | * \note Fullscreen switch is not actual fullscreen with display capture. | ||||
| * As this capture removes all OS X window manager features. | * As this capture removes all OS X window manager features. | ||||
| * | * | ||||
| * Instead, the menu bar and the dock are hidden, and the window is made border-less and enlarged. | * Instead, the menu bar and the dock are hidden, and the window is made border-less and enlarged. | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||