]> Dogcows Code - chaz/openbox/commitdiff
fix menus to show on the screen the mouse cursor spawned them from
authorMikael Magnusson <mikachu@comhem.se>
Wed, 14 Sep 2005 17:05:53 +0000 (17:05 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Wed, 14 Sep 2005 17:05:53 +0000 (17:05 +0000)
openbox/menu.c
openbox/menuframe.c
openbox/menuframe.h

index fce49a6feb565ee8092d52c74e68358e8208e33b..33a70b54d8c62a61768cd0e82484ddafbdaf9565 100644 (file)
@@ -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);
 }
index 04cf7ebeade062880ec154040f19302b93be471e..43d4058522566ffdb5161aae0483829bead425ad 100644 (file)
@@ -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);
index 65f60560882bbd02217b688781455966310125f3..83ec7521018af08d18aca5f31e4cc8f668505cad 100644 (file)
@@ -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;
 
This page took 0.025566 seconds and 4 git commands to generate.