-#ifdef USE_XIM
- if (gdk_im_ready () && (editable->ic_attr = gdk_ic_attr_new ()) != NULL)
- {
- gint width, height;
- GdkColormap *colormap;
- GdkEventMask mask;
- GdkICAttr *attr = editable->ic_attr;
- GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
- GdkIMStyle style;
- GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_PREEDIT_POSITION |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING;
-
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- supported_style &= ~GDK_IM_PREEDIT_POSITION;
-
- attr->style = style = gdk_im_decide_style (supported_style);
- attr->client_window = text->text_area;
-
- if ((colormap = gtk_widget_get_colormap (widget)) !=
- gtk_widget_get_default_colormap ())
- {
- attrmask |= GDK_IC_PREEDIT_COLORMAP;
- attr->preedit_colormap = colormap;
- }
-
- switch (style & GDK_IM_PREEDIT_MASK)
- {
- case GDK_IM_PREEDIT_POSITION:
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- {
- g_warning ("over-the-spot style requires fontset");
- break;
- }
-
- attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
- gdk_window_get_size (text->text_area, &width, &height);
- attr->spot_location.x = 0;
- attr->spot_location.y = height;
- attr->preedit_area.x = 0;
- attr->preedit_area.y = 0;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attr->preedit_fontset = widget->style->font;
-
- break;
- }
- editable->ic = gdk_ic_new (attr, attrmask);
-
- if (editable->ic == NULL)
- g_warning ("Can't create input context.");
- else
- {
- mask = gdk_window_get_events (text->text_area);
- mask |= gdk_ic_get_events (editable->ic);
- gdk_window_set_events (text->text_area, mask);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_im_begin (editable->ic, text->text_area);
- }
- }
-#endif
-