diff options
| author | John Ehresman <jpe@wingware.com> | 2013-05-01 10:49:50 -0400 | 
|---|---|---|
| committer | John Ehresman <jpe@wingware.com> | 2013-05-01 10:49:50 -0400 | 
| commit | 1fc8b1dbae836d50a819db02835d2c4a7c51d1f4 (patch) | |
| tree | a1ca638db81ffd7c77bf69a3cc3e4fa41834a5f8 | |
| parent | 0b5be59ffecd30203ecb72245681dc9291c5beaf (diff) | |
| download | scintilla-mirror-1fc8b1dbae836d50a819db02835d2c4a7c51d1f4.tar.gz | |
Monitor rect's top right is not necessarily 0, 0
| -rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 18 | 
1 files changed, 8 insertions, 10 deletions
| diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index aa3f38b95..d0ffcc127 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -647,25 +647,23 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo)  	int ox = oPos.x();  	int oy = oPos.y();  	ox += rc.left; -	if (ox < 0) -		ox = 0;  	oy += rc.top; -	if (oy < 0) -		oy = 0;  	QDesktopWidget *desktop = QApplication::desktop(); -	QRect rectDesk = desktop->availableGeometry(window(wid)); +	QRect rectDesk = desktop->availableGeometry(QPoint(ox, oy));  	/* do some corrections to fit into screen */  	int sizex = rc.right - rc.left;  	int sizey = rc.bottom - rc.top;  	int screenWidth = rectDesk.width();  	int screenHeight = rectDesk.height(); +	if (ox < rectDesk.x()) +		ox = rectDesk.x();  	if (sizex > screenWidth) -		ox = 0; /* the best we can do */ -	else if (ox + sizex > screenWidth) -		ox = screenWidth - sizex; -	if (oy + sizey > screenHeight) -		oy = screenHeight - sizey; +		ox = rectDesk.x(); /* the best we can do */ +	else if (ox + sizex > rectDesk.right()) +		ox = rectDesk.right() - sizex; +	if (oy + sizey > rectDesk.bottom()) +		oy = rectDesk.bottom() - sizey;  	Q_ASSERT(wid);  	window(wid)->move(ox, oy); | 
