fixed window menu placement on very short windows
authorScott Moynes <smoynes@nexus.carleton.ca>
Tue, 1 Oct 2002 02:10:06 +0000 (02:10 +0000)
committerScott Moynes <smoynes@nexus.carleton.ca>
Tue, 1 Oct 2002 02:10:06 +0000 (02:10 +0000)
src/Window.cc

index f21000c16c1e64c360c11bdc05a9aeeb22e74a60..682fe6b6ae3309f38a84fa4a83d3f0b53fc9bf11 100644 (file)
@@ -40,7 +40,7 @@ extern "C" {
 #endif // DEBUG
 
 #ifdef HAVE_STDLIB_H
-   #include <stdlib.h>
+#  include <stdlib.h>
 #endif // HAVE_STDLIB_H
 }
 
@@ -3094,13 +3094,17 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) {
 
       if (mx < left_edge)
         mx = left_edge;
-      if (mx > right_edge)
+      else if (mx > right_edge)
         mx = right_edge;
       if (my < top_edge)
         my = top_edge;
-      if (my > bottom_edge)
+      else if (my > bottom_edge)
         my = bottom_edge;
 
+      if (my + windowmenu->getHeight() > screen->getHeight())
+        my = screen->getHeight() - windowmenu->getHeight() -
+          (screen->getBorderWidth() * 2);
+      
       windowmenu->move(mx, my);
       windowmenu->show();
       XRaiseWindow(blackbox->getXDisplay(), windowmenu->getWindowID());