Mercurial > pidgin
comparison src/gtkimhtml.c @ 10844:d1f7821c09f4
[gaim-migrate @ 12516]
sf patch #1185455, from Richard Laager
"I realize gtk_key_pressed_cb is a work-around hack, but
given the stance of supporting GTK+ 2.0, we're going to be
stuck with it for a while.
There's no need to connect this signal for new versions of
GTK+. Also, the logic in the hack is quite weird and there's
some dead code. Without looking at CVS logs, I can only
assume this is because it went through lots of changes.
This patch makes it more clear what's going on and will
make it easier to remove this code when GTK+ 2.2 support
is eventually deprecated at some point in the distant future."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 19 Apr 2005 03:40:55 +0000 |
parents | 76d85ccf7d90 |
children | c203cd637f95 |
comparison
equal
deleted
inserted
replaced
10843:dd7f59f5252d | 10844:d1f7821c09f4 |
---|---|
519 | 519 |
520 /* propagate the event normally */ | 520 /* propagate the event normally */ |
521 return FALSE; | 521 return FALSE; |
522 } | 522 } |
523 | 523 |
524 #if (!GTK_CHECK_VERSION(2,2,0)) | |
524 /* | 525 /* |
525 * XXX - This should be removed eventually. | 526 * XXX - This should be removed eventually. |
526 * | 527 * |
527 * This function exists to work around a gross bug in GtkTextView. | 528 * This function exists to work around a gross bug in GtkTextView. |
528 * Basically, we short circuit ctrl+a and ctrl+end because they make | 529 * Basically, we short circuit ctrl+a and ctrl+end because they make |
532 * http://bugzilla.gnome.org/show_bug.cgi?id=107939 | 533 * http://bugzilla.gnome.org/show_bug.cgi?id=107939 |
533 */ | 534 */ |
534 | 535 |
535 gboolean gtk_key_pressed_cb(GtkIMHtml *imhtml, GdkEventKey *event, gpointer data) | 536 gboolean gtk_key_pressed_cb(GtkIMHtml *imhtml, GdkEventKey *event, gpointer data) |
536 { | 537 { |
537 char buf[7]; | 538 if (event->state & GDK_CONTROL_MASK) { |
538 buf[0] = '\0'; | |
539 | |
540 if (event->state & GDK_CONTROL_MASK) | |
541 switch (event->keyval) { | 539 switch (event->keyval) { |
542 #if (!GTK_CHECK_VERSION(2,2,0)) | 540 case 'a': |
543 case 'a': | 541 case GDK_Home: |
544 return TRUE; | 542 case GDK_End: |
545 break; | 543 return TRUE; |
546 | 544 } |
547 case GDK_Home: | 545 } |
548 return TRUE; | 546 return FALSE; |
549 break; | 547 } |
550 | |
551 case GDK_End: | |
552 return TRUE; | |
553 break; | |
554 | |
555 #endif /* !(GTK+ >= 2.2.0) */ | 548 #endif /* !(GTK+ >= 2.2.0) */ |
556 } | |
557 | |
558 return FALSE; | |
559 } | |
560 | |
561 | 549 |
562 static gint | 550 static gint |
563 gtk_imhtml_expose_event (GtkWidget *widget, | 551 gtk_imhtml_expose_event (GtkWidget *widget, |
564 GdkEventExpose *event) | 552 GdkEventExpose *event) |
565 { | 553 { |
566 GtkTextIter start, end, cur; | 554 GtkTextIter start, end, cur; |
567 int buf_x, buf_y; | 555 int buf_x, buf_y; |
568 GdkRectangle visible_rect; | 556 GdkRectangle visible_rect; |
569 GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); | 557 GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); |
570 GdkColor gcolor; | 558 GdkColor gcolor; |
571 | 559 |
572 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); | 560 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); |
573 gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), | 561 gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), |
574 GTK_TEXT_WINDOW_TEXT, | 562 GTK_TEXT_WINDOW_TEXT, |
575 visible_rect.x, | 563 visible_rect.x, |
576 visible_rect.y, | 564 visible_rect.y, |
1260 imhtml->default_smilies = gtk_smiley_tree_new(); | 1248 imhtml->default_smilies = gtk_smiley_tree_new(); |
1261 | 1249 |
1262 g_signal_connect(G_OBJECT(imhtml), "size-allocate", G_CALLBACK(gtk_size_allocate_cb), NULL); | 1250 g_signal_connect(G_OBJECT(imhtml), "size-allocate", G_CALLBACK(gtk_size_allocate_cb), NULL); |
1263 g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL); | 1251 g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL); |
1264 g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL); | 1252 g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL); |
1253 #if (!GTK_CHECK_VERSION(2,2,0)) | |
1254 /* See the comment for gtk_key_pressed_cb */ | |
1265 g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL); | 1255 g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL); |
1256 #endif | |
1266 g_signal_connect(G_OBJECT(imhtml), "button_press_event", G_CALLBACK(gtk_imhtml_button_press_event), NULL); | 1257 g_signal_connect(G_OBJECT(imhtml), "button_press_event", G_CALLBACK(gtk_imhtml_button_press_event), NULL); |
1267 g_signal_connect(G_OBJECT(imhtml->text_buffer), "insert-text", G_CALLBACK(preinsert_cb), imhtml); | 1258 g_signal_connect(G_OBJECT(imhtml->text_buffer), "insert-text", G_CALLBACK(preinsert_cb), imhtml); |
1268 g_signal_connect_after(G_OBJECT(imhtml->text_buffer), "insert-text", G_CALLBACK(insert_cb), imhtml); | 1259 g_signal_connect_after(G_OBJECT(imhtml->text_buffer), "insert-text", G_CALLBACK(insert_cb), imhtml); |
1269 g_signal_connect_after(G_OBJECT(imhtml->text_buffer), "insert-child-anchor", G_CALLBACK(insert_ca_cb), imhtml); | 1260 g_signal_connect_after(G_OBJECT(imhtml->text_buffer), "insert-child-anchor", G_CALLBACK(insert_ca_cb), imhtml); |
1270 gtk_drag_dest_set(GTK_WIDGET(imhtml), 0, | 1261 gtk_drag_dest_set(GTK_WIDGET(imhtml), 0, |