diff options
Diffstat (limited to 'gtk/PlatGTK.cxx')
| -rw-r--r-- | gtk/PlatGTK.cxx | 15 | 
1 files changed, 14 insertions, 1 deletions
| diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 18d0ea8bd..7c883e01f 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1621,6 +1621,19 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {  	oy += rc.top;  	if (oy < 0)  		oy = 0; + +	/* do some corrections to fit into screen */ +	int sizex = rc.right - rc.left; +	int sizey = rc.bottom - rc.top; +	int screenWidth = gdk_screen_width(); +	int screenHeight = gdk_screen_height(); +	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; +  	gtk_widget_set_uposition(PWidget(id), ox, oy);  #if 0 @@ -1631,7 +1644,7 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {  	alloc.height = rc.bottom - rc.top;  	gtk_widget_size_allocate(id, &alloc);  #endif -	gtk_widget_set_usize(PWidget(id), rc.right - rc.left, rc.bottom - rc.top); +	gtk_widget_set_usize(PWidget(id), sizex, sizey);  }  PRectangle Window::GetClientPosition() { | 
