summaryrefslogtreecommitdiff
path: root/gtk/gtktooltips.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-11-23 21:27:50 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-11-23 21:27:50 +0000
commitd17dc738e2bbc13f8fd86eb8a1e4b8945f32d976 (patch)
tree24da88d20c133091ad197aa13fb932765b4b0159 /gtk/gtktooltips.c
parent94511bb11173c951d030b8a038bf1d4ea4cb0e65 (diff)
downloadgdk-pixbuf-d17dc738e2bbc13f8fd86eb8a1e4b8945f32d976.tar.gz
Make tooltip positioning Xinerama-aware. (#127332)
Sun Nov 23 22:26:25 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip positioning Xinerama-aware. (#127332)
Diffstat (limited to 'gtk/gtktooltips.c')
-rw-r--r--gtk/gtktooltips.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index 82e9d32bd..97bb782c7 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -390,10 +390,13 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
GtkRequisition requisition;
GtkWidget *widget;
GtkStyle *style;
- gint x, y, w, h, scr_w, scr_h;
+ gint x, y, w, h;
GtkTooltipsData *data;
gboolean keyboard_mode;
GdkScreen *screen;
+ GdkScreen *pointer_screen;
+ gint monitor_num, px, py;
+ GdkRectangle monitor;
if (!tooltips->tip_window)
gtk_tooltips_force_window (tooltips);
@@ -410,8 +413,6 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
gtk_tooltips_update_screen (tooltips, FALSE);
screen = gtk_widget_get_screen (widget);
- scr_w = gdk_screen_get_width (screen);
- scr_h = gdk_screen_get_height (screen);
data = tooltips->active_tips_data;
@@ -436,12 +437,22 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
x -= (w / 2 + 4);
- if ((x + w) > scr_w)
- x -= (x + w) - scr_w;
- else if (x < 0)
- x = 0;
+ gdk_display_get_pointer (gdk_screen_get_display (screen),
+ &pointer_screen, &px, &py, NULL);
+ if (pointer_screen != screen)
+ {
+ px = x;
+ py = y;
+ }
+ monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
+ if ((x + w) > monitor.x + monitor.width)
+ x -= (x + w) - (monitor.x + monitor.width);
+ else if (x < monitor.x)
+ x = monitor.x;
- if ((y + h + widget->allocation.height + 4) > scr_h)
+ if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height)
y = y - h - 4;
else
y = y + widget->allocation.height + 4;