From: Mikael Magnusson Date: Mon, 23 Jul 2007 23:53:59 +0000 (+0200) Subject: Make the menu pop up centered below the mouse pointer. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=716c11e4b397b620d1422266c22aff2d250ad430;p=mikachu%2Fopenbox.git Make the menu pop up centered below the mouse pointer. also move the menu one pixel down so you can click and the menu doesn't stick. --- diff --git a/openbox/menuframe.c b/openbox/menuframe.c index a6da6285..b3ee8774 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -245,28 +245,14 @@ static void menu_frame_place_topmenu(ObMenuFrame *self, const GravityPoint *pos, return; 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;