1 --- gtk+-2.6.4/gtk/gtkimmulticontext.c 2004-08-09 19:59:52.000000000 +0300
2 +++ gtk+-2.6.4/gtk/gtkimmulticontext.c 2005-04-06 16:19:36.818941032 +0300
4 static void gtk_im_multicontext_focus_in (GtkIMContext *context);
5 static void gtk_im_multicontext_focus_out (GtkIMContext *context);
6 static void gtk_im_multicontext_reset (GtkIMContext *context);
7 +static void gtk_im_multicontext_show (GtkIMContext *context);
8 +static void gtk_im_multicontext_hide (GtkIMContext *context);
9 static void gtk_im_multicontext_set_cursor_location (GtkIMContext *context,
11 static void gtk_im_multicontext_set_use_preedit (GtkIMContext *context,
13 return im_multicontext_type;
16 +static GtkIMContext *
17 +gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext);
20 + PROP_INPUT_MODE = 1,
26 +static void gtk_im_multicontext_set_property(GObject * object,
28 + const GValue * value,
31 + GtkIMContext *slave = gtk_im_multicontext_get_slave (GTK_IM_MULTICONTEXT(object));
33 + GParamSpec *param_spec = g_object_class_find_property
34 + (G_OBJECT_GET_CLASS(slave),
37 + if(param_spec != NULL)
38 + g_object_set_property(G_OBJECT(slave), pspec->name, value);
41 +static void gtk_im_multicontext_get_property(GObject * object,
46 + GtkIMContext *slave = gtk_im_multicontext_get_slave (GTK_IM_MULTICONTEXT(object));
47 + GParamSpec *param_spec = g_object_class_find_property
48 + (G_OBJECT_GET_CLASS(slave),
51 + if(param_spec != NULL)
52 + g_object_get_property(G_OBJECT(slave), pspec->name, value);
55 + switch (property_id)
57 + case PROP_INPUT_MODE:
59 + g_value_set_int(value, 0);
63 + g_value_set_boolean(value, FALSE);
65 + case PROP_VISIBILITY:
67 + g_value_set_boolean(value, TRUE);
69 + case PROP_USE_SHOW_HIDE:
71 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
78 gtk_im_multicontext_class_init (GtkIMMulticontextClass *class)
81 im_context_class->focus_in = gtk_im_multicontext_focus_in;
82 im_context_class->focus_out = gtk_im_multicontext_focus_out;
83 im_context_class->reset = gtk_im_multicontext_reset;
84 + im_context_class->show = gtk_im_multicontext_show;
85 + im_context_class->hide = gtk_im_multicontext_hide;
86 im_context_class->set_cursor_location = gtk_im_multicontext_set_cursor_location;
87 im_context_class->set_use_preedit = gtk_im_multicontext_set_use_preedit;
88 im_context_class->set_surrounding = gtk_im_multicontext_set_surrounding;
89 im_context_class->get_surrounding = gtk_im_multicontext_get_surrounding;
91 gobject_class->finalize = gtk_im_multicontext_finalize;
93 + gobject_class->set_property = gtk_im_multicontext_set_property;
94 + gobject_class->get_property = gtk_im_multicontext_get_property;
96 + g_object_class_install_property(gobject_class, PROP_INPUT_MODE,
97 + g_param_spec_int("input-mode", "Input mode",
98 + "Specifies the set of allowed characters",
99 + 0, 9, 0, /* We don't move symbolic definitions here. See hildon-input-mode.h */
100 + G_PARAM_READWRITE));
102 + g_object_class_install_property(gobject_class, PROP_AUTOCAP,
103 + g_param_spec_boolean("autocap", "Autocap",
104 + "Whether the client wants the first character in a sentense to be automatic upper case",
105 + FALSE, G_PARAM_READWRITE));
107 + g_object_class_install_property(gobject_class, PROP_VISIBILITY,
108 + g_param_spec_boolean("visibility", "Visibility",
109 + "FALSE displays the \"invisible char\"instead of the actual text (password mode)",
110 + TRUE, G_PARAM_READABLE | G_PARAM_WRITABLE));
112 + g_object_class_install_property(gobject_class, PROP_VISIBILITY,
113 + g_param_spec_boolean("use-show-hide", "Use show/hide functions",
114 + "Use show/hide functions to show/hide IM instead of focus_in/focus_out",
115 + FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE));
124 +gtk_im_multicontext_show (GtkIMContext *context)
126 + GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
127 + GtkIMContext *slave;
129 + /* If the global context type is different from the context we were
130 + * using before, get rid of the old slave and create a new one
131 + * for the new global context type.
133 + if (!multicontext->context_id ||
134 + strcmp (global_context_id, multicontext->context_id) != 0)
135 + gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
137 + slave = gtk_im_multicontext_get_slave (multicontext);
139 + multicontext->priv->focus_in = TRUE;
142 + gtk_im_context_show (slave);
146 +gtk_im_multicontext_hide (GtkIMContext *context)
148 + GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
149 + GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
151 + multicontext->priv->focus_in = FALSE;
154 + gtk_im_context_hide (slave);