This way, it can avoid running the code that moves it to a good position
relative to a mouse that isn't there
/* you cannot call ShowMenu from inside a menu */
if (data->uact != OB_USER_ACTION_MENU_SELECTION && o->name)
/* 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);
}
void menu_show(gchar *name, GravityPoint pos, gint monitor,
}
void menu_show(gchar *name, GravityPoint pos, gint monitor,
- gboolean mouse, ObClient *client)
+ gboolean mouse, gboolean user_positioned, ObClient *client)
{
ObMenu *self;
ObMenuFrame *frame;
{
ObMenu *self;
ObMenuFrame *frame;
menu_clear_pipe_caches();
frame = menu_frame_new(self, 0, client);
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) {
menu_frame_free(frame);
else {
if (!mouse) {
void menu_show_all_shortcuts(ObMenu *self, gboolean show);
void menu_show(gchar *name, GravityPoint pos, gint monitor,
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 */
gboolean menu_hide_delay_reached(void);
/*! The show function is called right after a menu is shown */
}
static void menu_frame_place_topmenu(ObMenuFrame *self, GravityPoint *pos,
}
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(pos, x, y, screen_physical_area_monitor(monitor),
self->area.width, self->area.height);
{
gint dx, dy;
screen_apply_gravity_point(pos, x, y, screen_physical_area_monitor(monitor),
self->area.width, self->area.height);
+ if (user_positioned)
+ return;
+
if (config_menu_middle) {
*x -= self->area.width / 2;
if (config_menu_middle) {
*x -= self->area.width / 2;
}
gboolean menu_frame_show_topmenu(ObMenuFrame *self, GravityPoint pos,
}
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;
{
gint px, py;
gint x, y;
y = pos.y.pos;
self->menu->place_func(self, &x, &y, mouse, self->menu->data);
} else {
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,
+ !mouse && user_positioned);
}
menu_frame_move(self, x, y);
}
menu_frame_move(self, x, y);
gint *dx, gint *dy);
gboolean menu_frame_show_topmenu(ObMenuFrame *self, GravityPoint pos,
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);
gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
ObMenuEntryFrame *parent_entry);