Remove dependencies of interfaces on USE_XIM Attempt to make wchar

* gdk/gdk.c, gdk/gdk.h, gdk/gdktypes.h:
  Remove dependencies of interfaces on USE_XIM
* gdki18n.h: Attempt to make wchar handling more portable
* gdkwindow.c: Include config.h. (For gdkinput.h)
This commit is contained in:
Owen Taylor 1997-12-07 16:36:36 +00:00
parent 56aae058fc
commit 79f532177f
8 changed files with 217 additions and 54 deletions

117
gdk/gdk.c
View File

@ -2885,7 +2885,8 @@ gdk_dnd_drag_enter (Window dest)
*--------------------------------------------------------------
*/
void gdk_im_begin (GdkIC ic, GdkWindow* window)
void
gdk_im_begin (GdkIC ic, GdkWindow* window)
{
GdkICPrivate *private;
Window xwin;
@ -2926,14 +2927,16 @@ void gdk_im_begin (GdkIC ic, GdkWindow* window)
*--------------------------------------------------------------
*/
void gdk_im_end (void)
void
gdk_im_end (void)
{
xim_using = FALSE;
xim_ic = NULL;
xim_window = NULL;
}
static GdkIM gdk_im_get (void)
static GdkIM
gdk_im_get (void)
{
return xim_im;
}
@ -3038,9 +3041,9 @@ gdk_im_set_best_style (GdkIMStyle style)
return xim_best_allowed_style;
}
static gint gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
static gint
gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
{
xim_im = XOpenIM (GDK_DISPLAY(), db, res_name, res_class);
if (xim_im == NULL)
{
@ -3052,7 +3055,8 @@ static gint gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
return TRUE;
}
static void gdk_im_close (void)
static void
gdk_im_close (void)
{
if (xim_im)
{
@ -3066,14 +3070,16 @@ static void gdk_im_close (void)
}
}
gint gdk_im_ready (void)
gint
gdk_im_ready (void)
{
return (xim_im != NULL);
}
GdkIC gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...)
GdkIC
gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...)
{
va_list list;
GdkICPrivate *private;
@ -3113,7 +3119,8 @@ GdkIC gdk_ic_new (GdkWindow* client_window,
return private;
}
void gdk_ic_destroy (GdkIC ic)
void
gdk_ic_destroy (GdkIC ic)
{
GdkICPrivate *private;
@ -3176,7 +3183,8 @@ gdk_ic_get_values (GdkIC ic, ...)
XGetICValues (private->xic, XNVaNestedList, args, NULL);
}
void gdk_ic_set_attr (GdkIC ic, const char *target, ...)
void
gdk_ic_set_attr (GdkIC ic, const char *target, ...)
{
va_list list;
XVaNestedList attr;
@ -3194,7 +3202,8 @@ void gdk_ic_set_attr (GdkIC ic, const char *target, ...)
XSetICValues (private->xic, target, attr, NULL);
}
void gdk_ic_get_attr (GdkIC ic, const char *target, ...)
void
gdk_ic_get_attr (GdkIC ic, const char *target, ...)
{
va_list list;
XVaNestedList attr;
@ -3245,7 +3254,8 @@ gdk_ic_get_events (GdkIC ic)
return mask;
}
static void gdk_ic_cleanup (void)
static void
gdk_ic_cleanup (void)
{
GList* node;
gint destroyed;
@ -3270,6 +3280,83 @@ static void gdk_ic_cleanup (void)
xim_ic_list = NULL;
}
#else /* !USE_XIM */
void
gdk_im_begin (GdkIC ic, GdkWindow* window)
{
}
void
gdk_im_end (void)
{
}
GdkIMStyle
gdk_im_decide_style (GdkIMStyle supported_style)
{
return GdkIMPreeditNone | GdkIMStatusNone;
}
GdkIMStyle
gdk_im_set_best_style (GdkIMStyle style)
{
return GdkIMPreeditNone | GdkIMStatusNone;
}
gint
gdk_im_ready (void)
{
return FALSE;
}
GdkIC
gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...)
{
return NULL;
}
void
gdk_ic_destroy (GdkIC ic)
{
}
GdkIMStyle
gdk_ic_get_style (GdkIC ic)
{
return GdkIMPreeditNone | GdkIMStatusNone;
}
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)
{
return 0;
}
#endif /* USE_XIM */
#ifdef X_LOCALE
gint
@ -3298,8 +3385,6 @@ _g_mbtowc (wchar_t *wstr, const char *str, size_t len)
#endif /* X_LOCALE */
#endif /* USE_XIM */
static void
gdk_dnd_drag_leave (Window dest)
{

View File

@ -623,7 +623,6 @@ GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
guint32 stop,
gint *nevents_return);
#ifdef USE_XIM
/* International Input Method Support Functions
*/
@ -637,14 +636,13 @@ GdkIC gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...);
void gdk_ic_destroy (GdkIC ic);
GdkIMStyle gdk_ic_get_style (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);

View File

@ -27,22 +27,21 @@
#include <stdlib.h>
#ifdef HAVE_WCTYPE_H
#include <wctype.h>
#if defined(HAVE_WCTYPE_H) && !defined(X_LOCALE)
# include <wctype.h>
#else
#define iswalnum isalnum
/* Other functions could be added here if necessary */
#endif /* HAVE_WCTYPE_H */
# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
#endif /* HAVE_WCTYPE_H || !X_LOCALE */
#ifndef X_LOCALE
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#else /* !HAVE_WCHAR_H */
#ifdef HAVE_WCSTR_H
#include <wcstr.h>
#endif /* HAVE_WCSTR_H*/
#endif /* HAVE_WCHAR_H */
# include <wchar.h>
#else
# ifdef HAVE_WCSTR_H
# include <wcstr.h>
# endif
#endif
#else /* X_LOCALE */
#include <X11/Xfuncproto.h>

View File

@ -81,10 +81,9 @@ typedef struct _GdkDeviceInfo GdkDeviceInfo;
typedef struct _GdkTimeCoord GdkTimeCoord;
typedef gint (*GdkEventFunc) (GdkEvent *event,
gpointer data);
#ifdef USE_XIM
typedef void* GdkIC;
typedef void* GdkIM;
#endif
/* Types of windows.
@ -540,10 +539,6 @@ typedef enum
GDK_EXTENSION_EVENTS_CURSOR
} GdkExtensionMode;
#ifdef USE_XIM
/*
*/
typedef enum
{
GdkIMPreeditArea = 0x0001L,
@ -566,8 +561,6 @@ typedef enum
( GdkIMStatusArea | GdkIMStatusCallbacks | \
GdkIMStatusNothing | GdkIMStatusNone )
#endif
typedef void (*GdkInputFunction) (gpointer data,
gint source,
GdkInputCondition condition);

View File

@ -21,6 +21,7 @@
#include <X11/extensions/shape.h>
#include <netinet/in.h>
#include "gdk.h"
#include "../config.h"
#include "gdkinput.h"
#include "gdkprivate.h"
#include <stdlib.h>

View File

@ -2885,7 +2885,8 @@ gdk_dnd_drag_enter (Window dest)
*--------------------------------------------------------------
*/
void gdk_im_begin (GdkIC ic, GdkWindow* window)
void
gdk_im_begin (GdkIC ic, GdkWindow* window)
{
GdkICPrivate *private;
Window xwin;
@ -2926,14 +2927,16 @@ void gdk_im_begin (GdkIC ic, GdkWindow* window)
*--------------------------------------------------------------
*/
void gdk_im_end (void)
void
gdk_im_end (void)
{
xim_using = FALSE;
xim_ic = NULL;
xim_window = NULL;
}
static GdkIM gdk_im_get (void)
static GdkIM
gdk_im_get (void)
{
return xim_im;
}
@ -3038,9 +3041,9 @@ gdk_im_set_best_style (GdkIMStyle style)
return xim_best_allowed_style;
}
static gint gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
static gint
gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
{
xim_im = XOpenIM (GDK_DISPLAY(), db, res_name, res_class);
if (xim_im == NULL)
{
@ -3052,7 +3055,8 @@ static gint gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
return TRUE;
}
static void gdk_im_close (void)
static void
gdk_im_close (void)
{
if (xim_im)
{
@ -3066,14 +3070,16 @@ static void gdk_im_close (void)
}
}
gint gdk_im_ready (void)
gint
gdk_im_ready (void)
{
return (xim_im != NULL);
}
GdkIC gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...)
GdkIC
gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...)
{
va_list list;
GdkICPrivate *private;
@ -3113,7 +3119,8 @@ GdkIC gdk_ic_new (GdkWindow* client_window,
return private;
}
void gdk_ic_destroy (GdkIC ic)
void
gdk_ic_destroy (GdkIC ic)
{
GdkICPrivate *private;
@ -3176,7 +3183,8 @@ gdk_ic_get_values (GdkIC ic, ...)
XGetICValues (private->xic, XNVaNestedList, args, NULL);
}
void gdk_ic_set_attr (GdkIC ic, const char *target, ...)
void
gdk_ic_set_attr (GdkIC ic, const char *target, ...)
{
va_list list;
XVaNestedList attr;
@ -3194,7 +3202,8 @@ void gdk_ic_set_attr (GdkIC ic, const char *target, ...)
XSetICValues (private->xic, target, attr, NULL);
}
void gdk_ic_get_attr (GdkIC ic, const char *target, ...)
void
gdk_ic_get_attr (GdkIC ic, const char *target, ...)
{
va_list list;
XVaNestedList attr;
@ -3245,7 +3254,8 @@ gdk_ic_get_events (GdkIC ic)
return mask;
}
static void gdk_ic_cleanup (void)
static void
gdk_ic_cleanup (void)
{
GList* node;
gint destroyed;
@ -3270,6 +3280,83 @@ static void gdk_ic_cleanup (void)
xim_ic_list = NULL;
}
#else /* !USE_XIM */
void
gdk_im_begin (GdkIC ic, GdkWindow* window)
{
}
void
gdk_im_end (void)
{
}
GdkIMStyle
gdk_im_decide_style (GdkIMStyle supported_style)
{
return GdkIMPreeditNone | GdkIMStatusNone;
}
GdkIMStyle
gdk_im_set_best_style (GdkIMStyle style)
{
return GdkIMPreeditNone | GdkIMStatusNone;
}
gint
gdk_im_ready (void)
{
return FALSE;
}
GdkIC
gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...)
{
return NULL;
}
void
gdk_ic_destroy (GdkIC ic)
{
}
GdkIMStyle
gdk_ic_get_style (GdkIC ic)
{
return GdkIMPreeditNone | GdkIMStatusNone;
}
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)
{
return 0;
}
#endif /* USE_XIM */
#ifdef X_LOCALE
gint
@ -3298,8 +3385,6 @@ _g_mbtowc (wchar_t *wstr, const char *str, size_t len)
#endif /* X_LOCALE */
#endif /* USE_XIM */
static void
gdk_dnd_drag_leave (Window dest)
{

View File

@ -21,6 +21,7 @@
#include <X11/extensions/shape.h>
#include <netinet/in.h>
#include "gdk.h"
#include "../config.h"
#include "gdkinput.h"
#include "gdkprivate.h"
#include <stdlib.h>

View File

@ -5,6 +5,7 @@ _libs
libglib.la
config.log
glibconfig.h
glib.h
libtool
config.status
stamp-h