Re: gtk_im_context_set_cursor_location() in GtkTextView
- From: HideToshi Tajima <hidetoshi tajima eng sun com>
- To: yzhang sharemedia com
- Cc: gtk-i18n-list gnome org
- Subject: Re: gtk_im_context_set_cursor_location() in GtkTextView
- Date: Wed, 03 Oct 2001 10:49:35 -0700 (PDT)
http://bugzilla.gnome.org/show_bug.cgi?id=50626
already has a patch waiting for check-in approval.
Toshi
>Date: Wed, 03 Oct 2001 13:40:53 -0400
>From: Yao Zhang <yzhang sharemedia com>
>Subject: gtk_im_context_set_cursor_location() in GtkTextView
>To: gtk-i18n-list gnome org
>MIME-version: 1.0
>Content-transfer-encoding: 7bit
>X-Accept-Language: en
>X-Loop: gtk-i18n-list gnome org
>X-BeenThere: gtk-i18n-list gnome org
>Delivered-to: gtk-i18n-list gnome org
>X-Mailman-Version: 2.0.5
>List-Post: <mailto:gtk-i18n-list gnome org>
>List-Subscribe: <http://mail.gnome.org/mailman/listinfo/gtk-i18n-list>,
<mailto:gtk-i18n-list-request gnome org?subject=subscribe>
>List-Unsubscribe: <http://mail.gnome.org/mailman/listinfo/gtk-i18n-list>,
<mailto:gtk-i18n-list-request gnome org?subject=unsubscribe>
>List-Archive: <http://mail.gnome.org/archives/gtk-i18n-list/>
>List-Help: <mailto:gtk-i18n-list-request gnome org?subject=help>
>List-Id: Internationalization and GTK+ <gtk-i18n-list.gnome.org>
>
>GtkTextView still lacks the call to
>gtk_im_context_set_cursor_location(). I find
>I really want it in order to input Chinese easily.
>So I did it myself. I don't know if the way I do
>it is what the designer of GtkTextView intended,
>but it works very well for me. So I listed here
>in case someone else may use it.
>
>Index: gtk/gtktextview.c
>===================================================================
>RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
>retrieving revision 1.111
>diff -u -r1.111 gtktextview.c
>--- gtk/gtktextview.c 2001/09/18 20:06:47 1.111
>+++ gtk/gtktextview.c 2001/09/24 16:55:03
>@@ -3147,6 +3147,25 @@
> return retval;
> }
>
>+static void
>+update_im_cursor_location (GtkTextView *text_view)
>+{
>+ GdkRectangle strong_pos;
>+ GtkTextIter insert;
>+
>+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
>+ gtk_text_buffer_get_mark
>(get_buffer (text_view),
>+
>"insert"));
>+ gtk_text_layout_get_cursor_locations (text_view->layout, &insert,
>&strong_pos, NULL);
>+ gtk_text_view_buffer_to_window_coords (text_view,
>+ GTK_TEXT_WINDOW_TEXT,
>+ strong_pos.x, strong_pos.y,
>+ &strong_pos.x, &strong_pos.y);
>
>+ gtk_im_context_set_cursor_location (text_view->im_context,
>&strong_pos);
>+printf("cursor x=%d, y=%d, xs=%d, ys=%d\n",
>+ strong_pos.x, strong_pos.y, strong_pos.width,
>strong_pos.height);
>+}
>+
> static gint
> gtk_text_view_event (GtkWidget *widget, GdkEvent *event)
> {
>@@ -3405,6 +3424,8 @@
> if (event->window != text_view->text_window->bin_window)
> return FALSE;
>
>+ update_im_cursor_location (text_view);
>+
> if (event->button == 1)
> {
> if (text_view->drag_start_x >= 0)
>@@ -3835,6 +3856,7 @@
> text_view->blink_timeout = gtk_timeout_add (get_cursor_time
>(text_view) * CURSOR_PEND_MULTIPLIER,
> blink_cb,
> text_view);
>+ update_im_cursor_location (text_view);
> }
> }
>
>
>
>
>_______________________________________________
>gtk-i18n-list mailing list
>gtk-i18n-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]