diff options
Diffstat (limited to 'indra/llwindow')
| -rw-r--r-- | indra/llwindow/lldragdropwin32.cpp | 10 | ||||
| -rw-r--r-- | indra/llwindow/llwindow.h | 2 | ||||
| -rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 108 | 
3 files changed, 72 insertions, 48 deletions
| diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp index d4d444eb28..15acddd987 100644 --- a/indra/llwindow/lldragdropwin32.cpp +++ b/indra/llwindow/lldragdropwin32.cpp @@ -124,10 +124,9 @@ class LLDragDropWin32Target:  						ScreenToClient( mAppWindowHandle, &pt2 );  						LLCoordWindow cursor_coord_window( pt2.x, pt2.y ); -						window_imp->convertCoords(cursor_coord_window, &gl_coord);  						MASK mask = gKeyboard->currentMask(TRUE); -						LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,  +						LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask,   							LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl );  						switch (result) @@ -180,10 +179,9 @@ class LLDragDropWin32Target:  					ScreenToClient( mAppWindowHandle, &pt2 );  					LLCoordWindow cursor_coord_window( pt2.x, pt2.y ); -					window_imp->convertCoords(cursor_coord_window, &gl_coord);  					MASK mask = gKeyboard->currentMask(TRUE); -					LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,  +					LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask,   						LLWindowCallbacks::DNDA_TRACK, mDropUrl );  					switch (result) @@ -237,15 +235,13 @@ class LLDragDropWin32Target:  				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA );  				if ( NULL != window_imp )  				{ -					LLCoordGL gl_coord( 0, 0 ); -  					POINT pt_client;  					pt_client.x = pt.x;  					pt_client.y = pt.y;  					ScreenToClient( mAppWindowHandle, &pt_client );  					LLCoordWindow cursor_coord_window( pt_client.x, pt_client.y ); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					LLCoordGL gl_coord(cursor_coord_window.convert());  					llinfos << "### (Drop) URL is: " << mDropUrl << llendl;  					llinfos << "###        raw coords are: " << pt.x << " x " << pt.y << llendl;  					llinfos << "###	    client coords are: " << pt_client.x << " x " << pt_client.y << llendl; diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index cab2d0a8fb..d2971581d2 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -39,7 +39,7 @@ class LLWindowCallbacks;  // Refer to llwindow_test in test/common/llwindow for usage example -class LLWindow +class LLWindow : public LLInstanceTracker<LLWindow>  {  public:  	struct LLWindowResolution diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index a245986433..a8d2836f48 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1545,24 +1545,16 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre  BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)  { -	LLCoordScreen screen_pos; -  	mMousePositionModified = TRUE;  	if (!mWindowHandle)  	{  		return FALSE;  	} -	if (!convertCoords(position, &screen_pos)) -	{ -		return FALSE; -	}  	// Inform the application of the new mouse position (needed for per-frame  	// hover/picking to function). -	LLCoordGL gl_pos; -	convertCoords(position, &gl_pos); -	mCallbacks->handleMouseMove(this, gl_pos, (MASK)0); +	mCallbacks->handleMouseMove(this, position.convert(), (MASK)0);  	// DEV-18951 VWR-8524 Camera moves wildly when alt-clicking.  	// Because we have preemptively notified the application of the new @@ -1572,24 +1564,23 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)  	while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))  	{ } -	return SetCursorPos(screen_pos.mX, screen_pos.mY); +	LLCoordScreen screen_pos(position.convert()); +	return ::SetCursorPos(screen_pos.mX, screen_pos.mY);  }  BOOL LLWindowWin32::getCursorPosition(LLCoordWindow *position)  {  	POINT cursor_point; -	LLCoordScreen screen_pos; -	if (!mWindowHandle || -		!GetCursorPos(&cursor_point)) +	if (!mWindowHandle  +		|| !GetCursorPos(&cursor_point) +		|| !position)  	{  		return FALSE;  	} -	screen_pos.mX = cursor_point.x; -	screen_pos.mY = cursor_point.y; - -	return convertCoords(screen_pos, position); +	*position = LLCoordScreen(cursor_point.x, cursor_point.y).convert(); +	return TRUE;  }  void LLWindowWin32::hideCursor() @@ -2167,15 +2158,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2197,15 +2188,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2230,15 +2221,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2265,15 +2256,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2294,15 +2285,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2329,15 +2320,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2358,15 +2349,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  				// If we don't do this, many clicks could get buffered up, and if the  				// first click changes the cursor position, all subsequent clicks  				// will occur at the wrong location.  JC -				LLCoordWindow cursor_coord_window;  				if (window_imp->mMousePositionModified)  				{ +					LLCoordWindow cursor_coord_window;  					window_imp->getCursorPosition(&cursor_coord_window); -					window_imp->convertCoords(cursor_coord_window, &gl_coord); +					gl_coord = cursor_coord_window.convert();  				}  				else  				{ -					window_imp->convertCoords(window_coord, &gl_coord); +					gl_coord = window_coord.convert();  				}  				MASK mask = gKeyboard->currentMask(TRUE);  				// generate move event to update mouse coordinates @@ -2438,9 +2429,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_  		case WM_MOUSEMOVE:  			{  				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEMOVE"); -				window_imp->convertCoords(window_coord, &gl_coord);  				MASK mask = gKeyboard->currentMask(TRUE); -				window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask); +				window_imp->mCallbacks->handleMouseMove(window_imp, window_coord.convert(), mask);  				return 0;  			} @@ -2570,6 +2560,44 @@ BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to)  	return TRUE;  } +LLCoordCommon LL_COORD_TYPE_WINDOW::convertToCommon() const +{ +	const LLCoordWindow& self = static_cast<const LLCoordWindow&>(*this); + +	LLWindow* windowp = &(*LLWindow::beginInstances()); +	LLCoordGL out; +	windowp->convertCoords(self, &out); +	return out.convert(); +} + +void LL_COORD_TYPE_WINDOW::convertFromCommon(const LLCoordCommon& from) +{ +	LLCoordWindow& self = static_cast<LLCoordWindow&>(*this); + +	LLWindow* windowp = &(*LLWindow::beginInstances()); +	LLCoordGL from_gl(from); +	windowp->convertCoords(from_gl, &self); +} + +LLCoordCommon LL_COORD_TYPE_SCREEN::convertToCommon() const +{ +	const LLCoordScreen& self = static_cast<const LLCoordScreen&>(*this); + +	LLWindow* windowp = &(*LLWindow::beginInstances()); +	LLCoordGL out; +	windowp->convertCoords(self, &out); +	return out.convert(); +} + +void LL_COORD_TYPE_SCREEN::convertFromCommon(const LLCoordCommon& from) +{ +	LLCoordScreen& self = static_cast<LLCoordScreen&>(*this); + +	LLWindow* windowp = &(*LLWindow::beginInstances()); +	LLCoordGL from_gl(from); +	windowp->convertCoords(from_gl, &self); +} +  BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to)  {  	S32		client_height; | 
