fix menus to show on the screen the mouse cursor spawned them from
This commit is contained in:
parent
9df57ff1b5
commit
fa32adf16c
3 changed files with 12 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue