Mercurial > pidgin.yaz
comparison src/gtkblist.c @ 9773:09f18996c2ea
[gaim-migrate @ 10641]
I didn't look at the logic for this too closely, but it works for me
with one monitor.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 18 Aug 2004 04:40:59 +0000 |
parents | 41f302d41839 |
children | ec6ff57d7b06 |
comparison
equal
deleted
inserted
replaced
9772:5f7c81eeebd2 | 9773:09f18996c2ea |
---|---|
2099 { | 2099 { |
2100 GtkTreePath *path; | 2100 GtkTreePath *path; |
2101 GtkTreeIter iter; | 2101 GtkTreeIter iter; |
2102 GaimBlistNode *node; | 2102 GaimBlistNode *node; |
2103 GValue val = {0}; | 2103 GValue val = {0}; |
2104 int scr_w,scr_h, w, h, x, y; | 2104 int scr_w, scr_h, w, h, x, y, mon_num; |
2105 PangoLayout *layout; | 2105 PangoLayout *layout; |
2106 gboolean tooltip_top = FALSE; | 2106 gboolean tooltip_top = FALSE; |
2107 char *tooltiptext = NULL; | 2107 char *tooltiptext = NULL; |
2108 struct _gaim_gtk_blist_node *gtknode; | 2108 struct _gaim_gtk_blist_node *gtknode; |
2109 GdkRectangle mon_size; | |
2110 GdkScreen *screen = NULL; | |
2109 #ifdef WANT_DROP_SHADOW | 2111 #ifdef WANT_DROP_SHADOW |
2110 GdkWindowAttr attr; | 2112 GdkWindowAttr attr; |
2111 #endif | 2113 #endif |
2112 | 2114 |
2113 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) | 2115 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) |
2209 | 2211 |
2210 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL); | 2212 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL); |
2211 pango_layout_set_wrap(layout, PANGO_WRAP_WORD); | 2213 pango_layout_set_wrap(layout, PANGO_WRAP_WORD); |
2212 pango_layout_set_width(layout, 300000); | 2214 pango_layout_set_width(layout, 300000); |
2213 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext)); | 2215 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext)); |
2214 scr_w = gdk_screen_width(); | |
2215 scr_h = gdk_screen_height(); | |
2216 pango_layout_get_size (layout, &w, &h); | 2216 pango_layout_get_size (layout, &w, &h); |
2217 | |
2218 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); | |
2219 mon_num = gdk_screen_get_monitor_at_point(screen, x, y); | |
2220 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); | |
2221 | |
2222 scr_w = mon_size.width + mon_size.x; | |
2223 scr_h = mon_size.height + mon_size.y; | |
2224 | |
2217 w = PANGO_PIXELS(w) + 8; | 2225 w = PANGO_PIXELS(w) + 8; |
2218 h = PANGO_PIXELS(h) + 8; | 2226 h = PANGO_PIXELS(h) + 8; |
2219 | 2227 |
2220 /* 38 is the size of a large status icon plus 4 pixels padding on each side. | 2228 /* 38 is the size of a large status icon plus 4 pixels padding on each side. |
2221 * I should #define this or something */ | 2229 * I should #define this or something */ |
2222 w = w + 38; | 2230 w = w + 38; |
2223 h = MAX(h, 38); | 2231 h = MAX(h, 38); |
2224 | 2232 |
2225 gdk_window_get_pointer(NULL, &x, &y, NULL); | 2233 if( w > mon_size.width ) |
2234 w = mon_size.width - 10; | |
2235 | |
2236 if( h > mon_size.height ) | |
2237 h = mon_size.height - 10; | |
2238 | |
2226 if (GTK_WIDGET_NO_WINDOW(gtkblist->window)) | 2239 if (GTK_WIDGET_NO_WINDOW(gtkblist->window)) |
2227 y+=gtkblist->window->allocation.y; | 2240 y+=gtkblist->window->allocation.y; |
2228 | 2241 |
2229 x -= ((w >> 1) + 4); | 2242 x -= ((w >> 1) + 4); |
2230 | 2243 |
2231 if ((y + h + 4) > scr_h || tooltip_top) | 2244 if ((y + h + 4) > scr_h || tooltip_top) |
2232 y = y - h - 5; | 2245 y = y - h - 5; |
2233 else | 2246 else |
2234 y = y + 6; | 2247 y = y + 6; |
2235 | 2248 |
2236 if (y < 0) | 2249 if (y < mon_size.y) |
2237 y = 0; | 2250 y = mon_size.y; |
2238 | 2251 |
2239 if (y != 0) { | 2252 if (y != mon_size.y) { |
2240 if ((x + w) > scr_w) | 2253 if ((x + w) > scr_w) |
2241 x -= (x + w + 5) - scr_w; | 2254 x -= (x + w + 5) - scr_w; |
2242 else if (x < 0) | 2255 else if (x < mon_size.x) |
2243 x = 0; | 2256 x = mon_size.x; |
2244 } else { | 2257 } else { |
2245 x -= (w / 2 + 10); | 2258 x -= (w / 2 + 10); |
2246 if (x < 0) | 2259 if (x < mon_size.x) |
2247 x += w + 15; | 2260 x = mon_size.x; |
2248 } | 2261 } |
2249 | 2262 |
2250 g_object_unref (layout); | 2263 g_object_unref (layout); |
2251 g_free(tooltiptext); | 2264 g_free(tooltiptext); |
2252 gtk_widget_set_size_request(gtkblist->tipwindow, w, h); | 2265 gtk_widget_set_size_request(gtkblist->tipwindow, w, h); |