Let the menu placement code know if the position was user specified mikabox-3.5-7
authorMikael Magnusson <mikachu@gmail.com>
Mon, 6 Oct 2014 18:15:08 +0000 (20:15 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Mon, 6 Oct 2014 18:15:09 +0000 (20:15 +0200)
This way, it can avoid running the code that moves it to a good position
relative to a mouse that isn't there

openbox/actions/showmenu.c
openbox/menu.c
openbox/menu.h
openbox/menuframe.c
openbox/menuframe.h

index 08e625eefd25ece97eb213e929371d66060e4c16..13afe2259308d99bf4050dc3d5b1a2a6a5ace64d 100644 (file)
@@ -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;
 }
index e3fb0033938ec9a4471bfb121050450738b3fcbc..b917a59dce97e5b9635afbd5b1826edebbf8dbca 100644 (file)
@@ -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) {
index 2ef7cb203d9e39ecd4082c13e19aa1bb405ab3b3..83a21ac1cf08783a102d554ba72c6af673ba509d 100644 (file)
@@ -184,7 +184,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 */
index 61632f99f938b1f0d4df44abec2d966b9729b6ba..4bb93b617e788b5727f75d632127643e5e5de89b 100644 (file)
@@ -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(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;
@@ -982,7 +986,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;
@@ -997,7 +1002,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,
+                                 !mouse && user_positioned);
     }
 
     menu_frame_move(self, x, y);
index 808d785b50f456dbab81a6652ab57c36beaf6def..e8711631dee3e4be7cea00810e069f44391c3a83 100644 (file)
@@ -122,7 +122,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);