From fa32adf16ce190fd20fc75cbe37551fc1cc3f89f Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 14 Sep 2005 17:05:53 +0000 Subject: [PATCH] fix menus to show on the screen the mouse cursor spawned them from --- openbox/menu.c | 9 +++++++++ openbox/menuframe.c | 7 +------ openbox/menuframe.h | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openbox/menu.c b/openbox/menu.c index fce49a6f..33a70b54 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -284,6 +284,7 @@ void menu_show(gchar *name, gint x, gint y, ObClient *client) { ObMenu *self; ObMenuFrame *frame; + guint i; if (!(self = menu_from_name(name))) return; @@ -305,6 +306,14 @@ void menu_show(gchar *name, gint x, gint y, ObClient *client) else menu_frame_move(frame, x - ob_rr_theme->bwidth, y - ob_rr_theme->bwidth); + frame->monitor = 0; + for (i = 0; i < screen_num_monitors; ++i) { + Rect *a = screen_physical_area_monitor(i); + if (RECT_CONTAINS(*a, frame->area.x, frame->area.y)) { + frame->monitor = i; + break; + } + } if (!menu_frame_show(frame, NULL)) menu_frame_free(frame); } diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 04cf7ebe..43d40585 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -191,12 +191,7 @@ void menu_frame_move_on_screen(ObMenuFrame *self) gint dx = 0, dy = 0; gint pos, half; - for (i = 0; i < screen_num_monitors; ++i) { - a = screen_physical_area_monitor(i); - if (RECT_INTERSECTS_RECT(*a, self->area)) - break; - } - if (!a) a = screen_physical_area_monitor(0); + a = screen_physical_area_monitor(self->monitor); half = g_list_length(self->entries) / 2; pos = g_list_index(self->entries, self->selected); diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 65f60560..83ec7521 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -64,6 +64,8 @@ struct _ObMenuFrame gint text_x; /* offset at which the text appears in the items */ gint text_w; /* width of the text area in the items */ + gint monitor; /* monitor on which to show the menu in xinerama */ + Window title; Window items; -- 2.44.0