From df3bc0736121ce07791170dbeaa97e50d8949585 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 14 Nov 2001 20:56:53 +0000 Subject: From a patch by Yukihiro Nakai . 2001-11-14 Christopher James Lahey From a patch by Yukihiro Nakai . * gal/widgets/e-canvas.c (e_canvas_realize): Handle GDK_IM_PREEDIT_POSITION here. svn path=/trunk/; revision=14703 --- widgets/misc/e-canvas.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'widgets/misc') diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index e4c40ceddc..8126367145 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -668,6 +668,7 @@ e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) static void e_canvas_realize (GtkWidget *widget) { + gint width, height; ECanvas *ecanvas = E_CANVAS (widget); if (GTK_WIDGET_CLASS (parent_class)->realize) @@ -682,12 +683,41 @@ e_canvas_realize (GtkWidget *widget) 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 = ecanvas->parent.layout.bin_window; + 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; + } + + gdk_window_get_size (attr->client_window, &width, &height); + height = widget->style->font->ascent + + widget->style->font->descent; + + attrmask |= GDK_IC_PREEDIT_POSITION_REQ; + 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; + } + ecanvas->ic = gdk_ic_new (attr, attrmask); if (ecanvas->ic != NULL) { mask = gdk_window_get_events (attr->client_window); -- cgit v1.2.3