Openbox2 patch 4a replaces patch 4
    Marc Wilson 
    msw at cox.net
       
    Mon Aug 11 18:26:36 EDT 2003
    
    
  
Due to a stupid mistake on my part, patch 4 does not take into proper
account what should happen when you pop the root menu less than half the
width of the root menu in pixels from the left edge of the right monitor.
This is a corrected patch.
-- 
 Marc Wilson |     Class, that's the only thing that counts in life.
 msw at cox.net |     Class.  Without class and style, a man's a bum;
             |     he might as well be dead.  -- "Bugsy" Siegel
-------------- next part --------------
--- src/Screen.cc.orig	2003-08-04 19:24:27.000000000 -0700
+++ src/Screen.cc	2003-08-11 15:16:17.000000000 -0700
@@ -2614,8 +2645,31 @@
   if (mx < 0) mx = 0;
   if (my < 0) my = 0;
 
+#ifdef     XINERAMA
+  if (isXineramaActive()) {
+    int t = mx;  // our original position
+    int w = getWidth()/2;  // half of the screen
+
+    // ok, is the menu crossing from the left?
+    if ( (mx + workspacemenu->getWidth() > w && (mx < w) && (x < w)) )
+      t = (getWidth()/2) - workspacemenu->getWidth() - getBorderWidth();
+
+    // is it crossing from the right?
+    if ( (mx + workspacemenu->getWidth() > w && (mx < w) && (x > w)) )
+      t = (getWidth()/2);
+
+    // no, use normal positioning
+    if (mx + workspacemenu->getWidth() > getWidth())
+      t = getWidth() - workspacemenu->getWidth() - getBorderWidth();
+
+    mx = t;
+  } else
+      if (mx + workspacemenu->getWidth() > getWidth())
+        mx = getWidth() - workspacemenu->getWidth() - getBorderWidth();
+#else
   if (mx + workspacemenu->getWidth() > getWidth())
     mx = getWidth() - workspacemenu->getWidth() - getBorderWidth();
+#endif
 
   if (my + workspacemenu->getHeight() > getHeight())
     my = getHeight() - workspacemenu->getHeight() - getBorderWidth();
@@ -2632,16 +2686,38 @@
 void BScreen::showRootMenu(int x, int y) {
   int mx = x - (rootmenu->getWidth() / 2);
   int my = y - (rootmenu->getTitleHeight() / 2);
-
+  
   if (mx < 0) mx = 0;
   if (my < 0) my = 0;
 
+#ifdef     XINERAMA
+  if (isXineramaActive()) {
+    int t = mx;  // our original position
+    int w = getWidth()/2;  // half of the screen
+
+    // ok, is the menu crossing from the left?
+    if ( (mx + rootmenu->getWidth() > w && (mx < w) && (x < w)) )
+      t = (getWidth()/2) - rootmenu->getWidth() - getBorderWidth();
+
+    // is it crossing from the right?
+    if ( (mx + rootmenu->getWidth() > w && (mx < w) && (x > w)) )
+      t = (getWidth()/2);
+
+    // no, use normal positioning
+    if (mx + rootmenu->getWidth() > getWidth())
+      t = getWidth() - rootmenu->getWidth() - getBorderWidth();
+
+    mx = t;
+  } else
+      if (mx + rootmenu->getWidth() > getWidth())
+        mx = getWidth() - rootmenu->getWidth() - getBorderWidth();
+#else
   if (mx + rootmenu->getWidth() > getWidth())
     mx = getWidth() - rootmenu->getWidth() - getBorderWidth();
+#endif
 
   if (my + rootmenu->getHeight() > getHeight())
     my = getHeight() - rootmenu->getHeight() - getBorderWidth();
-
   rootmenu->move(mx, my);
 
   if (! rootmenu->isVisible()) {
--- src/Basemenu.cc.orig	2003-08-11 11:57:03.000000000 -0700
+++ src/Basemenu.cc	2003-08-11 12:04:25.000000000 -0700
@@ -494,9 +494,29 @@
       y = (((shifted) ? menu.y_shift : menu.y) +
            menu.height - submenu->menu.height);
 
+#ifdef     XINERAMA
+    if (screen->isXineramaActive()) {
+      int t = x;  // our original position
+      int w = screen->getWidth()/2;  // half of the screen
+    
+      if ( (x + submenu->getWidth()) > w && (x <= w) )
+        t = ((shifted) ? menu.x_shift : menu.x) -
+          submenu->getWidth() - screen->getBorderWidth();
+        
+      if ((x + submenu->getWidth()) > screen->getWidth())
+        t = ((shifted) ? menu.x_shift : menu.x) -
+          submenu->getWidth() - screen->getBorderWidth();
+
+      x = t;
+    } else
+        if ((x + submenu->getWidth()) > screen->getWidth())
+          x = ((shifted) ? menu.x_shift : menu.x) -
+            submenu->getWidth() - screen->getBorderWidth();
+#else
     if ((x + submenu->getWidth()) > screen->getWidth())
       x = ((shifted) ? menu.x_shift : menu.x) -
         submenu->getWidth() - screen->getBorderWidth();
+#endif
 
     if (x < 0) x = 0;
 
    
    
More information about the openbox
mailing list