+Sat Dec 14 01:00:12 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkmenu.c (gtk_menu_position): Handle the case
+ where the pointer isn't on the same screen as the widget
+ by centering the menu on the widget's screen. (#94563)
+
+Fri Dec 13 23:58:06 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_point)
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_window):
+ Provide a useful fallback on failure - return a monitor
+ close to the point or window. (#79991)
+
+ * gtk/gtkmenu.c (gtk_menu_position): Remove a now
+ unneeded check for failure of
+ gdk_screen_get_monitor_at_point()
+
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c: Fix a problem with the focus row
+Sat Dec 14 01:00:12 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkmenu.c (gtk_menu_position): Handle the case
+ where the pointer isn't on the same screen as the widget
+ by centering the menu on the widget's screen. (#94563)
+
+Fri Dec 13 23:58:06 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_point)
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_window):
+ Provide a useful fallback on failure - return a monitor
+ close to the point or window. (#79991)
+
+ * gtk/gtkmenu.c (gtk_menu_position): Remove a now
+ unneeded check for failure of
+ gdk_screen_get_monitor_at_point()
+
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c: Fix a problem with the focus row
+Sat Dec 14 01:00:12 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkmenu.c (gtk_menu_position): Handle the case
+ where the pointer isn't on the same screen as the widget
+ by centering the menu on the widget's screen. (#94563)
+
+Fri Dec 13 23:58:06 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_point)
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_window):
+ Provide a useful fallback on failure - return a monitor
+ close to the point or window. (#79991)
+
+ * gtk/gtkmenu.c (gtk_menu_position): Remove a now
+ unneeded check for failure of
+ gdk_screen_get_monitor_at_point()
+
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c: Fix a problem with the focus row
+Sat Dec 14 01:00:12 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkmenu.c (gtk_menu_position): Handle the case
+ where the pointer isn't on the same screen as the widget
+ by centering the menu on the widget's screen. (#94563)
+
+Fri Dec 13 23:58:06 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_point)
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_window):
+ Provide a useful fallback on failure - return a monitor
+ close to the point or window. (#79991)
+
+ * gtk/gtkmenu.c (gtk_menu_position): Remove a now
+ unneeded check for failure of
+ gdk_screen_get_monitor_at_point()
+
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c: Fix a problem with the focus row
+Sat Dec 14 01:00:12 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkmenu.c (gtk_menu_position): Handle the case
+ where the pointer isn't on the same screen as the widget
+ by centering the menu on the widget's screen. (#94563)
+
+Fri Dec 13 23:58:06 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_point)
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_window):
+ Provide a useful fallback on failure - return a monitor
+ close to the point or window. (#79991)
+
+ * gtk/gtkmenu.c (gtk_menu_position): Remove a now
+ unneeded check for failure of
+ gdk_screen_get_monitor_at_point()
+
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c: Fix a problem with the focus row
+Sat Dec 14 01:00:12 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkmenu.c (gtk_menu_position): Handle the case
+ where the pointer isn't on the same screen as the widget
+ by centering the menu on the widget's screen. (#94563)
+
+Fri Dec 13 23:58:06 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_point)
+ * gdk/gdkscreen.c (gdk_screen_get_monitor_at_window):
+ Provide a useful fallback on failure - return a monitor
+ close to the point or window. (#79991)
+
+ * gtk/gtkmenu.c (gtk_menu_position): Remove a now
+ unneeded check for failure of
+ gdk_screen_get_monitor_at_point()
+
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c: Fix a problem with the focus row
gint menu_height;
gboolean push_in;
GdkScreen *screen;
+ GdkScreen *pointer_screen;
GdkRectangle monitor;
gint monitor_num;
widget = GTK_WIDGET (menu);
- gdk_window_get_pointer (gtk_widget_get_root_window (widget),
- &x, &y, NULL);
-
screen = gtk_widget_get_screen (widget);
- monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ gdk_display_get_pointer (gdk_screen_get_display (screen),
+ &pointer_screen, &x, &y, NULL);
/* We need the requisition to figure out the right place to
* popup the menu. In fact, we always need to ask here, since
*/
gtk_widget_size_request (widget, &requisition);
+ if (pointer_screen != screen)
+ {
+ /* Pointer is on a different screen; roughly center the
+ * menu on the screen. If someone was using multiscreen
+ * + Xinerama together they'd probably want something
+ * fancier; but that is likely to be vanishingly rare.
+ */
+ x = MAX (0, (gdk_screen_get_width (screen) - requisition.width) / 2);
+ y = MAX (0, (gdk_screen_get_height (screen) - requisition.height) / 2);
+ }
+
+ monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
push_in = FALSE;
if (menu->position_func)