Handle the case where the pointer isn't on the same screen as the widget
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)
This commit is contained in:
parent
d8bc318151
commit
ad3ca8430d
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkclist.c: Fix a problem with the focus row
|
* gtk/gtkclist.c: Fix a problem with the focus row
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkclist.c: Fix a problem with the focus row
|
* gtk/gtkclist.c: Fix a problem with the focus row
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkclist.c: Fix a problem with the focus row
|
* gtk/gtkclist.c: Fix a problem with the focus row
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkclist.c: Fix a problem with the focus row
|
* gtk/gtkclist.c: Fix a problem with the focus row
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkclist.c: Fix a problem with the focus row
|
* gtk/gtkclist.c: Fix a problem with the focus row
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Dec 13 23:10:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkclist.c: Fix a problem with the focus row
|
* gtk/gtkclist.c: Fix a problem with the focus row
|
||||||
|
@ -2595,6 +2595,7 @@ gtk_menu_position (GtkMenu *menu)
|
|||||||
gint menu_height;
|
gint menu_height;
|
||||||
gboolean push_in;
|
gboolean push_in;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
GdkScreen *pointer_screen;
|
||||||
GdkRectangle monitor;
|
GdkRectangle monitor;
|
||||||
gint monitor_num;
|
gint monitor_num;
|
||||||
|
|
||||||
@ -2602,12 +2603,9 @@ gtk_menu_position (GtkMenu *menu)
|
|||||||
|
|
||||||
widget = GTK_WIDGET (menu);
|
widget = GTK_WIDGET (menu);
|
||||||
|
|
||||||
gdk_window_get_pointer (gtk_widget_get_root_window (widget),
|
|
||||||
&x, &y, NULL);
|
|
||||||
|
|
||||||
screen = gtk_widget_get_screen (widget);
|
screen = gtk_widget_get_screen (widget);
|
||||||
monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
|
gdk_display_get_pointer (gdk_screen_get_display (screen),
|
||||||
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
|
&pointer_screen, &x, &y, NULL);
|
||||||
|
|
||||||
/* We need the requisition to figure out the right place to
|
/* We need the requisition to figure out the right place to
|
||||||
* popup the menu. In fact, we always need to ask here, since
|
* popup the menu. In fact, we always need to ask here, since
|
||||||
@ -2616,6 +2614,20 @@ gtk_menu_position (GtkMenu *menu)
|
|||||||
*/
|
*/
|
||||||
gtk_widget_size_request (widget, &requisition);
|
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;
|
push_in = FALSE;
|
||||||
|
|
||||||
if (menu->position_func)
|
if (menu->position_func)
|
||||||
|
Loading…
Reference in New Issue
Block a user