comparison pidgin/gtkimhtml.c @ 27824:d45f85653a75

propagate from branch 'im.pidgin.pidgin' (head 0fb5c2a94109c3921d619c2149e12569e30116ee) to branch 'im.pidgin.pidgin.yaz' (head f02844b4dfe7f65cf3e23dd38fb6d021a7c8d3df)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 22 Apr 2008 00:41:04 +0000
parents 27c9c55499f8 1d012e75153f
children eeee264cd325
comparison
equal deleted inserted replaced
22675:f35a57b8f4ce 27824:d45f85653a75
88 GdkDragContext *context, 88 GdkDragContext *context,
89 gint x, 89 gint x,
90 gint y, 90 gint y,
91 guint time); 91 guint time);
92 92
93 /* yaz. If you want to use shortcut keys that may conflict with
94 inputmethods, change this to 1. */
95 #define ENABLE_SHORTCUT 0
96
93 static void preinsert_cb(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, GtkIMHtml *imhtml); 97 static void preinsert_cb(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, GtkIMHtml *imhtml);
94 static void insert_cb(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, GtkIMHtml *imhtml); 98 static void insert_cb(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, GtkIMHtml *imhtml);
95 static void delete_cb(GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextIter *end, GtkIMHtml *imhtml); 99 static void delete_cb(GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextIter *end, GtkIMHtml *imhtml);
96 static void insert_ca_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextChildAnchor *arg2, gpointer user_data); 100 static void insert_ca_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextChildAnchor *arg2, gpointer user_data);
97 static void gtk_imhtml_apply_tags_on_insert(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); 101 static void gtk_imhtml_apply_tags_on_insert(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end);
414 } 418 }
415 419
416 static gint 420 static gint
417 gtk_imhtml_tip (gpointer data) 421 gtk_imhtml_tip (gpointer data)
418 { 422 {
419 GtkIMHtml *imhtml = data; 423 GtkIMHtml *imhtml = (GtkIMHtml *)data;
420 PangoFontMetrics *font_metrics; 424 PangoFontMetrics *font_metrics;
421 PangoLayout *layout; 425 PangoLayout *layout;
422 PangoFont *font; 426 PangoFont *font;
427 PangoLanguage *lang;
423 428
424 gint gap, x, y, h, w, scr_w, baseline_skip; 429 gint gap, x, y, h, w, scr_w, baseline_skip;
425 430
426 g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); 431 g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE);
427 432
462 g_free(tmp); 467 g_free(tmp);
463 468
464 return FALSE; 469 return FALSE;
465 } 470 }
466 471
467 font_metrics = pango_font_get_metrics(font, NULL); 472 lang = pango_context_get_language (pango_layout_get_context(layout));
473 font_metrics = pango_font_get_metrics(font, lang); //it's ok.
474 // font_metrics = pango_font_get_metrics(font, NULL); //crash!
468 475
469 pango_layout_get_pixel_size(layout, &scr_w, NULL); 476 pango_layout_get_pixel_size(layout, &scr_w, NULL);
470 gap = PANGO_PIXELS((pango_font_metrics_get_ascent(font_metrics) + 477 gap = PANGO_PIXELS((pango_font_metrics_get_ascent(font_metrics) +
471 pango_font_metrics_get_descent(font_metrics))/ 4); 478 pango_font_metrics_get_descent(font_metrics))/ 4);
472 479
577 anchor = gtk_text_iter_get_child_anchor(&iter); 584 anchor = gtk_text_iter_get_child_anchor(&iter);
578 if (anchor) { 585 if (anchor) {
579 tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_tiptext"); 586 tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_tiptext");
580 hand = FALSE; 587 hand = FALSE;
581 } 588 }
582 589 //yaz here bomb explodes
590 #if 1
583 if (tip && *tip) { 591 if (tip && *tip) {
584 if (!GTK_IMHTML(imhtml)->editable && hand) 592 if (!GTK_IMHTML(imhtml)->editable && hand)
585 gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor); 593 gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor);
586 GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT, 594 GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT,
587 gtk_imhtml_tip, imhtml); 595 gtk_imhtml_tip, imhtml);
588 } 596 }
589 597 #endif
590 GTK_IMHTML(imhtml)->tip = tip; 598 GTK_IMHTML(imhtml)->tip = tip;
591 g_slist_free(tags); 599 g_slist_free(tags);
592 return FALSE; 600 return FALSE;
593 } 601 }
594 602