From 699f274b06dc44d5135c8bc6321f0e59997ef821 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 4 Jan 2016 10:51:54 +0200 Subject: [PATCH] Fixed mouse cursor centering in fullscreen mode Native OS X backed didn't center mouse cursor in fullscreen mode with Retina/HiDPI support enabled Incorrect size of content view led to placement of cursor in upper right corner of the screen upon releasing of mouse capture When some action is assigned to this corner using system Hot Corners feature, the given action was triggered on acquiring mouse capture --- src/posix/cocoa/i_video.mm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 3fc2b2aed2..e99443ee87 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -625,7 +625,7 @@ void CocoaVideo::SetFullscreenMode(const int width, const int height) [m_window setHidesOnDeactivate:YES]; } - [m_window setFrame:displayRect display:YES]; + [m_window setFrame:screenFrame display:YES]; [m_window setFrameOrigin:NSMakePoint(0.0f, 0.0f)]; } @@ -1231,10 +1231,7 @@ NSSize I_GetContentViewSize(const NSWindow* const window) const NSView* const view = [window contentView]; const NSSize frameSize = [view frame].size; - // TODO: figure out why [NSView frame] returns different values in "fullscreen" and in window - // In "fullscreen" the result is multiplied by [NSScreen backingScaleFactor], but not in window - - return (vid_hidpi && !fullscreen) + return (vid_hidpi) ? [view convertSizeToBacking:frameSize] : frameSize; }