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)
This commit is contained in:
Owen Taylor 2003-08-19 19:24:39 +00:00 committed by Owen Taylor
parent ccfd33c5a5
commit f9063a1122
7 changed files with 96 additions and 8 deletions

View File

@ -1,3 +1,13 @@
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)
Tue Aug 19 13:58:50 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):

View File

@ -1,3 +1,13 @@
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)
Tue Aug 19 13:58:50 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):

View File

@ -1,3 +1,13 @@
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)
Tue Aug 19 13:58:50 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):

View File

@ -1,3 +1,13 @@
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)
Tue Aug 19 13:58:50 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):

View File

@ -1,3 +1,13 @@
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)
Tue Aug 19 13:58:50 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):

View File

@ -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);
}

View File

@ -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;
};