diff --git a/ChangeLog b/ChangeLog index b94cbcd43e..6f322e84a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Tue Sep 24 15:35:42 2002 HideToshi Tajima + + disable/enable preedit/status in GtkIMContextXIM (#59076) + + * gtk/gtkenums.h (enum): added preedit/status styles for gtk+ + input method + * modules/input/gtkimcontextxim.c + * gdk/x11/gdkevents-x11.c: add gtk-im-preedit-style and + gtk-im-status-style to GtkSettings. + * po/POTFILES.in: added modules/input/gtkimcontextxim.c + + With the other patch for gnome-control-center, + the preedit and status styles of GTK+ input method are + configurable with associated gconf schemas keys: + "/desktop/gnome/interface/gtk-im-preedit-style" + "/desktop/gnome/interface/gtk-im-status-style" + + Both are set to "callback" by default, and platform's + packging can have different default by changing + libgnome's desktop_gnome_interface.schemas. + 2002-09-25 Matthias Clasen * gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b94cbcd43e..6f322e84a4 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,24 @@ +Tue Sep 24 15:35:42 2002 HideToshi Tajima + + disable/enable preedit/status in GtkIMContextXIM (#59076) + + * gtk/gtkenums.h (enum): added preedit/status styles for gtk+ + input method + * modules/input/gtkimcontextxim.c + * gdk/x11/gdkevents-x11.c: add gtk-im-preedit-style and + gtk-im-status-style to GtkSettings. + * po/POTFILES.in: added modules/input/gtkimcontextxim.c + + With the other patch for gnome-control-center, + the preedit and status styles of GTK+ input method are + configurable with associated gconf schemas keys: + "/desktop/gnome/interface/gtk-im-preedit-style" + "/desktop/gnome/interface/gtk-im-status-style" + + Both are set to "callback" by default, and platform's + packging can have different default by changing + libgnome's desktop_gnome_interface.schemas. + 2002-09-25 Matthias Clasen * gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b94cbcd43e..6f322e84a4 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,24 @@ +Tue Sep 24 15:35:42 2002 HideToshi Tajima + + disable/enable preedit/status in GtkIMContextXIM (#59076) + + * gtk/gtkenums.h (enum): added preedit/status styles for gtk+ + input method + * modules/input/gtkimcontextxim.c + * gdk/x11/gdkevents-x11.c: add gtk-im-preedit-style and + gtk-im-status-style to GtkSettings. + * po/POTFILES.in: added modules/input/gtkimcontextxim.c + + With the other patch for gnome-control-center, + the preedit and status styles of GTK+ input method are + configurable with associated gconf schemas keys: + "/desktop/gnome/interface/gtk-im-preedit-style" + "/desktop/gnome/interface/gtk-im-status-style" + + Both are set to "callback" by default, and platform's + packging can have different default by changing + libgnome's desktop_gnome_interface.schemas. + 2002-09-25 Matthias Clasen * gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b94cbcd43e..6f322e84a4 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,24 @@ +Tue Sep 24 15:35:42 2002 HideToshi Tajima + + disable/enable preedit/status in GtkIMContextXIM (#59076) + + * gtk/gtkenums.h (enum): added preedit/status styles for gtk+ + input method + * modules/input/gtkimcontextxim.c + * gdk/x11/gdkevents-x11.c: add gtk-im-preedit-style and + gtk-im-status-style to GtkSettings. + * po/POTFILES.in: added modules/input/gtkimcontextxim.c + + With the other patch for gnome-control-center, + the preedit and status styles of GTK+ input method are + configurable with associated gconf schemas keys: + "/desktop/gnome/interface/gtk-im-preedit-style" + "/desktop/gnome/interface/gtk-im-status-style" + + Both are set to "callback" by default, and platform's + packging can have different default by changing + libgnome's desktop_gnome_interface.schemas. + 2002-09-25 Matthias Clasen * gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b94cbcd43e..6f322e84a4 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,24 @@ +Tue Sep 24 15:35:42 2002 HideToshi Tajima + + disable/enable preedit/status in GtkIMContextXIM (#59076) + + * gtk/gtkenums.h (enum): added preedit/status styles for gtk+ + input method + * modules/input/gtkimcontextxim.c + * gdk/x11/gdkevents-x11.c: add gtk-im-preedit-style and + gtk-im-status-style to GtkSettings. + * po/POTFILES.in: added modules/input/gtkimcontextxim.c + + With the other patch for gnome-control-center, + the preedit and status styles of GTK+ input method are + configurable with associated gconf schemas keys: + "/desktop/gnome/interface/gtk-im-preedit-style" + "/desktop/gnome/interface/gtk-im-status-style" + + Both are set to "callback" by default, and platform's + packging can have different default by changing + libgnome's desktop_gnome_interface.schemas. + 2002-09-25 Matthias Clasen * gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b94cbcd43e..6f322e84a4 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,24 @@ +Tue Sep 24 15:35:42 2002 HideToshi Tajima + + disable/enable preedit/status in GtkIMContextXIM (#59076) + + * gtk/gtkenums.h (enum): added preedit/status styles for gtk+ + input method + * modules/input/gtkimcontextxim.c + * gdk/x11/gdkevents-x11.c: add gtk-im-preedit-style and + gtk-im-status-style to GtkSettings. + * po/POTFILES.in: added modules/input/gtkimcontextxim.c + + With the other patch for gnome-control-center, + the preedit and status styles of GTK+ input method are + configurable with associated gconf schemas keys: + "/desktop/gnome/interface/gtk-im-preedit-style" + "/desktop/gnome/interface/gtk-im-status-style" + + Both are set to "callback" by default, and platform's + packging can have different default by changing + libgnome's desktop_gnome_interface.schemas. + 2002-09-25 Matthias Clasen * gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index b58e814934..332c3fd983 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -2204,6 +2204,8 @@ static struct { "Gtk/KeyThemeName", "gtk-key-theme-name" }, { "Gtk/ToolbarStyle", "gtk-toolbar-style" }, { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" }, + { "Gtk/IMPreeditStyle", "gtk-im-preedit-style" }, + { "Gtk/IMStatusStyle", "gtk-im-status-style" }, { "Net/CursorBlink", "gtk-cursor-blink" }, { "Net/CursorBlinkTime", "gtk-cursor-blink-time" }, { "Net/ThemeName", "gtk-theme-name" } diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 5880af769d..44da0244e5 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -425,6 +425,19 @@ typedef enum GTK_SORT_DESCENDING } GtkSortType; +/* Style for gtk input method preeeit/status */ +typedef enum +{ + GTK_IM_PREEDIT_NOTHING, + GTK_IM_PREEDIT_CALLBACK +} GtkIMPreeditStyle; + +typedef enum +{ + GTK_IM_STATUS_NOTHING, + GTK_IM_STATUS_CALLBACK +} GtkIMStatusStyle; + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c index cafc911e2f..d2b4250a9b 100644 --- a/modules/input/gtkimcontextxim.c +++ b/modules/input/gtkimcontextxim.c @@ -20,6 +20,7 @@ #include "locale.h" #include +#include "gtk/gtkintl.h" #include "gtk/gtklabel.h" #include "gtk/gtksignal.h" #include "gtk/gtkwindow.h" @@ -32,6 +33,7 @@ struct _GtkXIMInfo GdkDisplay *display; XIM im; char *locale; + gboolean set_style; XIMStyle style; }; @@ -157,19 +159,66 @@ setup_im (GtkXIMInfo *info) XIMStyles *xim_styles = NULL; XIMValuesList *ic_values = NULL; int i; - + GtkSettings *settings; + unsigned long xim_preedit_style = 0; + unsigned long xim_status_style = 0; + unsigned long user_preference; + + if (info->set_style) + { + settings = gtk_settings_get_default (); + + if (settings) + { + GtkIMPreeditStyle preedit_style; + GtkIMStatusStyle status_style; + + g_object_get (settings, + "gtk-im-status-style", &status_style, + "gtk-im-preedit-style", &preedit_style, + NULL); + switch (preedit_style) + { + case GTK_IM_PREEDIT_CALLBACK: + xim_preedit_style = XIMPreeditCallbacks; + break; + case GTK_IM_PREEDIT_NOTHING: + xim_preedit_style = XIMPreeditNothing; + break; + } + switch (status_style) + { + case GTK_IM_STATUS_CALLBACK: + xim_status_style = XIMStatusCallbacks; + break; + case GTK_IM_STATUS_NOTHING: + xim_status_style = XIMStatusNothing; + break; + } + } + info->set_style = FALSE; + } + XGetIMValues (info->im, XNQueryInputStyle, &xim_styles, XNQueryICValuesList, &ic_values, NULL); info->style = 0; + user_preference = (xim_status_style | xim_preedit_style); if (xim_styles) { for (i = 0; i < xim_styles->count_styles; i++) if ((xim_styles->supported_styles[i] & ALLOWED_MASK) == xim_styles->supported_styles[i]) - info->style = choose_better_style (info->style, - xim_styles->supported_styles[i]); + { + if (user_preference == xim_styles->supported_styles[i]) + { + info->style = user_preference; + break; + } + info->style = choose_better_style (info->style, + xim_styles->supported_styles[i]); + } } @@ -228,6 +277,7 @@ get_im (GdkDisplay *display, info->display = display; info->locale = g_strdup (locale); info->im = im; + info->set_style = TRUE; setup_im (info); } @@ -253,6 +303,22 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) im_context_class->set_cursor_location = gtk_im_context_xim_set_cursor_location; im_context_class->set_use_preedit = gtk_im_context_xim_set_use_preedit; gobject_class->finalize = gtk_im_context_xim_finalize; + + gtk_settings_install_property (g_param_spec_enum ("gtk-im-preedit-style", + _("IM Preedit style"), + _("How to draw the input method preedit string"), + GTK_TYPE_IM_PREEDIT_STYLE, + GTK_IM_PREEDIT_CALLBACK, + G_PARAM_READWRITE)); + + gtk_settings_install_property (g_param_spec_enum ("gtk-im-status-style", + _("IM Status style"), + _("How to draw the input method statusbar"), + GTK_TYPE_IM_STATUS_STYLE, + GTK_IM_STATUS_CALLBACK, + G_PARAM_READWRITE)); + + } static void diff --git a/po/POTFILES.in b/po/POTFILES.in index 1bd4e85945..99f3bd503f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -98,3 +98,4 @@ modules/input/imti-er.c modules/input/imti-et.c modules/input/imviqr.c modules/input/imxim.c +modules/input/gtkimcontextxim.c