diff options
author | Geenz <geenz@geenzo.com> | 2013-04-01 08:25:11 -0400 |
---|---|---|
committer | Geenz <geenz@geenzo.com> | 2013-04-01 08:25:11 -0400 |
commit | 5098d43a9be5b9638a8806918e9bb82a096c000f (patch) | |
tree | 1114df6ae9db3ed3e606be9d1d99ebe62af6f598 | |
parent | 2656b1f405dcf3b67d644bf47b02a64886ef2ca4 (diff) |
STORM-1941: Cocoa project viewer: some coordinate conversions are off (Katharine Berry)
-rw-r--r-- | doc/contributions.txt | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 70 |
2 files changed, 10 insertions, 62 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index e86ef11a72..f7f528e084 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -661,6 +661,8 @@ Kagehi Kohn Kaimen Takahe Katharine Berry STORM-1900 + STORM-1940 + STORM-1941 Keklily Longfall Ken Lavender Ken March diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2d0f981b3e..4f6ae5c799 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1255,52 +1255,21 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordWindow *to) { - S32 client_height; - float client_rect[4]; - getContentViewBounds(mWindow, client_rect); - if (!mWindow || - NULL == to) - { - return FALSE; - } - to->mX = from.mX; - client_height = client_rect[3]; - to->mY = from.mY - 1; - + to->mY = from.mY; return TRUE; } BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordGL* to) { - S32 client_height; - float client_rect[4]; - - getContentViewBounds(mWindow, client_rect); - - if (!mWindow || - NULL == to) - { - return FALSE; - } - to->mX = from.mX; - client_height = client_rect[3]; - to->mY = from.mY - 1; - + to->mY = from.mY; return TRUE; } BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) { - if(mFullscreen) - { - // In the fullscreen case, window and screen coordinates are the same. - to->mX = from.mX; - to->mY = from.mY; - return TRUE; - } - else if(mWindow) + if(mWindow) { float mouse_point[2]; @@ -1314,20 +1283,12 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) return TRUE; } - return FALSE; } BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) { - if(mFullscreen) - { - // In the fullscreen case, window and screen coordinates are the same. - to->mX = from.mX; - to->mY = from.mY; - return TRUE; - } - else if(mWindow) + if(mWindow) { float mouse_point[2]; @@ -1340,7 +1301,6 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) return TRUE; } - return FALSE; } @@ -1354,22 +1314,8 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordGL *to) BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; - if (mFullscreen) - { - to->mX = from.mX; - to->mY = from.mY; - return TRUE; - } else if (mWindow) - { - convertCoords(from, &window_coord); - convertCoords(window_coord, to); - - LL_INFOS("Coords") << to->mX << ", " << to->mY << LL_ENDL; - - return TRUE; - } - return FALSE; + return(convertCoords(from, &window_coord) && convertCoords(window_coord, to)); } @@ -1981,11 +1927,11 @@ void LLWindowMacOSX::handleDragNDrop(std::string url, LLWindowCallbacks::DragNDr MASK mask = LLWindowMacOSX::modifiersToMask(getModifiers()); float mouse_point[2]; - // This will return the mouse point in global screen coords + // This will return the mouse point in window coords getCursorPos(mWindow, mouse_point); - LLCoordScreen screen_coords(mouse_point[0], mouse_point[1]); + LLCoordWindow window_coords(mouse_point[0], mouse_point[1]); LLCoordGL gl_pos; - convertCoords(screen_coords, &gl_pos); + convertCoords(window_coords, &gl_pos); if(!url.empty()) { |