Make the menu pop up centered below the mouse pointer.
authorMikael Magnusson <mikachu@comhem.se>
Mon, 23 Jul 2007 23:53:59 +0000 (01:53 +0200)
committerMikael Magnusson <mikachu@comhem.se>
Wed, 16 Jan 2008 06:26:35 +0000 (07:26 +0100)
also move the menu one pixel down so you can click and the menu doesn't stick.

openbox/menuframe.c

index 9ab94ff87f37335c8241ca4e1d0348350b496384..3e9a3ebea89b0444ba2ebdcbc593c4d5c3c24e16 100644 (file)
@@ -232,28 +232,14 @@ static void menu_frame_place_topmenu(ObMenuFrame *self, gint *x, gint *y)
     gint dx, dy;
 
     if (config_menu_middle) {
-        gint myx;
 
-        myx = *x;
-        *y -= self->area.height / 2;
+        *x -= self->area.width / 2;
 
-        /* try to the right of the cursor */
-        menu_frame_move_on_screen(self, myx, *y, &dx, &dy);
+        /* try below the cursor */
+        menu_frame_move_on_screen(self, *x, *y, &dx, &dy);
         self->direction_right = TRUE;
-        if (dx != 0) {
-            /* try to the left of the cursor */
-            myx = *x - self->area.width;
-            menu_frame_move_on_screen(self, myx, *y, &dx, &dy);
-            self->direction_right = FALSE;
-        }
-        if (dx != 0) {
-            /* if didnt fit on either side so just use what it says */
-            myx = *x;
-            menu_frame_move_on_screen(self, myx, *y, &dx, &dy);
-            self->direction_right = TRUE;
-        }
-        *x = myx + dx;
-        *y += dy;
+        *x += dx;
+        *y += dy+1;
     } else {
         gint myx, myy;