From 35dd9e73821ef02dee70fbea3f4db7caea70391b Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 5 Apr 2003 23:51:07 +0000 Subject: Ensure positioning windows does not make them move before 0 in either x or y as that leads to them appearing at 0,0. --- gtk/PlatGTK.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 016e1b1d2..aa0fb3659 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -7,7 +7,6 @@ #include #include #include -#define assert(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) #include #include @@ -1448,8 +1447,13 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { int ox = 0; int oy = 0; gdk_window_get_origin(PWidget(relativeTo.id)->window, &ox, &oy); - - gtk_widget_set_uposition(PWidget(id), rc.left + ox, rc.top + oy); + ox += rc.left; + if (ox < 0) + ox = 0; + oy += rc.top; + if (oy < 0) + oy = 0; + gtk_widget_set_uposition(PWidget(id), ox, oy); #if 0 GtkAllocation alloc; @@ -1459,7 +1463,6 @@ 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); } -- cgit v1.2.3