add set_cursor_pos() virtual method

2001-03-14  HideToshi Tajima  <tajima@happy.sunsoft.eng.sun.com>

	* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
	* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
	* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
	set_cursor_pos() virtual method

	* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
	(gtk_im_context_xim_set_cursor_pos): add implementation for
	set_cursor_pos() method

	* gtk/gtkentry.c (recompute_idle_func): set current cursor
	position to input methods
This commit is contained in:
HideToshi Tajima 2001-03-14 22:03:24 +00:00 committed by Hidetoshi Tajima
parent cf89a05f07
commit 02f376a91f
12 changed files with 205 additions and 0 deletions

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,17 @@
2001-03-14 HideToshi Tajima <tajima@happy.sunsoft.eng.sun.com>
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_cursor_pos):
* gtk/gtkimcontext.c (gtk_im_context_set_cursor_pos):
* gtk/gtkimcontext.h (struct _GtkIMContextClass): add
set_cursor_pos() virtual method
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_class_init):
(gtk_im_context_xim_set_cursor_pos): add implementation for
set_cursor_pos() method
* gtk/gtkentry.c (recompute_idle_func): set current cursor
position to input methods
Mon Mar 12 21:02:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_header_focus): Fix up focus
@ -203,6 +217,7 @@ Fri Mar 9 09:31:55 2001 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
>>>>>>> 1.1811
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -2029,6 +2029,35 @@ gtk_entry_reset_layout (GtkEntry *entry)
}
}
static void
update_im_cursor_position (GtkEntry *entry)
{
GdkRectangle area;
gint strong_x;
gint strong_xoffset;
gint x, y, area_width, area_height;
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL)
;
get_text_area_size (entry, &x, &y, &area_width, &area_height);
strong_xoffset = strong_x - entry->scroll_offset;
if (strong_xoffset < 0)
{
strong_xoffset = 0;
}
else if (strong_xoffset > area_width)
{
strong_xoffset = area_width;
}
area.x = x + strong_xoffset;
area.y = y + area_height;
area.width = area_width;
area.height = area_height;
gtk_im_context_set_cursor_pos (entry->im_context, &area);
}
static gboolean
recompute_idle_func (gpointer data)
{
@ -2039,6 +2068,8 @@ recompute_idle_func (gpointer data)
entry->recompute_idle = FALSE;
update_im_cursor_position (entry);
return FALSE;
}

View File

@ -284,3 +284,24 @@ gtk_im_context_reset (GtkIMContext *context)
}
/**
* gtk_im_context_set_cursor_pos:
* @context: a #GtkIMContext
*
* Notify the input method that a change in cursor
* position has been made.
**/
void
gtk_im_context_set_cursor_pos (GtkIMContext *context,
GdkRectangle *area)
{
GtkIMContextClass *klass;
g_return_if_fail (context != NULL);
g_return_if_fail (GTK_IS_IM_CONTEXT (context));
klass = GTK_IM_CONTEXT_GET_CLASS (context);
if (klass->set_cursor_pos)
klass->set_cursor_pos (context, area);
}

View File

@ -67,6 +67,8 @@ struct _GtkIMContextClass
void (*focus_in) (GtkIMContext *context);
void (*focus_out) (GtkIMContext *context);
void (*reset) (GtkIMContext *context);
void (*set_cursor_pos) (GtkIMContext *context,
GdkRectangle *area);
};
GtkType gtk_im_context_get_type (void) G_GNUC_CONST;
@ -82,6 +84,8 @@ gboolean gtk_im_context_filter_keypress (GtkIMContext *context,
void gtk_im_context_focus_in (GtkIMContext *context);
void gtk_im_context_focus_out (GtkIMContext *context);
void gtk_im_context_reset (GtkIMContext *context);
void gtk_im_context_set_cursor_pos (GtkIMContext *context,
GdkRectangle *area);
#ifdef __cplusplus
}

View File

@ -48,6 +48,8 @@ static gboolean gtk_im_multicontext_filter_keypress (GtkIMContext
static void gtk_im_multicontext_focus_in (GtkIMContext *context);
static void gtk_im_multicontext_focus_out (GtkIMContext *context);
static void gtk_im_multicontext_reset (GtkIMContext *context);
static void gtk_im_multicontext_set_cursor_pos (GtkIMContext *context,
GdkRectangle *area);
void gtk_im_multicontext_preedit_start_cb (GtkIMContext *slave,
GtkIMMulticontext *multicontext);
@ -102,6 +104,7 @@ gtk_im_multicontext_class_init (GtkIMMulticontextClass *class)
im_context_class->focus_in = gtk_im_multicontext_focus_in;
im_context_class->focus_out = gtk_im_multicontext_focus_out;
im_context_class->reset = gtk_im_multicontext_reset;
im_context_class->set_cursor_pos = gtk_im_multicontext_set_cursor_pos;
gobject_class->finalize = gtk_im_multicontext_finalize;
}
@ -271,6 +274,17 @@ gtk_im_multicontext_reset (GtkIMContext *context)
gtk_im_context_reset (slave);
}
static void
gtk_im_multicontext_set_cursor_pos (GtkIMContext *context,
GdkRectangle *area)
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
if (slave)
gtk_im_context_set_cursor_pos (slave, area);
}
void
gtk_im_multicontext_preedit_start_cb (GtkIMContext *slave,
GtkIMMulticontext *multicontext)

View File

@ -40,6 +40,8 @@ static gboolean gtk_im_context_xim_filter_keypress (GtkIMContext *co
static void gtk_im_context_xim_reset (GtkIMContext *context);
static void gtk_im_context_xim_focus_in (GtkIMContext *context);
static void gtk_im_context_xim_focus_out (GtkIMContext *context);
static void gtk_im_context_xim_set_cursor_pos (GtkIMContext *context,
GdkRectangle *area);
static void gtk_im_context_xim_get_preedit_string (GtkIMContext *context,
gchar **str,
PangoAttrList **attrs,
@ -213,6 +215,7 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class)
im_context_class->get_preedit_string = gtk_im_context_xim_get_preedit_string;
im_context_class->focus_in = gtk_im_context_xim_focus_in;
im_context_class->focus_out = gtk_im_context_xim_focus_out;
im_context_class->set_cursor_pos = gtk_im_context_xim_set_cursor_pos;
gobject_class->finalize = gtk_im_context_xim_finalize;
}
@ -391,6 +394,33 @@ gtk_im_context_xim_focus_out (GtkIMContext *context)
return;
}
static void
gtk_im_context_xim_set_cursor_pos (GtkIMContext *context,
GdkRectangle *area)
{
GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
XIC ic = gtk_im_context_xim_get_ic (context_xim);
XVaNestedList preedit_attr;
XPoint spot;
if (!ic)
return;
spot.x = area->x;
spot.y = area->y;
preedit_attr = XVaCreateNestedList (0,
XNSpotLocation, &spot,
0);
XSetICValues (ic,
XNPreeditAttributes, preedit_attr,
NULL);
XFree(preedit_attr);
return;
}
static void
gtk_im_context_xim_reset (GtkIMContext *context)
{