Commit dd34bcca authored by Gnome CVS User's avatar Gnome CVS User

Patches to support internationalized input by:

  Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
  TANAKA Shinya <shinya@race.u-tokyo.ac.jp>

See ChangeLog entries for further details.

Also some small fixes to event handling in gdk/gdk.c; sending
clear events in gtk/gtkselection.c and cut-and-paste in
gtk/gtkentry.c
parent e522ad46
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
gdk.c: Fix so that "other_events" are actually generated
Tue Nov 25 1997 Owen Taylor <owt1@cornell.edu>
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp>
TANAKA Shinya <shinya@race.u-tokyo.ac.jp>
From the README:
Feature:
Followings are the main feature of this patch.
* support XIM protocol.
* GtkEntry widget support Over-The-Spot and Root style input.
* input style is configurable by command-line option.
Furthermore, this patch includes several changes which are useful
without XIM too.
* copy and paste with other clients by compound text.
* Window title can be specified by multi byte string.
configure.in:
Added --with-locale and --enable-xim options
gdk/Makefile.am:
gdk/gdki18n.h [new file]
Multibyte string manipulation functions
gdk/gdk.c
gdk/gdk.h
gdk/gdkprivate.h
Input method and context handling functions
Command line options to control input methods
Changes to KeyPress handling to support input methods
Fixes to not return events for destroyed windows
gdk/gdkselection.c
Text property handling functions
gdk/gdkwindow.c
Set window title by multibyte string
gtk/gtkentry.c
Support for using an input context for XIM input.
Cut and paste using compound text.
Improvements to pasting (no longer replace the active selection
with itself OWT)
gtk/gtkselection.c
fix to send selection clear events to the right owner
gtk/testgtkrc
Added a default fontset that will allow international characters
INSTALL
Some rudimentary documentation about the new configuration options.
Mon Nov 24 1997 Owen Taylor <owt1@cornell.edu>
gtk/gtkaspectframe.c:
Some minor improvements to rounding in aspectframes.
......
The 'configure' script can be given a number of options to
enable and disable various features. For a complete list,
type:
./configure --help
* --enable-xim support XIM [default=yes]
Specifying --disable-xim will disable support for entering
internationalized text using X Input Methods. This will give
some slight savings in speed and memory use and might be necessary
with older versions of X.
* --with-locale=LOCALE locale name you want to use
The --with-locale options is used to determine if your operating
system has support for the locale you will be using. If not, X's built
in locale support will be used.
Because of bugs in autoconf, it is necessary to specify this option
even if your LANG environment variable is correctly set.
This option does not determine which locale GTK will use at
runtime. That will be determined from the usual environment variables.
If you will be using multiple locales with GTK, specify the one
for which your operating system has the worst support for the
--with-locale option.
Note for using XIM support with kinput2
---------------------------------------
There is a bug in older versions of kinput2 that will cause
GTK to hang when destroying a text entry. The latest versions
of kinput is available from:
ftp://ftp.sra.co.jp/pub/x11/kinput2
......@@ -26,6 +26,9 @@ if eval "test x$enable_debug = xyes"; then
fi)
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
, enable_ansi=no)
AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
echo $enable_xim, enable_xim="yes")
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
AC_ARG_WITH(xinput, [ --with-xinput[=no/gxi/xfree] support XInput ])
......@@ -63,6 +66,10 @@ if eval "test x$GCC = xyes"; then
fi
fi
if eval "test x$enable_xim = xyes"; then
CFLAGS="$CFLAGS -DUSE_XIM"
fi
# Find the X11 include and library directories
AC_PATH_X
AC_PATH_XTRA
......@@ -186,6 +193,25 @@ gtk_cv_display_resource_base="private3")])
AC_MSG_RESULT($gtk_cv_display_resource_base)
AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
# Check if X_LOCALE definition is necessary
AC_MSG_CHECKING(need -DX_LOCALE)
AC_TRY_RUN([
#include <stdio.h>
#include <locale.h>
int
main ()
{
return setlocale (LC_ALL, "${with_locale}") == NULL;
}],
gtk_cv_x_locale=no,
gtk_cv_x_locale=yes)
AC_MSG_RESULT($gtk_cv_x_locale)
if test $gtk_cv_x_locale = yes; then
CFLAGS="$CFLAGS -DX_LOCALE"
fi
# Checks for header files.
AC_HEADER_STDC
......
......@@ -14,6 +14,11 @@ libgdk_la_SOURCES = \
gdkglobals.c \
gdkimage.c \
gdkinput.c \
gdkinput.h \
gdkinputnone.h \
gdkinputcommon.h\
gdkinputgxi.h \
gdkinputxfree.h \
gdkpixmap.c \
gdkproperty.c \
gdkrectangle.c \
......@@ -21,6 +26,8 @@ libgdk_la_SOURCES = \
gdkvisual.c \
gdkwindow.c \
gdkxid.c \
gxid_lib.h \
gxid_proto.h \
gxid_lib.c
## this last one is ifdef'd out unless XINPUT_GXI is defined
## It's easier than trying to get automake to handle compiling
......@@ -29,16 +36,10 @@ libgdk_la_SOURCES = \
gdkinclude_HEADERS = \
gdk.h \
gdkcursors.h \
gdki18n.h \
gdkkeysyms.h \
gdkprivate.h \
gdktypes.h \
gdkinput.h \
gdkinputnone.h \
gdkinputcommon.h\
gdkinputgxi.h \
gdkinputxfree.h \
gxid_lib.h \
gxid_proto.h \
gdkx.h
libgdk_la_LDFLAGS = -version-info 1:0:0 \
......
This diff is collapsed.
......@@ -20,6 +20,8 @@
#include <gdk/gdktypes.h>
#include <gdk/gdki18n.h>
#ifdef __cplusplus
extern "C" {
......@@ -540,6 +542,15 @@ void gdk_selection_send_notify (guint32 requestor,
GdkAtom property,
guint32 time);
gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
guchar *text, gint length,
gchar ***list);
void gdk_free_text_list (gchar **list);
gint gdk_string_to_compound_text (gchar *str,
GdkAtom *encoding, gint *format,
guchar **ctext, gint *length);
void gdk_free_compound_text (guchar *ctext);
/* Properties
*/
GdkAtom gdk_atom_intern (const gchar *atom_name,
......@@ -588,6 +599,10 @@ gint gdk_input_set_mode (guint32 deviceid,
GdkInputMode mode);
void gdk_input_set_axes (guint32 deviceid,
GdkAxisUse *axes);
void gdk_input_set_key (guint32 deviceid,
guint index,
guint keyval,
GdkModifierType modifiers);
void gdk_input_window_get_pointer (GdkWindow *window,
guint32 deviceid,
gdouble *x,
......@@ -603,6 +618,28 @@ GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
guint32 stop,
gint *nevents_return);
#ifdef USE_XIM
/* International Input Method Support Functions
*/
gint gdk_im_ready (void);
void gdk_im_begin (GdkIC ic, GdkWindow* window);
void gdk_im_end (void);
GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
GdkIC gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...);
void gdk_ic_destroy (GdkIC ic);
void gdk_ic_set_values (GdkIC ic, ...);
void gdk_ic_get_values (GdkIC ic, ...);
void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
GdkEventMask gdk_ic_get_events (GdkIC ic);
#endif /* USE_XIM */
/* Miscellaneous */
void gdk_event_send_clientmessage_toall(GdkEvent *event);
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GDK_I18N_H__
#define __GDK_I18N_H__
/* international string support */
#include <stdlib.h>
#include <wchar.h>
#ifdef X_LOCALE
#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
_XFUNCPROTOBEGIN
extern int _Xmblen (
#if NeedFunctionPrototypes
const char *s, size_t n
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern int _Xmbtowc (
#if NeedFunctionPrototypes
wchar_t *wstr, const char *str, size_t len
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern int _Xwctomb (
#if NeedFunctionPrototypes
char *str, wchar_t wc
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern size_t _Xmbstowcs (
#if NeedFunctionPrototypes
wchar_t *wstr, const char *str, size_t len
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern size_t _Xwcstombs (
#if NeedFunctionPrototypes
char *str, const wchar_t *wstr, size_t len
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern size_t _Xwcslen (
#if NeedFunctionPrototypes
const wchar_t *wstr
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern wchar_t* _Xwcscpy (
#if NeedFunctionPrototypes
wchar_t *wstr1, const wchar_t *wstr2
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern wchar_t* _Xwcsncpy (
#if NeedFunctionPrototypes
wchar_t *wstr1, const wchar_t *wstr2, size_t len
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern int _Xwcscmp (
#if NeedFunctionPrototypes
const wchar_t *wstr1, const wchar_t *wstr2
#endif
);
_XFUNCPROTOEND
_XFUNCPROTOBEGIN
extern int _Xwcsncmp (
#if NeedFunctionPrototypes
const wchar_t *wstr1, const wchar_t *wstr2, size_t len
#endif
);
_XFUNCPROTOEND
/*
* mblen, mbtowc, and mbstowcs of the locale "ja_JP.eucJP" are buggy.
*/
#ifdef MB_CUR_MAX
# undef MB_CUR_MAX
#endif
#define MB_CUR_MAX 4
extern int _g_mbtowc (wchar_t *wstr, const char *str, size_t len);
/* #define mblen _Xmblen */
/* #define mbtowc _Xmbtowc */
#define mblen(a,b) _g_mbtowc ((wchar_t *)(NULL), (a), (b))
#define mbtowc(a,b,c) _g_mbtowc ((a),(b),(c))
#define wctomb(a,b) _Xwctomb ((a),(b))
#define mbstowcs(a,b,c) _Xmbstowcs ((a),(b),(c))
#define wcstombs(a,b,c) _Xwcstombs ((a),(b),(c))
#define wcslen(a) _Xwcslen ((a))
#define wcscpy(a,b) _Xwcscpy ((a),(b))
#define wcsncpy(a,b,c) _Xwcsnpy ((a),(b),(c))
#ifdef __cplusplus
}
#endif
#endif /* X_LOCALE */
#endif __GDK_I18N_H__
......@@ -148,6 +148,19 @@ struct _GdkDndGlobals {
};
typedef struct _GdkDndGlobals GdkDndGlobals;
#ifdef USE_XIM
struct _GdkICPrivate
{
XIC xic;
GdkIMStyle style;
};
typedef struct _GdkICPrivate GdkICPrivate;
#endif /* USE_XIM */
void gdk_window_init (void);
void gdk_visual_init (void);
......
......@@ -20,6 +20,7 @@
#include <string.h>
#include "gdk.h"
#include "gdkprivate.h"
#include "gdkx.h"
gint
......@@ -166,3 +167,71 @@ gdk_selection_send_notify (guint32 requestor,
XSendEvent (gdk_display, requestor, False, NoEventMask, (XEvent*) &xevent);
}
gint
gdk_text_property_to_text_list (GdkAtom encoding, gint format,
guchar *text, gint length,
gchar ***list)
{
XTextProperty property;
gint count = 0;
gint res;
if (!list)
return 0;
property.value = text;
property.encoding = encoding;
property.format = format;
property.nitems = length;
res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
if (res == XNoMemory || res == XLocaleNotSupported ||
res == XConverterNotFound)
return 0;
else
return count;
}
void
gdk_free_text_list (gchar **list)
{
XFreeStringList (list);
}
gint
gdk_string_to_compound_text (gchar *str,
GdkAtom *encoding, gint *format,
guchar **ctext, gint *length)
{
gint res;