disable/enable preedit/status in GtkIMContextXIM (#59076)

* gnome-settings-xsettings.c: added two new xsettings
	for GTK+ input method preedit and status styles.

	With the other patch for gtk+, 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.
This commit is contained in:
Hidetoshi Tajima 2002-09-24 22:55:41 +00:00
parent 7a1a8a5f37
commit 8cc9e8cfa9
10 changed files with 211 additions and 3 deletions

View File

@ -1,3 +1,24 @@
Tue Sep 24 15:35:42 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>
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 <maclas@gmx.de>
* gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover

View File

@ -1,3 +1,24 @@
Tue Sep 24 15:35:42 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>
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 <maclas@gmx.de>
* gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover

View File

@ -1,3 +1,24 @@
Tue Sep 24 15:35:42 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>
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 <maclas@gmx.de>
* gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover

View File

@ -1,3 +1,24 @@
Tue Sep 24 15:35:42 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>
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 <maclas@gmx.de>
* gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover

View File

@ -1,3 +1,24 @@
Tue Sep 24 15:35:42 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>
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 <maclas@gmx.de>
* gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover

View File

@ -1,3 +1,24 @@
Tue Sep 24 15:35:42 2002 HideToshi Tajima <hidetoshi.tajima@sun.com>
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 <maclas@gmx.de>
* gdk/x11/gdkvisual-x11.c (gdkx_visual_get): Replace leftover

View File

@ -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" }

View File

@ -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 */

View File

@ -20,6 +20,7 @@
#include "locale.h"
#include <string.h>
#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

View File

@ -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