| 556 PangoLayout *layout; |
556 PangoLayout *layout; |
| 557 GtkStyle *style; |
557 GtkStyle *style; |
| 558 |
558 |
| 559 g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); |
559 g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); |
| 560 |
560 |
| 561 layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); |
561 /* We set the text in a separate function call so we can specify a |
| |
562 max length. This is important so the tooltip isn't too wide for |
| |
563 the screen, and also because some X library function exits the |
| |
564 process when it can't allocate enough memory for a super wide |
| |
565 tooltip. */ |
| |
566 layout = gtk_widget_create_pango_layout(imhtml->tip_window, NULL); |
| |
567 pango_layout_set_text(layout, imhtml->tip, 200); |
| 562 style = gtk_widget_get_style(imhtml->tip_window); |
568 style = gtk_widget_get_style(imhtml->tip_window); |
| 563 |
569 |
| 564 #if GTK_CHECK_VERSION(3,0,0) |
570 #if GTK_CHECK_VERSION(3,0,0) |
| 565 gtk_paint_flat_box(style, cr, |
571 gtk_paint_flat_box(style, cr, |
| 566 GTK_STATE_NORMAL, GTK_SHADOW_OUT, |
572 GTK_STATE_NORMAL, GTK_SHADOW_OUT, |
| 625 g_signal_connect_swapped(G_OBJECT(imhtml->tip_window), "expose_event", |
631 g_signal_connect_swapped(G_OBJECT(imhtml->tip_window), "expose_event", |
| 626 G_CALLBACK(gtk_imhtml_tip_paint), imhtml); |
632 G_CALLBACK(gtk_imhtml_tip_paint), imhtml); |
| 627 #endif |
633 #endif |
| 628 |
634 |
| 629 gtk_widget_ensure_style (imhtml->tip_window); |
635 gtk_widget_ensure_style (imhtml->tip_window); |
| 630 layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); |
636 |
| |
637 /* We set the text in a separate function call so we can specify a |
| |
638 max length. This is important so the tooltip isn't too wide for |
| |
639 the screen, and also because some X library function exits the |
| |
640 process when it can't allocate enough memory for a super wide |
| |
641 tooltip. */ |
| |
642 layout = gtk_widget_create_pango_layout(imhtml->tip_window, NULL); |
| |
643 pango_layout_set_text(layout, imhtml->tip, 200); |
| |
644 |
| 631 font = pango_context_load_font(pango_layout_get_context(layout), |
645 font = pango_context_load_font(pango_layout_get_context(layout), |
| 632 style->font_desc); |
646 style->font_desc); |
| 633 |
647 |
| 634 if (font == NULL) { |
648 if (font == NULL) { |
| 635 char *tmp = pango_font_description_to_string(style->font_desc); |
649 char *tmp = pango_font_description_to_string(style->font_desc); |