diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-08-19 19:24:39 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-08-19 19:24:39 +0000 |
commit | f9063a112241f8c0579330bb911596d06bf10336 (patch) | |
tree | de589ef76f63871410ee4977fc03ad638f5c4e60 /gtk | |
parent | ccfd33c5a5d739c1ba78b526f58b1486e0748519 (diff) | |
download | gdk-pixbuf-f9063a112241f8c0579330bb911596d06bf10336.tar.gz |
Replace client_window field with 'priv' pointer, retaining binary
Tue Aug 19 14:37:46 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.[ch] (struct _GtkIMMulticontext):
Replace client_window field with 'priv' pointer,
retaining binary compatibility.
* gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave):
save use_preedit/cursor_location/focus status and set
up the new slave appropriately. (#118651, Botond Botyanszki)
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkimmulticontext.c | 47 | ||||
-rw-r--r-- | gtk/gtkimmulticontext.h | 7 |
2 files changed, 46 insertions, 8 deletions
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index cc29f71e0..756368201 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -28,6 +28,16 @@ #include "gtkintl.h" #include "gtkprivate.h" +struct _GtkIMMulticontextPrivate +{ + GdkWindow *client_window; + GdkRectangle cursor_location; + + guint use_preedit : 1; + guint have_cursor_location : 1; + guint focus_in : 1; +}; + static void gtk_im_multicontext_class_init (GtkIMMulticontextClass *class); static void gtk_im_multicontext_init (GtkIMMulticontext *im_multicontext); static void gtk_im_multicontext_finalize (GObject *object); @@ -132,6 +142,11 @@ static void gtk_im_multicontext_init (GtkIMMulticontext *multicontext) { multicontext->slave = NULL; + + multicontext->priv = g_new0 (GtkIMMulticontextPrivate, 1); + multicontext->priv->use_preedit = TRUE; + multicontext->priv->have_cursor_location = FALSE; + multicontext->priv->focus_in = FALSE; } /** @@ -150,7 +165,10 @@ gtk_im_multicontext_new (void) static void gtk_im_multicontext_finalize (GObject *object) { - gtk_im_multicontext_set_slave (GTK_IM_MULTICONTEXT (object), NULL, TRUE); + GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (object); + + gtk_im_multicontext_set_slave (multicontext, NULL, TRUE); + g_free (multicontext->priv); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -160,6 +178,7 @@ gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext, GtkIMContext *slave, gboolean finalizing) { + GtkIMMulticontextPrivate *priv = multicontext->priv; gboolean need_preedit_changed = FALSE; if (multicontext->slave) @@ -212,8 +231,14 @@ gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext, G_CALLBACK (gtk_im_multicontext_delete_surrounding_cb), multicontext); - if (multicontext->client_window) - gtk_im_context_set_client_window (slave, multicontext->client_window); + if (!priv->use_preedit) /* Default is TRUE */ + gtk_im_context_set_use_preedit (slave, FALSE); + if (priv->client_window) + gtk_im_context_set_client_window (slave, priv->client_window); + if (priv->have_cursor_location) + gtk_im_context_set_cursor_location (slave, &priv->cursor_location); + if (priv->focus_in) + gtk_im_context_focus_in (slave); } if (need_preedit_changed) @@ -251,9 +276,10 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context, GdkWindow *window) { GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context); + GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext); - multicontext->client_window = window; + multicontext->priv->client_window = window; if (slave) gtk_im_context_set_client_window (slave, window); @@ -307,7 +333,9 @@ gtk_im_multicontext_focus_in (GtkIMContext *context) gtk_im_multicontext_set_slave (multicontext, NULL, FALSE); slave = gtk_im_multicontext_get_slave (multicontext); - + + multicontext->priv->focus_in = TRUE; + if (slave) gtk_im_context_focus_in (slave); } @@ -318,6 +346,8 @@ gtk_im_multicontext_focus_out (GtkIMContext *context) GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context); GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext); + multicontext->priv->focus_in = FALSE; + if (slave) gtk_im_context_focus_out (slave); } @@ -339,6 +369,9 @@ gtk_im_multicontext_set_cursor_location (GtkIMContext *context, GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context); GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext); + multicontext->priv->have_cursor_location = TRUE; + multicontext->priv->cursor_location = *area; + if (slave) gtk_im_context_set_cursor_location (slave, area); } @@ -350,6 +383,10 @@ gtk_im_multicontext_set_use_preedit (GtkIMContext *context, GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context); GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext); + use_preedit = use_preedit != FALSE; + + multicontext->priv->use_preedit = use_preedit; + if (slave) gtk_im_context_set_use_preedit (slave, use_preedit); } diff --git a/gtk/gtkimmulticontext.h b/gtk/gtkimmulticontext.h index 18d2cbe9f..348d04b9d 100644 --- a/gtk/gtkimmulticontext.h +++ b/gtk/gtkimmulticontext.h @@ -36,8 +36,9 @@ extern "C" { #define GTK_IM_MULTICONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_MULTICONTEXT, GtkIMMulticontextClass)) -typedef struct _GtkIMMulticontext GtkIMMulticontext; -typedef struct _GtkIMMulticontextClass GtkIMMulticontextClass; +typedef struct _GtkIMMulticontext GtkIMMulticontext; +typedef struct _GtkIMMulticontextClass GtkIMMulticontextClass; +typedef struct _GtkIMMulticontextPrivate GtkIMMulticontextPrivate; struct _GtkIMMulticontext { @@ -45,7 +46,7 @@ struct _GtkIMMulticontext GtkIMContext *slave; - GdkWindow *client_window; + GtkIMMulticontextPrivate *priv; const gchar *context_id; }; |