]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gtk+/gtk+-2.6.4-1.osso7/gtkimmulticontext.c.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gtk+ / gtk+-2.6.4-1.osso7 / gtkimmulticontext.c.diff
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
3 @@ -59,6 +59,8 @@
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,
10                                                         GdkRectangle            *area);
11  static void     gtk_im_multicontext_set_use_preedit    (GtkIMContext            *context,
12 @@ -118,6 +120,67 @@
13    return im_multicontext_type;
14  }
15  
16 +static GtkIMContext *
17 +gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext);
18 +
19 +enum {
20 +  PROP_INPUT_MODE = 1,
21 +  PROP_AUTOCAP,
22 +  PROP_VISIBILITY,
23 +  PROP_USE_SHOW_HIDE
24 +};
25 +
26 +static void gtk_im_multicontext_set_property(GObject * object,
27 +                                                  guint property_id,
28 +                                                  const GValue * value,
29 +                                                  GParamSpec * pspec)
30 +{
31 +  GtkIMContext *slave = gtk_im_multicontext_get_slave (GTK_IM_MULTICONTEXT(object));
32 +
33 +  GParamSpec *param_spec = g_object_class_find_property 
34 +    (G_OBJECT_GET_CLASS(slave),
35 +     pspec->name);
36 +
37 +  if(param_spec != NULL)   
38 +    g_object_set_property(G_OBJECT(slave), pspec->name, value);
39 +}
40 +
41 +static void gtk_im_multicontext_get_property(GObject * object,
42 +                                                  guint property_id,
43 +                                                  GValue * value,
44 +                                                  GParamSpec * pspec)
45 +{
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),
49 +     pspec->name);
50 +  
51 +  if(param_spec != NULL)
52 +    g_object_get_property(G_OBJECT(slave), pspec->name, value);
53 +  else
54 +    {
55 +      switch (property_id)
56 +       {
57 +       case PROP_INPUT_MODE:
58 +         /* return 0 */
59 +         g_value_set_int(value, 0);
60 +         break;
61 +       case PROP_AUTOCAP:
62 +         /* return FALSE */
63 +         g_value_set_boolean(value, FALSE);
64 +         break;
65 +       case PROP_VISIBILITY:
66 +         /* return TRUE */
67 +         g_value_set_boolean(value, TRUE);       
68 +         break;
69 +       case PROP_USE_SHOW_HIDE:
70 +       default:
71 +         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
72 +         break;          
73 +       }
74 +    }
75 +}
76 +
77  static void
78  gtk_im_multicontext_class_init (GtkIMMulticontextClass *class)
79  {
80 @@ -132,12 +195,38 @@
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;
90  
91    gobject_class->finalize = gtk_im_multicontext_finalize;
92 +
93 +  gobject_class->set_property = gtk_im_multicontext_set_property;
94 +  gobject_class->get_property = gtk_im_multicontext_get_property;
95 +
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));
101 +
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));
106 +
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));
111 +
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));
116  }
117  
118  static void
119 @@ -567,3 +656,36 @@
120    g_free (contexts);
121  }
122  
123 +static void
124 +gtk_im_multicontext_show (GtkIMContext   *context)
125 +{
126 +  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
127 +  GtkIMContext *slave;
128 +
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.
132 +   */
133 +  if (!multicontext->context_id ||
134 +      strcmp (global_context_id, multicontext->context_id) != 0)
135 +    gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
136 +
137 +  slave = gtk_im_multicontext_get_slave (multicontext);
138 +  
139 +  multicontext->priv->focus_in = TRUE;
140 +  
141 +  if (slave)
142 +    gtk_im_context_show (slave);
143 +}
144 +
145 +static void
146 +gtk_im_multicontext_hide (GtkIMContext   *context)
147 +{
148 +  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
149 +  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
150 +
151 +  multicontext->priv->focus_in = FALSE;
152 +  
153 +  if (slave)
154 +    gtk_im_context_hide (slave);
155 +}