From 893309b372b3ec63e3f59740f22bda137e930446 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 26 Jan 2005 20:56:15 +0000 Subject: [PATCH] Patch from John Paul Wallington to keep tooltip on screen horizontally for 2005-01-26 Elijah Newren Patch from John Paul Wallington to keep tooltip on screen horizontally for xinerama. Fixes #165261. * src/fixedtip.c: (meta_fixed_tip_show): rename screen_width and screen_height to screen_right_edge and screen_bottom_edge, set them using xinerama info instead of just screen geometry, and use them to determine where to place the tooltip window. --- ChangeLog | 10 ++++++++++ src/fixedtip.c | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 823ddb869..642693e20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-01-26 Elijah Newren + + Patch from John Paul Wallington to keep tooltip on screen + horizontally for xinerama. Fixes #165261. + + * src/fixedtip.c: (meta_fixed_tip_show): rename screen_width and + screen_height to screen_right_edge and screen_bottom_edge, set + them using xinerama info instead of just screen geometry, and use + them to determine where to place the tooltip window. + 2005-01-26 Arvind Samptur Don't wireframe when accessibility is on, it apparently diff --git a/src/fixedtip.c b/src/fixedtip.c index 99caa3016..313160854 100644 --- a/src/fixedtip.c +++ b/src/fixedtip.c @@ -24,8 +24,8 @@ static GtkWidget *tip = NULL; static GtkWidget *label = NULL; -static int screen_width = 0; -static int screen_height = 0; +static int screen_right_edge = 0; +static int screen_bottom_edge = 0; static gint expose_handler (GtkTooltips *tooltips) @@ -50,13 +50,17 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number, tip = gtk_window_new (GTK_WINDOW_POPUP); { GdkScreen *gdk_screen; + GdkRectangle monitor; + gint mon_num; gdk_screen = gdk_display_get_screen (gdk_display_get_default (), screen_number); gtk_window_set_screen (GTK_WINDOW (tip), gdk_screen); - screen_width = gdk_screen_get_width (gdk_screen); - screen_height = gdk_screen_get_height (gdk_screen); + mon_num = gdk_screen_get_monitor_at_point (gdk_screen, root_x, root_y); + gdk_screen_get_monitor_geometry (gdk_screen, mon_num, &monitor); + screen_right_edge = monitor.x + monitor.width; + screen_bottom_edge = monitor.y + monitor.height; } gtk_widget_set_app_paintable (tip, TRUE); @@ -80,12 +84,9 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number, gtk_label_set_markup (GTK_LABEL (label), markup_text); - /* FIXME should also handle Xinerama here, just to be - * really cool - */ gtk_window_get_size (GTK_WINDOW (tip), &w, &h); - if ((root_x + w) > screen_width) - root_x -= (root_x + w) - screen_width; + if ((root_x + w) > screen_right_edge) + root_x -= (root_x + w) - screen_right_edge; gtk_window_move (GTK_WINDOW (tip), root_x, root_y);