Commit 7f63b5db authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Patch from HideToshi Tajima (#51922)

Fri Nov  2 15:30:34 2001  Owen Taylor  <otaylor@redhat.com>

        Patch from HideToshi Tajima (#51922)

        * gtk/gtkimmulticontext.c: Proxy set_use_preedit().

        * gtk/modules/input/gtkimcontextxim.[ch]: Implement
        set_use_preedit().

        * gtk/modules/input/gtkimcontextxim.[ch]: If we have
        to destroy the input context because we change the
        client window or use_preedit, make sure we empty
        the preedit string.
parent 782107bc
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
Fri Nov 2 15:30:34 2001 Owen Taylor <otaylor@redhat.com>
Patch from HideToshi Tajima (#51922)
* gtk/gtkimmulticontext.c: Proxy set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: Implement
set_use_preedit().
* gtk/modules/input/gtkimcontextxim.[ch]: If we have
to destroy the input context because we change the
client window or use_preedit, make sure we empty
the preedit string.
Fri Nov 2 14:55:53 2001 Owen Taylor <otaylor@redhat.com>
* gtk/{gtkcolorseldialog.c,gtkfilesel.c,gtkfontsel.c,
......
......@@ -45,6 +45,8 @@ static void gtk_im_multicontext_focus_out (GtkIMContext
static void gtk_im_multicontext_reset (GtkIMContext *context);
static void gtk_im_multicontext_set_cursor_location (GtkIMContext *context,
GdkRectangle *area);
static void gtk_im_multicontext_set_use_preedit (GtkIMContext *context,
gboolean use_preedit);
static gboolean gtk_im_multicontext_get_surrounding (GtkIMContext *context,
gchar **text,
gint *cursor_index);
......@@ -115,6 +117,7 @@ gtk_im_multicontext_class_init (GtkIMMulticontextClass *class)
im_context_class->focus_out = gtk_im_multicontext_focus_out;
im_context_class->reset = gtk_im_multicontext_reset;
im_context_class->set_cursor_location = gtk_im_multicontext_set_cursor_location;
im_context_class->set_use_preedit = gtk_im_multicontext_set_use_preedit;
im_context_class->set_surrounding = gtk_im_multicontext_set_surrounding;
im_context_class->get_surrounding = gtk_im_multicontext_get_surrounding;
......@@ -321,6 +324,17 @@ gtk_im_multicontext_set_cursor_location (GtkIMContext *context,
gtk_im_context_set_cursor_location (slave, area);
}
static void
gtk_im_multicontext_set_use_preedit (GtkIMContext *context,
gboolean use_preedit)
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
if (slave)
gtk_im_context_set_use_preedit (slave, use_preedit);
}
static gboolean
gtk_im_multicontext_get_surrounding (GtkIMContext *context,
gchar **text,
......
......@@ -42,6 +42,8 @@ static void gtk_im_context_xim_focus_in (GtkIMContext *co
static void gtk_im_context_xim_focus_out (GtkIMContext *context);
static void gtk_im_context_xim_set_cursor_location (GtkIMContext *context,
GdkRectangle *area);
static void gtk_im_context_xim_set_use_preedit (GtkIMContext *context,
gboolean use_preedit);
static void gtk_im_context_xim_get_preedit_string (GtkIMContext *context,
gchar **str,
PangoAttrList **attrs,
......@@ -216,12 +218,14 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class)
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_location = gtk_im_context_xim_set_cursor_location;
im_context_class->set_use_preedit = gtk_im_context_xim_set_use_preedit;
gobject_class->finalize = gtk_im_context_xim_finalize;
}
static void
gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim)
{
im_context_xim->use_preedit = TRUE;
}
static void
......@@ -239,17 +243,28 @@ gtk_im_context_xim_finalize (GObject *obj)
}
static void
gtk_im_context_xim_set_client_window (GtkIMContext *context,
GdkWindow *client_window)
reinitialize_ic (GtkIMContextXIM *context_xim)
{
GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
if (context_xim->ic)
{
XDestroyIC (context_xim->ic);
context_xim->ic = NULL;
if (context_xim->preedit_length)
{
context_xim->preedit_length = 0;
g_signal_emit_by_name (context_xim, "preedit_changed");
}
}
}
static void
gtk_im_context_xim_set_client_window (GtkIMContext *context,
GdkWindow *client_window)
{
GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
reinitialize_ic (context_xim);
context_xim->client_window = client_window;
}
......@@ -425,6 +440,23 @@ gtk_im_context_xim_set_cursor_location (GtkIMContext *context,
return;
}
static void
gtk_im_context_xim_set_use_preedit (GtkIMContext *context,
gboolean use_preedit)
{
GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
use_preedit = use_preedit != FALSE;
if (context_xim->use_preedit != use_preedit)
{
context_xim->use_preedit = use_preedit;
reinitialize_ic (context_xim);
}
return;
}
static void
gtk_im_context_xim_reset (GtkIMContext *context)
{
......@@ -784,6 +816,15 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim)
if (!context_xim->ic && context_xim->client_window)
{
if (!context_xim->use_preedit)
{
context_xim->ic = XCreateIC (context_xim->im_info->im,
XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, GDK_DRAWABLE_XID (context_xim->client_window),
NULL);
return context_xim->ic;
}
if ((context_xim->im_info->style & PREEDIT_MASK) == XIMPreeditCallbacks)
{
context_xim->preedit_start_callback.client_data = (XPointer)context_xim;
......
......@@ -70,6 +70,8 @@ struct _GtkIMContextXIM
XIMCallback status_draw_callback;
XIC ic;
guint use_preedit : 1;
};
struct _GtkIMContextXIMClass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment