summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2014-10-06 20:15:08 +0200
committerMikael Magnusson <mikachu@gmail.com>2014-10-06 22:05:26 +0200
commitd3359676e49b558cb7c6e24ea889c037d044b79f (patch)
tree6b6ce9dd03e50ca5c584631999e977ec9a7b0cbf
parent1b3afcff1fea0d1334b50dff378a6667e264b557 (diff)
Let the menu placement code know if the position was user specified
This way, it can avoid running the code that moves it to a good position relative to a mouse that isn't there
-rw-r--r--openbox/actions/showmenu.c3
-rw-r--r--openbox/menu.c4
-rw-r--r--openbox/menu.h3
-rw-r--r--openbox/menuframe.c12
-rw-r--r--openbox/menuframe.h3
5 files changed, 17 insertions, 8 deletions
diff --git a/openbox/actions/showmenu.c b/openbox/actions/showmenu.c
index 08e625ee..13afe225 100644
--- a/openbox/actions/showmenu.c
+++ b/openbox/actions/showmenu.c
@@ -115,7 +115,8 @@ static gboolean run_func(ObActionsData *data, gpointer options)
/* you cannot call ShowMenu from inside a menu */
if (data->uact != OB_USER_ACTION_MENU_SELECTION && o->name)
- menu_show(o->name, position, monitor, data->button != 0, data->client);
+ menu_show(o->name, position, monitor,
+ data->button != 0, o->use_position, data->client);
return FALSE;
}
diff --git a/openbox/menu.c b/openbox/menu.c
index e3fb0033..b917a59d 100644
--- a/openbox/menu.c
+++ b/openbox/menu.c
@@ -458,7 +458,7 @@ static gboolean menu_hide_delay_func(gpointer data)
}
void menu_show(gchar *name, GravityPoint pos, gint monitor,
- gboolean mouse, ObClient *client)
+ gboolean mouse, gboolean user_positioned, ObClient *client)
{
ObMenu *self;
ObMenuFrame *frame;
@@ -480,7 +480,7 @@ void menu_show(gchar *name, GravityPoint pos, gint monitor,
menu_clear_pipe_caches();
frame = menu_frame_new(self, 0, client);
- if (!menu_frame_show_topmenu(frame, pos, monitor, mouse))
+ if (!menu_frame_show_topmenu(frame, pos, monitor, mouse, user_positioned))
menu_frame_free(frame);
else {
if (!mouse) {
diff --git a/openbox/menu.h b/openbox/menu.h
index 08ca00e2..d9de36ae 100644
--- a/openbox/menu.h
+++ b/openbox/menu.h
@@ -182,7 +182,8 @@ void menu_clear_pipe_caches(void);
void menu_show_all_shortcuts(ObMenu *self, gboolean show);
void menu_show(gchar *name, GravityPoint pos, gint monitor,
- gboolean mouse, struct _ObClient *client);
+ gboolean mouse, gboolean user_positioned,
+ struct _ObClient *client);
gboolean menu_hide_delay_reached(void);
/*! The show function is called right after a menu is shown */
diff --git a/openbox/menuframe.c b/openbox/menuframe.c
index 20104542..0c363e70 100644
--- a/openbox/menuframe.c
+++ b/openbox/menuframe.c
@@ -233,13 +233,17 @@ void menu_frame_move(ObMenuFrame *self, gint x, gint y)
}
static void menu_frame_place_topmenu(ObMenuFrame *self, GravityPoint *pos,
- gint *x, gint *y, gint monitor)
+ gint *x, gint *y, gint monitor,
+ gboolean user_positioned)
{
gint dx, dy;
screen_apply_gravity_point(x, y, self->area.width, self->area.height,
pos, screen_physical_area_monitor(monitor));
+ if (user_positioned)
+ return;
+
if (config_menu_middle) {
gint myx;
@@ -994,7 +998,8 @@ static gboolean menu_frame_show(ObMenuFrame *self)
}
gboolean menu_frame_show_topmenu(ObMenuFrame *self, GravityPoint pos,
- gint monitor, gboolean mouse)
+ gint monitor, gboolean mouse,
+ gboolean user_positioned)
{
gint px, py;
gint x, y;
@@ -1009,7 +1014,8 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, GravityPoint pos,
y = pos.y.pos;
self->menu->place_func(self, &x, &y, mouse, self->menu->data);
} else {
- menu_frame_place_topmenu(self, &pos, &x, &y, monitor);
+ menu_frame_place_topmenu(self, &pos, &x, &y, monitor,
+ user_positioned);
}
menu_frame_move(self, x, y);
diff --git a/openbox/menuframe.h b/openbox/menuframe.h
index 64dcd597..780290ba 100644
--- a/openbox/menuframe.h
+++ b/openbox/menuframe.h
@@ -121,7 +121,8 @@ void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
gint *dx, gint *dy);
gboolean menu_frame_show_topmenu(ObMenuFrame *self, GravityPoint pos,
- gint monitor, gboolean mouse);
+ gint monitor, gboolean mouse,
+ gboolean user_positioned);
gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
ObMenuEntryFrame *parent_entry);