diff options
author | marha <marha@users.sourceforge.net> | 2011-10-19 12:11:26 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-10-19 12:11:26 +0200 |
commit | 1e90ede4237374dfbb2c8c506a906233bcfd3c5d (patch) | |
tree | 13b59b0ab2715fd0bb9eea788c73b08f3b07c01e /libX11 | |
parent | baf98f9bb36f956245d83ecd04f90625d6d68d2b (diff) | |
parent | 9f986778bd4393c5a9108426969d45aa7f10f334 (diff) | |
download | vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.gz vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.bz2 vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/include/os.h
Diffstat (limited to 'libX11')
-rw-r--r-- | libX11/include/X11/Xlib.h | 1 | ||||
-rw-r--r-- | libX11/include/X11/Xutil.h | 1652 | ||||
-rw-r--r-- | libX11/modules/im/ximcp/imDefFlt.c | 830 | ||||
-rw-r--r-- | libX11/modules/im/ximcp/imDefIc.c | 4 | ||||
-rw-r--r-- | libX11/modules/im/ximcp/imDefLkup.c | 12 | ||||
-rw-r--r-- | libX11/modules/im/ximcp/imExten.c | 1152 | ||||
-rw-r--r-- | libX11/modules/im/ximcp/imRm.c | 18 | ||||
-rw-r--r-- | libX11/nls/en_US.UTF-8/Compose.pre | 13 | ||||
-rw-r--r-- | libX11/src/xlibi18n/XimintP.h | 628 |
9 files changed, 2152 insertions, 2158 deletions
diff --git a/libX11/include/X11/Xlib.h b/libX11/include/X11/Xlib.h index b32390894..3a73d7b83 100644 --- a/libX11/include/X11/Xlib.h +++ b/libX11/include/X11/Xlib.h @@ -1691,6 +1691,7 @@ extern XHostAddress *XListHosts( int* /* nhosts_return */, Bool* /* state_return */ ); +_X_DEPRECATED extern KeySym XKeycodeToKeysym( Display* /* display */, #if NeedWidePrototypes diff --git a/libX11/include/X11/Xutil.h b/libX11/include/X11/Xutil.h index a97f489f1..8cab50e7d 100644 --- a/libX11/include/X11/Xutil.h +++ b/libX11/include/X11/Xutil.h @@ -1,826 +1,826 @@ -
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef _X11_XUTIL_H_
-#define _X11_XUTIL_H_
-
-/* You must include <X11/Xlib.h> before including this file */
-#include <X11/Xlib.h>
-#include <X11/keysym.h>
-
-/*
- * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
- * value (x, y, width, height) was found in the parsed string.
- */
-#define NoValue 0x0000
-#define XValue 0x0001
-#define YValue 0x0002
-#define WidthValue 0x0004
-#define HeightValue 0x0008
-#define AllValues 0x000F
-#define XNegative 0x0010
-#define YNegative 0x0020
-
-/*
- * new version containing base_width, base_height, and win_gravity fields;
- * used with WM_NORMAL_HINTS.
- */
-typedef struct {
- long flags; /* marks which fields in this structure are defined */
- int x, y; /* obsolete for new window mgrs, but clients */
- int width, height; /* should set so old wm's don't mess up */
- int min_width, min_height;
- int max_width, max_height;
- int width_inc, height_inc;
- struct {
- int x; /* numerator */
- int y; /* denominator */
- } min_aspect, max_aspect;
- int base_width, base_height; /* added by ICCCM version 1 */
- int win_gravity; /* added by ICCCM version 1 */
-} XSizeHints;
-
-/*
- * The next block of definitions are for window manager properties that
- * clients and applications use for communication.
- */
-
-/* flags argument in size hints */
-#define USPosition (1L << 0) /* user specified x, y */
-#define USSize (1L << 1) /* user specified width, height */
-
-#define PPosition (1L << 2) /* program specified position */
-#define PSize (1L << 3) /* program specified size */
-#define PMinSize (1L << 4) /* program specified minimum size */
-#define PMaxSize (1L << 5) /* program specified maximum size */
-#define PResizeInc (1L << 6) /* program specified resize increments */
-#define PAspect (1L << 7) /* program specified min and max aspect ratios */
-#define PBaseSize (1L << 8) /* program specified base for incrementing */
-#define PWinGravity (1L << 9) /* program specified window gravity */
-
-/* obsolete */
-#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
-
-
-
-typedef struct {
- long flags; /* marks which fields in this structure are defined */
- Bool input; /* does this application rely on the window manager to
- get keyboard input? */
- int initial_state; /* see below */
- Pixmap icon_pixmap; /* pixmap to be used as icon */
- Window icon_window; /* window to be used as icon */
- int icon_x, icon_y; /* initial position of icon */
- Pixmap icon_mask; /* icon mask bitmap */
- XID window_group; /* id of related window group */
- /* this structure may be extended in the future */
-} XWMHints;
-
-/* definition for flags of XWMHints */
-
-#define InputHint (1L << 0)
-#define StateHint (1L << 1)
-#define IconPixmapHint (1L << 2)
-#define IconWindowHint (1L << 3)
-#define IconPositionHint (1L << 4)
-#define IconMaskHint (1L << 5)
-#define WindowGroupHint (1L << 6)
-#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
-IconPositionHint|IconMaskHint|WindowGroupHint)
-#define XUrgencyHint (1L << 8)
-
-/* definitions for initial window state */
-#define WithdrawnState 0 /* for windows that are not mapped */
-#define NormalState 1 /* most applications want to start this way */
-#define IconicState 3 /* application wants to start as an icon */
-
-/*
- * Obsolete states no longer defined by ICCCM
- */
-#define DontCareState 0 /* don't know or care */
-#define ZoomState 2 /* application wants to start zoomed */
-#define InactiveState 4 /* application believes it is seldom used; */
- /* some wm's may put it on inactive menu */
-
-
-/*
- * new structure for manipulating TEXT properties; used with WM_NAME,
- * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
- */
-typedef struct {
- unsigned char *value; /* same as Property routines */
- Atom encoding; /* prop type */
- int format; /* prop data format: 8, 16, or 32 */
- unsigned long nitems; /* number of data items in value */
-} XTextProperty;
-
-#define XNoMemory -1
-#define XLocaleNotSupported -2
-#define XConverterNotFound -3
-
-typedef enum {
- XStringStyle, /* STRING */
- XCompoundTextStyle, /* COMPOUND_TEXT */
- XTextStyle, /* text in owner's encoding (current locale)*/
- XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
- /* The following is an XFree86 extension, introduced in November 2000 */
- XUTF8StringStyle /* UTF8_STRING */
-} XICCEncodingStyle;
-
-typedef struct {
- int min_width, min_height;
- int max_width, max_height;
- int width_inc, height_inc;
-} XIconSize;
-
-typedef struct {
- char *res_name;
- char *res_class;
-} XClassHint;
-
-#ifdef XUTIL_DEFINE_FUNCTIONS
-extern int XDestroyImage(
- XImage *ximage);
-extern unsigned long XGetPixel(
- XImage *ximage,
- int x, int y);
-extern int XPutPixel(
- XImage *ximage,
- int x, int y,
- unsigned long pixel);
-extern XImage *XSubImage(
- XImage *ximage,
- int x, int y,
- unsigned int width, unsigned int height);
-extern int XAddPixel(
- XImage *ximage,
- long value);
-#else
-/*
- * These macros are used to give some sugar to the image routines so that
- * naive people are more comfortable with them.
- */
-#define XDestroyImage(ximage) \
- ((*((ximage)->f.destroy_image))((ximage)))
-#define XGetPixel(ximage, x, y) \
- ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
-#define XPutPixel(ximage, x, y, pixel) \
- ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
-#define XSubImage(ximage, x, y, width, height) \
- ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
-#define XAddPixel(ximage, value) \
- ((*((ximage)->f.add_pixel))((ximage), (value)))
-#endif
-
-/*
- * Compose sequence status structure, used in calling XLookupString.
- */
-typedef struct _XComposeStatus {
- XPointer compose_ptr; /* state table pointer */
- int chars_matched; /* match state */
-} XComposeStatus;
-
-/*
- * Keysym macros, used on Keysyms to test for classes of symbols
- */
-#define IsKeypadKey(keysym) \
- (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
-
-#define IsPrivateKeypadKey(keysym) \
- (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
-
-#define IsCursorKey(keysym) \
- (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
-
-#define IsPFKey(keysym) \
- (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
-
-#define IsFunctionKey(keysym) \
- (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
-
-#define IsMiscFunctionKey(keysym) \
- (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
-
-#ifdef XK_XKB_KEYS
-#define IsModifierKey(keysym) \
- ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
- || (((KeySym)(keysym) >= XK_ISO_Lock) && \
- ((KeySym)(keysym) <= XK_ISO_Last_Group_Lock)) \
- || ((KeySym)(keysym) == XK_Mode_switch) \
- || ((KeySym)(keysym) == XK_Num_Lock))
-#else
-#define IsModifierKey(keysym) \
- ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
- || ((KeySym)(keysym) == XK_Mode_switch) \
- || ((KeySym)(keysym) == XK_Num_Lock))
-#endif
-/*
- * opaque reference to Region data type
- */
-typedef struct _XRegion *Region;
-
-/* Return values from XRectInRegion() */
-
-#define RectangleOut 0
-#define RectangleIn 1
-#define RectanglePart 2
-
-
-/*
- * Information used by the visual utility routines to find desired visual
- * type from the many visuals a display may support.
- */
-
-typedef struct {
- Visual *visual;
- VisualID visualid;
- int screen;
- int depth;
-#if defined(__cplusplus) || defined(c_plusplus)
- int c_class; /* C++ */
-#else
- int class;
-#endif
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- int colormap_size;
- int bits_per_rgb;
-} XVisualInfo;
-
-#define VisualNoMask 0x0
-#define VisualIDMask 0x1
-#define VisualScreenMask 0x2
-#define VisualDepthMask 0x4
-#define VisualClassMask 0x8
-#define VisualRedMaskMask 0x10
-#define VisualGreenMaskMask 0x20
-#define VisualBlueMaskMask 0x40
-#define VisualColormapSizeMask 0x80
-#define VisualBitsPerRGBMask 0x100
-#define VisualAllMask 0x1FF
-
-/*
- * This defines a window manager property that clients may use to
- * share standard color maps of type RGB_COLOR_MAP:
- */
-typedef struct {
- Colormap colormap;
- unsigned long red_max;
- unsigned long red_mult;
- unsigned long green_max;
- unsigned long green_mult;
- unsigned long blue_max;
- unsigned long blue_mult;
- unsigned long base_pixel;
- VisualID visualid; /* added by ICCCM version 1 */
- XID killid; /* added by ICCCM version 1 */
-} XStandardColormap;
-
-#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
-
-
-/*
- * return codes for XReadBitmapFile and XWriteBitmapFile
- */
-#define BitmapSuccess 0
-#define BitmapOpenFailed 1
-#define BitmapFileInvalid 2
-#define BitmapNoMemory 3
-
-/****************************************************************
- *
- * Context Management
- *
- ****************************************************************/
-
-
-/* Associative lookup table return codes */
-
-#define XCSUCCESS 0 /* No error. */
-#define XCNOMEM 1 /* Out of memory */
-#define XCNOENT 2 /* No entry in table */
-
-typedef int XContext;
-
-#define XUniqueContext() ((XContext) XrmUniqueQuark())
-#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
-
-_XFUNCPROTOBEGIN
-
-/* The following declarations are alphabetized. */
-
-extern XClassHint *XAllocClassHint (
- void
-);
-
-extern XIconSize *XAllocIconSize (
- void
-);
-
-extern XSizeHints *XAllocSizeHints (
- void
-);
-
-extern XStandardColormap *XAllocStandardColormap (
- void
-);
-
-extern XWMHints *XAllocWMHints (
- void
-);
-
-extern int XClipBox(
- Region /* r */,
- XRectangle* /* rect_return */
-);
-
-extern Region XCreateRegion(
- void
-);
-
-extern const char *XDefaultString (void);
-
-extern int XDeleteContext(
- Display* /* display */,
- XID /* rid */,
- XContext /* context */
-);
-
-extern int XDestroyRegion(
- Region /* r */
-);
-
-extern int XEmptyRegion(
- Region /* r */
-);
-
-extern int XEqualRegion(
- Region /* r1 */,
- Region /* r2 */
-);
-
-extern int XFindContext(
- Display* /* display */,
- XID /* rid */,
- XContext /* context */,
- XPointer* /* data_return */
-);
-
-extern Status XGetClassHint(
- Display* /* display */,
- Window /* w */,
- XClassHint* /* class_hints_return */
-);
-
-extern Status XGetIconSizes(
- Display* /* display */,
- Window /* w */,
- XIconSize** /* size_list_return */,
- int* /* count_return */
-);
-
-extern Status XGetNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */
-);
-
-extern Status XGetRGBColormaps(
- Display* /* display */,
- Window /* w */,
- XStandardColormap** /* stdcmap_return */,
- int* /* count_return */,
- Atom /* property */
-);
-
-extern Status XGetSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */,
- Atom /* property */
-);
-
-extern Status XGetStandardColormap(
- Display* /* display */,
- Window /* w */,
- XStandardColormap* /* colormap_return */,
- Atom /* property */
-);
-
-extern Status XGetTextProperty(
- Display* /* display */,
- Window /* window */,
- XTextProperty* /* text_prop_return */,
- Atom /* property */
-);
-
-extern XVisualInfo *XGetVisualInfo(
- Display* /* display */,
- long /* vinfo_mask */,
- XVisualInfo* /* vinfo_template */,
- int* /* nitems_return */
-);
-
-extern Status XGetWMClientMachine(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop_return */
-);
-
-extern XWMHints *XGetWMHints(
- Display* /* display */,
- Window /* w */
-);
-
-extern Status XGetWMIconName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop_return */
-);
-
-extern Status XGetWMName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop_return */
-);
-
-extern Status XGetWMNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */,
- long* /* supplied_return */
-);
-
-extern Status XGetWMSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */,
- long* /* supplied_return */,
- Atom /* property */
-);
-
-extern Status XGetZoomHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* zhints_return */
-);
-
-extern int XIntersectRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-extern void XConvertCase(
- KeySym /* sym */,
- KeySym* /* lower */,
- KeySym* /* upper */
-);
-
-extern int XLookupString(
- XKeyEvent* /* event_struct */,
- char* /* buffer_return */,
- int /* bytes_buffer */,
- KeySym* /* keysym_return */,
- XComposeStatus* /* status_in_out */
-);
-
-extern Status XMatchVisualInfo(
- Display* /* display */,
- int /* screen */,
- int /* depth */,
- int /* class */,
- XVisualInfo* /* vinfo_return */
-);
-
-extern int XOffsetRegion(
- Region /* r */,
- int /* dx */,
- int /* dy */
-);
-
-extern Bool XPointInRegion(
- Region /* r */,
- int /* x */,
- int /* y */
-);
-
-extern Region XPolygonRegion(
- XPoint* /* points */,
- int /* n */,
- int /* fill_rule */
-);
-
-extern int XRectInRegion(
- Region /* r */,
- int /* x */,
- int /* y */,
- unsigned int /* width */,
- unsigned int /* height */
-);
-
-extern int XSaveContext(
- Display* /* display */,
- XID /* rid */,
- XContext /* context */,
- _Xconst char* /* data */
-);
-
-extern int XSetClassHint(
- Display* /* display */,
- Window /* w */,
- XClassHint* /* class_hints */
-);
-
-extern int XSetIconSizes(
- Display* /* display */,
- Window /* w */,
- XIconSize* /* size_list */,
- int /* count */
-);
-
-extern int XSetNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */
-);
-
-extern void XSetRGBColormaps(
- Display* /* display */,
- Window /* w */,
- XStandardColormap* /* stdcmaps */,
- int /* count */,
- Atom /* property */
-);
-
-extern int XSetSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */,
- Atom /* property */
-);
-
-extern int XSetStandardProperties(
- Display* /* display */,
- Window /* w */,
- _Xconst char* /* window_name */,
- _Xconst char* /* icon_name */,
- Pixmap /* icon_pixmap */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* hints */
-);
-
-extern void XSetTextProperty(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */,
- Atom /* property */
-);
-
-extern void XSetWMClientMachine(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */
-);
-
-extern int XSetWMHints(
- Display* /* display */,
- Window /* w */,
- XWMHints* /* wm_hints */
-);
-
-extern void XSetWMIconName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */
-);
-
-extern void XSetWMName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */
-);
-
-extern void XSetWMNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */
-);
-
-extern void XSetWMProperties(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* window_name */,
- XTextProperty* /* icon_name */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* normal_hints */,
- XWMHints* /* wm_hints */,
- XClassHint* /* class_hints */
-);
-
-extern void XmbSetWMProperties(
- Display* /* display */,
- Window /* w */,
- _Xconst char* /* window_name */,
- _Xconst char* /* icon_name */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* normal_hints */,
- XWMHints* /* wm_hints */,
- XClassHint* /* class_hints */
-);
-
-extern void Xutf8SetWMProperties(
- Display* /* display */,
- Window /* w */,
- _Xconst char* /* window_name */,
- _Xconst char* /* icon_name */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* normal_hints */,
- XWMHints* /* wm_hints */,
- XClassHint* /* class_hints */
-);
-
-extern void XSetWMSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */,
- Atom /* property */
-);
-
-extern int XSetRegion(
- Display* /* display */,
- GC /* gc */,
- Region /* r */
-);
-
-extern void XSetStandardColormap(
- Display* /* display */,
- Window /* w */,
- XStandardColormap* /* colormap */,
- Atom /* property */
-);
-
-extern int XSetZoomHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* zhints */
-);
-
-extern int XShrinkRegion(
- Region /* r */,
- int /* dx */,
- int /* dy */
-);
-
-extern Status XStringListToTextProperty(
- char** /* list */,
- int /* count */,
- XTextProperty* /* text_prop_return */
-);
-
-extern int XSubtractRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-extern int XmbTextListToTextProperty(
- Display* display,
- char** list,
- int count,
- XICCEncodingStyle style,
- XTextProperty* text_prop_return
-);
-
-extern int XwcTextListToTextProperty(
- Display* display,
- wchar_t** list,
- int count,
- XICCEncodingStyle style,
- XTextProperty* text_prop_return
-);
-
-extern int Xutf8TextListToTextProperty(
- Display* display,
- char** list,
- int count,
- XICCEncodingStyle style,
- XTextProperty* text_prop_return
-);
-
-extern void XwcFreeStringList(
- wchar_t** list
-);
-
-extern Status XTextPropertyToStringList(
- XTextProperty* /* text_prop */,
- char*** /* list_return */,
- int* /* count_return */
-);
-
-extern int XmbTextPropertyToTextList(
- Display* display,
- const XTextProperty* text_prop,
- char*** list_return,
- int* count_return
-);
-
-extern int XwcTextPropertyToTextList(
- Display* display,
- const XTextProperty* text_prop,
- wchar_t*** list_return,
- int* count_return
-);
-
-extern int Xutf8TextPropertyToTextList(
- Display* display,
- const XTextProperty* text_prop,
- char*** list_return,
- int* count_return
-);
-
-extern int XUnionRectWithRegion(
- XRectangle* /* rectangle */,
- Region /* src_region */,
- Region /* dest_region_return */
-);
-
-extern int XUnionRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-extern int XWMGeometry(
- Display* /* display */,
- int /* screen_number */,
- _Xconst char* /* user_geometry */,
- _Xconst char* /* default_geometry */,
- unsigned int /* border_width */,
- XSizeHints* /* hints */,
- int* /* x_return */,
- int* /* y_return */,
- int* /* width_return */,
- int* /* height_return */,
- int* /* gravity_return */
-);
-
-extern int XXorRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-_XFUNCPROTOEND
-
-#endif /* _X11_XUTIL_H_ */
+ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _X11_XUTIL_H_ +#define _X11_XUTIL_H_ + +/* You must include <X11/Xlib.h> before including this file */ +#include <X11/Xlib.h> +#include <X11/keysym.h> + +/* + * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding + * value (x, y, width, height) was found in the parsed string. + */ +#define NoValue 0x0000 +#define XValue 0x0001 +#define YValue 0x0002 +#define WidthValue 0x0004 +#define HeightValue 0x0008 +#define AllValues 0x000F +#define XNegative 0x0010 +#define YNegative 0x0020 + +/* + * new version containing base_width, base_height, and win_gravity fields; + * used with WM_NORMAL_HINTS. + */ +typedef struct { + long flags; /* marks which fields in this structure are defined */ + int x, y; /* obsolete for new window mgrs, but clients */ + int width, height; /* should set so old wm's don't mess up */ + int min_width, min_height; + int max_width, max_height; + int width_inc, height_inc; + struct { + int x; /* numerator */ + int y; /* denominator */ + } min_aspect, max_aspect; + int base_width, base_height; /* added by ICCCM version 1 */ + int win_gravity; /* added by ICCCM version 1 */ +} XSizeHints; + +/* + * The next block of definitions are for window manager properties that + * clients and applications use for communication. + */ + +/* flags argument in size hints */ +#define USPosition (1L << 0) /* user specified x, y */ +#define USSize (1L << 1) /* user specified width, height */ + +#define PPosition (1L << 2) /* program specified position */ +#define PSize (1L << 3) /* program specified size */ +#define PMinSize (1L << 4) /* program specified minimum size */ +#define PMaxSize (1L << 5) /* program specified maximum size */ +#define PResizeInc (1L << 6) /* program specified resize increments */ +#define PAspect (1L << 7) /* program specified min and max aspect ratios */ +#define PBaseSize (1L << 8) /* program specified base for incrementing */ +#define PWinGravity (1L << 9) /* program specified window gravity */ + +/* obsolete */ +#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) + + + +typedef struct { + long flags; /* marks which fields in this structure are defined */ + Bool input; /* does this application rely on the window manager to + get keyboard input? */ + int initial_state; /* see below */ + Pixmap icon_pixmap; /* pixmap to be used as icon */ + Window icon_window; /* window to be used as icon */ + int icon_x, icon_y; /* initial position of icon */ + Pixmap icon_mask; /* icon mask bitmap */ + XID window_group; /* id of related window group */ + /* this structure may be extended in the future */ +} XWMHints; + +/* definition for flags of XWMHints */ + +#define InputHint (1L << 0) +#define StateHint (1L << 1) +#define IconPixmapHint (1L << 2) +#define IconWindowHint (1L << 3) +#define IconPositionHint (1L << 4) +#define IconMaskHint (1L << 5) +#define WindowGroupHint (1L << 6) +#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ +IconPositionHint|IconMaskHint|WindowGroupHint) +#define XUrgencyHint (1L << 8) + +/* definitions for initial window state */ +#define WithdrawnState 0 /* for windows that are not mapped */ +#define NormalState 1 /* most applications want to start this way */ +#define IconicState 3 /* application wants to start as an icon */ + +/* + * Obsolete states no longer defined by ICCCM + */ +#define DontCareState 0 /* don't know or care */ +#define ZoomState 2 /* application wants to start zoomed */ +#define InactiveState 4 /* application believes it is seldom used; */ + /* some wm's may put it on inactive menu */ + + +/* + * new structure for manipulating TEXT properties; used with WM_NAME, + * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. + */ +typedef struct { + unsigned char *value; /* same as Property routines */ + Atom encoding; /* prop type */ + int format; /* prop data format: 8, 16, or 32 */ + unsigned long nitems; /* number of data items in value */ +} XTextProperty; + +#define XNoMemory -1 +#define XLocaleNotSupported -2 +#define XConverterNotFound -3 + +typedef enum { + XStringStyle, /* STRING */ + XCompoundTextStyle, /* COMPOUND_TEXT */ + XTextStyle, /* text in owner's encoding (current locale)*/ + XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ + /* The following is an XFree86 extension, introduced in November 2000 */ + XUTF8StringStyle /* UTF8_STRING */ +} XICCEncodingStyle; + +typedef struct { + int min_width, min_height; + int max_width, max_height; + int width_inc, height_inc; +} XIconSize; + +typedef struct { + char *res_name; + char *res_class; +} XClassHint; + +#ifdef XUTIL_DEFINE_FUNCTIONS +extern int XDestroyImage( + XImage *ximage); +extern unsigned long XGetPixel( + XImage *ximage, + int x, int y); +extern int XPutPixel( + XImage *ximage, + int x, int y, + unsigned long pixel); +extern XImage *XSubImage( + XImage *ximage, + int x, int y, + unsigned int width, unsigned int height); +extern int XAddPixel( + XImage *ximage, + long value); +#else +/* + * These macros are used to give some sugar to the image routines so that + * naive people are more comfortable with them. + */ +#define XDestroyImage(ximage) \ + ((*((ximage)->f.destroy_image))((ximage))) +#define XGetPixel(ximage, x, y) \ + ((*((ximage)->f.get_pixel))((ximage), (x), (y))) +#define XPutPixel(ximage, x, y, pixel) \ + ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) +#define XSubImage(ximage, x, y, width, height) \ + ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) +#define XAddPixel(ximage, value) \ + ((*((ximage)->f.add_pixel))((ximage), (value))) +#endif + +/* + * Compose sequence status structure, used in calling XLookupString. + */ +typedef struct _XComposeStatus { + XPointer compose_ptr; /* state table pointer */ + int chars_matched; /* match state */ +} XComposeStatus; + +/* + * Keysym macros, used on Keysyms to test for classes of symbols + */ +#define IsKeypadKey(keysym) \ + (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) + +#define IsPrivateKeypadKey(keysym) \ + (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) + +#define IsCursorKey(keysym) \ + (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) + +#define IsPFKey(keysym) \ + (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) + +#define IsFunctionKey(keysym) \ + (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) + +#define IsMiscFunctionKey(keysym) \ + (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) + +#ifdef XK_XKB_KEYS +#define IsModifierKey(keysym) \ + ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ + || (((KeySym)(keysym) >= XK_ISO_Lock) && \ + ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \ + || ((KeySym)(keysym) == XK_Mode_switch) \ + || ((KeySym)(keysym) == XK_Num_Lock)) +#else +#define IsModifierKey(keysym) \ + ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ + || ((KeySym)(keysym) == XK_Mode_switch) \ + || ((KeySym)(keysym) == XK_Num_Lock)) +#endif +/* + * opaque reference to Region data type + */ +typedef struct _XRegion *Region; + +/* Return values from XRectInRegion() */ + +#define RectangleOut 0 +#define RectangleIn 1 +#define RectanglePart 2 + + +/* + * Information used by the visual utility routines to find desired visual + * type from the many visuals a display may support. + */ + +typedef struct { + Visual *visual; + VisualID visualid; + int screen; + int depth; +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ */ +#else + int class; +#endif + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + int colormap_size; + int bits_per_rgb; +} XVisualInfo; + +#define VisualNoMask 0x0 +#define VisualIDMask 0x1 +#define VisualScreenMask 0x2 +#define VisualDepthMask 0x4 +#define VisualClassMask 0x8 +#define VisualRedMaskMask 0x10 +#define VisualGreenMaskMask 0x20 +#define VisualBlueMaskMask 0x40 +#define VisualColormapSizeMask 0x80 +#define VisualBitsPerRGBMask 0x100 +#define VisualAllMask 0x1FF + +/* + * This defines a window manager property that clients may use to + * share standard color maps of type RGB_COLOR_MAP: + */ +typedef struct { + Colormap colormap; + unsigned long red_max; + unsigned long red_mult; + unsigned long green_max; + unsigned long green_mult; + unsigned long blue_max; + unsigned long blue_mult; + unsigned long base_pixel; + VisualID visualid; /* added by ICCCM version 1 */ + XID killid; /* added by ICCCM version 1 */ +} XStandardColormap; + +#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ + + +/* + * return codes for XReadBitmapFile and XWriteBitmapFile + */ +#define BitmapSuccess 0 +#define BitmapOpenFailed 1 +#define BitmapFileInvalid 2 +#define BitmapNoMemory 3 + +/**************************************************************** + * + * Context Management + * + ****************************************************************/ + + +/* Associative lookup table return codes */ + +#define XCSUCCESS 0 /* No error. */ +#define XCNOMEM 1 /* Out of memory */ +#define XCNOENT 2 /* No entry in table */ + +typedef int XContext; + +#define XUniqueContext() ((XContext) XrmUniqueQuark()) +#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) + +_XFUNCPROTOBEGIN + +/* The following declarations are alphabetized. */ + +extern XClassHint *XAllocClassHint ( + void +); + +extern XIconSize *XAllocIconSize ( + void +); + +extern XSizeHints *XAllocSizeHints ( + void +); + +extern XStandardColormap *XAllocStandardColormap ( + void +); + +extern XWMHints *XAllocWMHints ( + void +); + +extern int XClipBox( + Region /* r */, + XRectangle* /* rect_return */ +); + +extern Region XCreateRegion( + void +); + +extern const char *XDefaultString (void); + +extern int XDeleteContext( + Display* /* display */, + XID /* rid */, + XContext /* context */ +); + +extern int XDestroyRegion( + Region /* r */ +); + +extern int XEmptyRegion( + Region /* r */ +); + +extern int XEqualRegion( + Region /* r1 */, + Region /* r2 */ +); + +extern int XFindContext( + Display* /* display */, + XID /* rid */, + XContext /* context */, + XPointer* /* data_return */ +); + +extern Status XGetClassHint( + Display* /* display */, + Window /* w */, + XClassHint* /* class_hints_return */ +); + +extern Status XGetIconSizes( + Display* /* display */, + Window /* w */, + XIconSize** /* size_list_return */, + int* /* count_return */ +); + +extern Status XGetNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */ +); + +extern Status XGetRGBColormaps( + Display* /* display */, + Window /* w */, + XStandardColormap** /* stdcmap_return */, + int* /* count_return */, + Atom /* property */ +); + +extern Status XGetSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + Atom /* property */ +); + +extern Status XGetStandardColormap( + Display* /* display */, + Window /* w */, + XStandardColormap* /* colormap_return */, + Atom /* property */ +); + +extern Status XGetTextProperty( + Display* /* display */, + Window /* window */, + XTextProperty* /* text_prop_return */, + Atom /* property */ +); + +extern XVisualInfo *XGetVisualInfo( + Display* /* display */, + long /* vinfo_mask */, + XVisualInfo* /* vinfo_template */, + int* /* nitems_return */ +); + +extern Status XGetWMClientMachine( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern XWMHints *XGetWMHints( + Display* /* display */, + Window /* w */ +); + +extern Status XGetWMIconName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern Status XGetWMName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern Status XGetWMNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + long* /* supplied_return */ +); + +extern Status XGetWMSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + long* /* supplied_return */, + Atom /* property */ +); + +extern Status XGetZoomHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* zhints_return */ +); + +extern int XIntersectRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern void XConvertCase( + KeySym /* sym */, + KeySym* /* lower */, + KeySym* /* upper */ +); + +extern int XLookupString( + XKeyEvent* /* event_struct */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + XComposeStatus* /* status_in_out */ +); + +extern Status XMatchVisualInfo( + Display* /* display */, + int /* screen */, + int /* depth */, + int /* class */, + XVisualInfo* /* vinfo_return */ +); + +extern int XOffsetRegion( + Region /* r */, + int /* dx */, + int /* dy */ +); + +extern Bool XPointInRegion( + Region /* r */, + int /* x */, + int /* y */ +); + +extern Region XPolygonRegion( + XPoint* /* points */, + int /* n */, + int /* fill_rule */ +); + +extern int XRectInRegion( + Region /* r */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XSaveContext( + Display* /* display */, + XID /* rid */, + XContext /* context */, + _Xconst char* /* data */ +); + +extern int XSetClassHint( + Display* /* display */, + Window /* w */, + XClassHint* /* class_hints */ +); + +extern int XSetIconSizes( + Display* /* display */, + Window /* w */, + XIconSize* /* size_list */, + int /* count */ +); + +extern int XSetNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */ +); + +extern void XSetRGBColormaps( + Display* /* display */, + Window /* w */, + XStandardColormap* /* stdcmaps */, + int /* count */, + Atom /* property */ +); + +extern int XSetSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */, + Atom /* property */ +); + +extern int XSetStandardProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + Pixmap /* icon_pixmap */, + char** /* argv */, + int /* argc */, + XSizeHints* /* hints */ +); + +extern void XSetTextProperty( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */, + Atom /* property */ +); + +extern void XSetWMClientMachine( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern int XSetWMHints( + Display* /* display */, + Window /* w */, + XWMHints* /* wm_hints */ +); + +extern void XSetWMIconName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern void XSetWMName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern void XSetWMNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */ +); + +extern void XSetWMProperties( + Display* /* display */, + Window /* w */, + XTextProperty* /* window_name */, + XTextProperty* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void XmbSetWMProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void Xutf8SetWMProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void XSetWMSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */, + Atom /* property */ +); + +extern int XSetRegion( + Display* /* display */, + GC /* gc */, + Region /* r */ +); + +extern void XSetStandardColormap( + Display* /* display */, + Window /* w */, + XStandardColormap* /* colormap */, + Atom /* property */ +); + +extern int XSetZoomHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* zhints */ +); + +extern int XShrinkRegion( + Region /* r */, + int /* dx */, + int /* dy */ +); + +extern Status XStringListToTextProperty( + char** /* list */, + int /* count */, + XTextProperty* /* text_prop_return */ +); + +extern int XSubtractRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern int XmbTextListToTextProperty( + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern int XwcTextListToTextProperty( + Display* display, + wchar_t** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern int Xutf8TextListToTextProperty( + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern void XwcFreeStringList( + wchar_t** list +); + +extern Status XTextPropertyToStringList( + XTextProperty* /* text_prop */, + char*** /* list_return */, + int* /* count_return */ +); + +extern int XmbTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +extern int XwcTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + wchar_t*** list_return, + int* count_return +); + +extern int Xutf8TextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +extern int XUnionRectWithRegion( + XRectangle* /* rectangle */, + Region /* src_region */, + Region /* dest_region_return */ +); + +extern int XUnionRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern int XWMGeometry( + Display* /* display */, + int /* screen_number */, + _Xconst char* /* user_geometry */, + _Xconst char* /* default_geometry */, + unsigned int /* border_width */, + XSizeHints* /* hints */, + int* /* x_return */, + int* /* y_return */, + int* /* width_return */, + int* /* height_return */, + int* /* gravity_return */ +); + +extern int XXorRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +_XFUNCPROTOEND + +#endif /* _X11_XUTIL_H_ */ diff --git a/libX11/modules/im/ximcp/imDefFlt.c b/libX11/modules/im/ximcp/imDefFlt.c index 3de28be4f..1e4f3895b 100644 --- a/libX11/modules/im/ximcp/imDefFlt.c +++ b/libX11/modules/im/ximcp/imDefFlt.c @@ -1,417 +1,413 @@ -/******************************************************************
-
- Copyright 1992, 1993, 1994 by FUJITSU LIMITED
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of FUJITSU LIMITED
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-FUJITSU LIMITED makes no representations about the suitability of
-this software for any purpose.
-It is provided "as is" without express or implied warranty.
-
-FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
- Author: Takashi Fujiwara FUJITSU LIMITED
- fujiwara@a80.tech.yk.fujitsu.co.jp
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xatom.h>
-#include "Xlibint.h"
-#include "Xutil.h"
-#include "Xlcint.h"
-#include "Ximint.h"
-
-Private long
-_XimTriggerCheck(
- Xim im,
- XKeyEvent *ev,
- INT32 len,
- CARD32 *keylist)
-{
- register long i;
- KeySym keysym;
- CARD32 buf32[BUFSIZE/4];
- char *buf = (char *)buf32;
- int modifier;
- int modifier_mask;
- CARD32 min_len = sizeof(CARD32) /* sizeof keysym */
- + sizeof(CARD32) /* sizeof modifier */
- + sizeof(CARD32); /* sizeof modifier mask */
-
- XLookupString(ev, buf, BUFSIZE, &keysym, NULL);
- if (!keysym)
- return -1;
-
- for (i = 0; len >= min_len; i += 3, len -= min_len) {
- modifier = keylist[i + 1];
- modifier_mask = keylist[i + 2];
- if (((KeySym)keylist[i] == keysym)
- && ((ev->state & modifier_mask) == modifier))
- return i;
- }
- return -1;
-}
-
-Private long
-_XimTriggerOnCheck(
- Xim im,
- XKeyEvent *ev)
-{
- return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_onkeylist[0],
- &im->private.proto.im_onkeylist[1]);
-}
-
-Private long
-_XimTriggerOffCheck(
- Xim im,
- XKeyEvent *ev)
-{
- return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_offkeylist[0],
- &im->private.proto.im_offkeylist[1]);
-}
-
-Private Bool
-_XimOnKeysCheck(
- Xic ic,
- XKeyEvent *ev)
-{
- Xim im = (Xim)ic->core.im;
- long idx;
-
- if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) &&
- im->private.proto.im_onkeylist &&
- im->private.proto.im_onkeylist[0]) {
- if ((idx = _XimTriggerOnCheck(im, ev)) >= 0) {
- (void)_XimTriggerNotify(im, ic, 0, (CARD32)idx); /* Trigger on */
- return True;
- }
- }
- return False;
-}
-
-Private Bool
-_XimOffKeysCheck(
- Xic ic,
- XKeyEvent *ev)
-{
- Xim im = (Xim)ic->core.im;
- long idx;
-
- if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) &&
- im->private.proto.im_offkeylist &&
- im->private.proto.im_offkeylist[0]) {
- if ((idx = _XimTriggerOffCheck(im, ev)) >= 0) {
- _XimTriggerNotify(im, ic, 1, (CARD32)idx); /* Trigger off */
- return True;
- }
- }
- return False;
-}
-
-Private void
-_XimPendingFilter(
- Xic ic)
-{
- Xim im = (Xim)ic->core.im;
-
- if (IS_NEED_SYNC_REPLY(ic)) {
- (void)_XimProcSyncReply(im, ic);
- UNMARK_NEED_SYNC_REPLY(ic);
- }
- return;
-}
-
-Private Bool
-_XimProtoKeypressFilter(
- Xic ic,
- XKeyEvent *ev)
-{
-#ifdef XIM_CONNECTABLE
- Xim im = (Xim)ic->core.im;
-#endif
-
- if (IS_FABLICATED(ic)) {
- _XimPendingFilter(ic);
- UNMARK_FABLICATED(ic);
- return NOTFILTERD;
- }
-
- if (IS_NEGLECT_EVENT(ic, KeyPressMask))
- return FILTERD;
-
-#ifdef XIM_CONNECTABLE
- if (!IS_IC_CONNECTED(ic)) {
- if (IS_CONNECTABLE(im)) {
- if (_XimConnectServer(im)) {
- if (!_XimReCreateIC(ic)) {
- _XimDelayModeSetAttr(im);
- return NOTFILTERD;
- }
- } else {
- return NOTFILTERD;
- }
- } else {
- return NOTFILTERD;
- }
- }
-#else
- if (!IS_IC_CONNECTED(ic))
- return NOTFILTERD;
-#endif /* XIM_CONNECTABLE */
-
- if (!IS_FORWARD_EVENT(ic, KeyPressMask)) {
- if (_XimOnKeysCheck(ic, ev))
- return FILTERD;
- return NOTFILTERD;
- }
- if (_XimOffKeysCheck(ic, ev))
- return FILTERD;
-
- if (_XimForwardEvent(ic, (XEvent *)ev,
- IS_SYNCHRONOUS_EVENT(ic, KeyPressMask)))
- return FILTERD;
-
- return NOTFILTERD;
-}
-
-Private Bool
-_XimFilterKeypress(
- Display *d,
- Window w,
- XEvent *ev,
- XPointer client_data)
-{
- return _XimProtoKeypressFilter((Xic)client_data, (XKeyEvent *)ev );
-}
-
-Private Bool
-_XimProtoKeyreleaseFilter(
- Xic ic,
- XKeyEvent *ev)
-{
-#ifdef XIM_CONNECTABLE
- Xim im = (Xim)ic->core.im;
-#endif
-
- if (IS_FABLICATED(ic)) {
- _XimPendingFilter(ic);
- UNMARK_FABLICATED(ic);
- return NOTFILTERD;
- }
-
- if (IS_NEGLECT_EVENT(ic, KeyReleaseMask))
- return FILTERD;
-
-#ifdef XIM_CONNECTABLE
- if (!IS_IC_CONNECTED(ic)) {
- if (IS_CONNECTABLE(im)) {
- if (_XimConnectServer(im)) {
- if (!_XimReCreateIC(ic)) {
- _XimDelayModeSetAttr(im);
- return NOTFILTERD;
- }
- } else {
- return NOTFILTERD;
- }
- } else {
- return NOTFILTERD;
- }
- }
-#else
- if (!IS_IC_CONNECTED(ic))
- return NOTFILTERD;
-#endif /* XIM_CONNECTABLE */
-
- if (!IS_FORWARD_EVENT(ic, KeyReleaseMask)) {
- if (_XimOnKeysCheck(ic, ev))
- return FILTERD;
- return NOTFILTERD;
- }
- if (_XimOffKeysCheck(ic, ev))
- return FILTERD;
-
- if (_XimForwardEvent(ic, (XEvent *)ev,
- IS_SYNCHRONOUS_EVENT(ic, KeyPressMask)))
- return FILTERD;
-
- return NOTFILTERD;
-}
-
-Private Bool
-_XimFilterKeyrelease(
- Display *d,
- Window w,
- XEvent *ev,
- XPointer client_data)
-{
- return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev);
-}
-
-Private void
-_XimRegisterKeyPressFilter(
- Xic ic)
-{
- if (ic->core.focus_window) {
- if (!(ic->private.proto.registed_filter_event & KEYPRESS_MASK)) {
- _XRegisterFilterByType (ic->core.im->core.display,
- ic->core.focus_window,
- KeyPress, KeyPress,
- _XimFilterKeypress,
- (XPointer)ic);
- ic->private.proto.registed_filter_event |= KEYPRESS_MASK;
- }
- }
- return;
-}
-
-Private void
-_XimRegisterKeyReleaseFilter(
- Xic ic)
-{
- if (ic->core.focus_window) {
- if (!(ic->private.proto.registed_filter_event & KEYRELEASE_MASK)) {
- _XRegisterFilterByType (ic->core.im->core.display,
- ic->core.focus_window,
- KeyRelease, KeyRelease,
- _XimFilterKeyrelease,
- (XPointer)ic);
- ic->private.proto.registed_filter_event |= KEYRELEASE_MASK;
- }
- }
- return;
-}
-
-Private void
-_XimUnregisterKeyPressFilter(
- Xic ic)
-{
- if (ic->core.focus_window) {
- if (ic->private.proto.registed_filter_event & KEYPRESS_MASK) {
- _XUnregisterFilter (ic->core.im->core.display,
- ic->core.focus_window,
- _XimFilterKeypress,
- (XPointer)ic);
- ic->private.proto.registed_filter_event &= ~KEYPRESS_MASK;
- }
- }
- return;
-}
-
-Private void
-_XimUnregisterKeyReleaseFilter(
- Xic ic)
-{
- if (ic->core.focus_window) {
- if (ic->private.proto.registed_filter_event & KEYRELEASE_MASK) {
- _XUnregisterFilter (ic->core.im->core.display,
- ic->core.focus_window,
- _XimFilterKeyrelease,
- (XPointer)ic);
- ic->private.proto.registed_filter_event &= ~KEYRELEASE_MASK;
- }
- }
- return;
-}
-
-Public void
-_XimRegisterFilter(
- Xic ic)
-{
- _XimRegisterKeyPressFilter(ic);
- if (IS_FORWARD_EVENT(ic, KeyReleaseMask))
- _XimRegisterKeyReleaseFilter(ic);
- return;
-}
-
-Public void
-_XimUnregisterFilter(
- Xic ic)
-{
- _XimUnregisterKeyPressFilter(ic);
- _XimUnregisterKeyReleaseFilter(ic);
- return;
-}
-
-Public void
-_XimReregisterFilter(
- Xic ic)
-{
- if (IS_FORWARD_EVENT(ic, KeyReleaseMask))
- _XimRegisterKeyReleaseFilter(ic);
- else
- _XimUnregisterKeyReleaseFilter(ic);
-
- return;
-}
-
-Private Bool
-_XimFilterServerDestroy(
- Display *d,
- Window w,
- XEvent *ev,
- XPointer client_data)
-{
- Xim im = (Xim)client_data;
-
- if (ev->type == DestroyNotify) {
- UNMARK_SERVER_CONNECTED(im);
-#ifdef XIM_CONNECTABLE
- if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) {
- _XimServerReconectableDestroy();
- return True;
- }
-#endif /* XIM_CONNECTABLE */
- _XimServerDestroy(im);
- }
- return True;
-}
-
-Public void
-_XimRegisterServerFilter(
- Xim im)
-{
- if (im->private.proto.im_window) {
- if (!(im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK)) {
- _XRegisterFilterByMask(im->core.display,
- im->private.proto.im_window,
- StructureNotifyMask,
- _XimFilterServerDestroy,
- (XPointer)im);
- XSelectInput(im->core.display, im->private.proto.im_window,
- StructureNotifyMask);
- im->private.proto.registed_filter_event |= DESTROYNOTIFY_MASK;
- }
- }
- return;
-}
-
-Public void
-_XimUnregisterServerFilter(
- Xim im)
-{
- if (im->private.proto.im_window) {
- if (im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK) {
- _XUnregisterFilter(im->core.display,
- im->private.proto.im_window,
- _XimFilterServerDestroy,
- (XPointer)im);
- im->private.proto.registed_filter_event &= ~DESTROYNOTIFY_MASK;
- }
- }
- return;
-}
-
+/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and +that both that copyright notice and this permission notice appear +in supporting documentation, and that the name of FUJITSU LIMITED +not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +FUJITSU LIMITED makes no representations about the suitability of +this software for any purpose. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <X11/Xatom.h> +#include "Xlibint.h" +#include "Xutil.h" +#include "Xlcint.h" +#include "Ximint.h" + +Private long +_XimTriggerCheck( + Xim im, + XKeyEvent *ev, + INT32 len, + CARD32 *keylist) +{ + register long i; + KeySym keysym; + CARD32 buf32[BUFSIZE/4]; + char *buf = (char *)buf32; + int modifier; + int modifier_mask; + CARD32 min_len = sizeof(CARD32) /* sizeof keysym */ + + sizeof(CARD32) /* sizeof modifier */ + + sizeof(CARD32); /* sizeof modifier mask */ + + XLookupString(ev, buf, BUFSIZE, &keysym, NULL); + if (!keysym) + return -1; + + for (i = 0; len >= min_len; i += 3, len -= min_len) { + modifier = keylist[i + 1]; + modifier_mask = keylist[i + 2]; + if (((KeySym)keylist[i] == keysym) + && ((ev->state & modifier_mask) == modifier)) + return i; + } + return -1; +} + +Private long +_XimTriggerOnCheck( + Xim im, + XKeyEvent *ev) +{ + return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_onkeylist[0], + &im->private.proto.im_onkeylist[1]); +} + +Private long +_XimTriggerOffCheck( + Xim im, + XKeyEvent *ev) +{ + return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_offkeylist[0], + &im->private.proto.im_offkeylist[1]); +} + +Private Bool +_XimOnKeysCheck( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + long idx; + + if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && + im->private.proto.im_onkeylist && + im->private.proto.im_onkeylist[0]) { + if ((idx = _XimTriggerOnCheck(im, ev)) >= 0) { + (void)_XimTriggerNotify(im, ic, 0, (CARD32)idx); /* Trigger on */ + return True; + } + } + return False; +} + +Private Bool +_XimOffKeysCheck( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + long idx; + + if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && + im->private.proto.im_offkeylist && + im->private.proto.im_offkeylist[0]) { + if ((idx = _XimTriggerOffCheck(im, ev)) >= 0) { + _XimTriggerNotify(im, ic, 1, (CARD32)idx); /* Trigger off */ + return True; + } + } + return False; +} + +Private void +_XimPendingFilter( + Xic ic) +{ + Xim im = (Xim)ic->core.im; + + if (IS_NEED_SYNC_REPLY(im)) { + (void)_XimProcSyncReply(im, ic); + UNMARK_NEED_SYNC_REPLY(im); + } + return; +} + +Private Bool +_XimProtoKeypressFilter( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + + if (IS_FABRICATED(im)) { + _XimPendingFilter(ic); + UNMARK_FABRICATED(im); + return NOTFILTERD; + } + + if (IS_NEGLECT_EVENT(ic, KeyPressMask)) + return FILTERD; + +#ifdef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } +#else + if (!IS_IC_CONNECTED(ic)) + return NOTFILTERD; +#endif /* XIM_CONNECTABLE */ + + if (!IS_FORWARD_EVENT(ic, KeyPressMask)) { + if (_XimOnKeysCheck(ic, ev)) + return FILTERD; + return NOTFILTERD; + } + if (_XimOffKeysCheck(ic, ev)) + return FILTERD; + + if (_XimForwardEvent(ic, (XEvent *)ev, + IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) + return FILTERD; + + return NOTFILTERD; +} + +Private Bool +_XimFilterKeypress( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) +{ + return _XimProtoKeypressFilter((Xic)client_data, (XKeyEvent *)ev ); +} + +Private Bool +_XimProtoKeyreleaseFilter( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + + if (IS_FABRICATED(im)) { + _XimPendingFilter(ic); + UNMARK_FABRICATED(im); + return NOTFILTERD; + } + + if (IS_NEGLECT_EVENT(ic, KeyReleaseMask)) + return FILTERD; + +#ifdef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } +#else + if (!IS_IC_CONNECTED(ic)) + return NOTFILTERD; +#endif /* XIM_CONNECTABLE */ + + if (!IS_FORWARD_EVENT(ic, KeyReleaseMask)) { + if (_XimOnKeysCheck(ic, ev)) + return FILTERD; + return NOTFILTERD; + } + if (_XimOffKeysCheck(ic, ev)) + return FILTERD; + + if (_XimForwardEvent(ic, (XEvent *)ev, + IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) + return FILTERD; + + return NOTFILTERD; +} + +Private Bool +_XimFilterKeyrelease( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) +{ + return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev); +} + +Private void +_XimRegisterKeyPressFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (!(ic->private.proto.registed_filter_event & KEYPRESS_MASK)) { + _XRegisterFilterByType (ic->core.im->core.display, + ic->core.focus_window, + KeyPress, KeyPress, + _XimFilterKeypress, + (XPointer)ic); + ic->private.proto.registed_filter_event |= KEYPRESS_MASK; + } + } + return; +} + +Private void +_XimRegisterKeyReleaseFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (!(ic->private.proto.registed_filter_event & KEYRELEASE_MASK)) { + _XRegisterFilterByType (ic->core.im->core.display, + ic->core.focus_window, + KeyRelease, KeyRelease, + _XimFilterKeyrelease, + (XPointer)ic); + ic->private.proto.registed_filter_event |= KEYRELEASE_MASK; + } + } + return; +} + +Private void +_XimUnregisterKeyPressFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (ic->private.proto.registed_filter_event & KEYPRESS_MASK) { + _XUnregisterFilter (ic->core.im->core.display, + ic->core.focus_window, + _XimFilterKeypress, + (XPointer)ic); + ic->private.proto.registed_filter_event &= ~KEYPRESS_MASK; + } + } + return; +} + +Private void +_XimUnregisterKeyReleaseFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (ic->private.proto.registed_filter_event & KEYRELEASE_MASK) { + _XUnregisterFilter (ic->core.im->core.display, + ic->core.focus_window, + _XimFilterKeyrelease, + (XPointer)ic); + ic->private.proto.registed_filter_event &= ~KEYRELEASE_MASK; + } + } + return; +} + +Public void +_XimRegisterFilter( + Xic ic) +{ + _XimRegisterKeyPressFilter(ic); + if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) + _XimRegisterKeyReleaseFilter(ic); + return; +} + +Public void +_XimUnregisterFilter( + Xic ic) +{ + _XimUnregisterKeyPressFilter(ic); + _XimUnregisterKeyReleaseFilter(ic); + return; +} + +Public void +_XimReregisterFilter( + Xic ic) +{ + if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) + _XimRegisterKeyReleaseFilter(ic); + else + _XimUnregisterKeyReleaseFilter(ic); + + return; +} + +Private Bool +_XimFilterServerDestroy( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) +{ + Xim im = (Xim)client_data; + + if (ev->type == DestroyNotify) { + UNMARK_SERVER_CONNECTED(im); +#ifdef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { + _XimServerReconectableDestroy(); + return True; + } +#endif /* XIM_CONNECTABLE */ + _XimServerDestroy(im); + } + return True; +} + +Public void +_XimRegisterServerFilter( + Xim im) +{ + if (im->private.proto.im_window) { + if (!(im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK)) { + _XRegisterFilterByMask(im->core.display, + im->private.proto.im_window, + StructureNotifyMask, + _XimFilterServerDestroy, + (XPointer)im); + XSelectInput(im->core.display, im->private.proto.im_window, + StructureNotifyMask); + im->private.proto.registed_filter_event |= DESTROYNOTIFY_MASK; + } + } + return; +} + +Public void +_XimUnregisterServerFilter( + Xim im) +{ + if (im->private.proto.im_window) { + if (im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK) { + _XUnregisterFilter(im->core.display, + im->private.proto.im_window, + _XimFilterServerDestroy, + (XPointer)im); + im->private.proto.registed_filter_event &= ~DESTROYNOTIFY_MASK; + } + } + return; +} + diff --git a/libX11/modules/im/ximcp/imDefIc.c b/libX11/modules/im/ximcp/imDefIc.c index a962c1b0f..a06f6a73d 100644 --- a/libX11/modules/im/ximcp/imDefIc.c +++ b/libX11/modules/im/ximcp/imDefIc.c @@ -968,8 +968,6 @@ _XimProtoSetFocus( (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); - MARK_FOCUSED(ic); - _XimRegisterFilter(ic); return; } @@ -1015,8 +1013,6 @@ _XimProtoUnsetFocus( (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); - UNMARK_FOCUSED(ic); - _XimUnregisterFilter(ic); return; } diff --git a/libX11/modules/im/ximcp/imDefLkup.c b/libX11/modules/im/ximcp/imDefLkup.c index 996d36aef..cf7591909 100644 --- a/libX11/modules/im/ximcp/imDefLkup.c +++ b/libX11/modules/im/ximcp/imDefLkup.c @@ -213,12 +213,8 @@ _XimRespSyncReply( Xic ic, BITMASK16 mode) { - if (mode & XimSYNCHRONUS) /* SYNC Request */ { - if (IS_FOCUSED(ic)) - MARK_NEED_SYNC_REPLY(ic); - else - _XimProcSyncReply((Xim)ic->core.im, ic); - } + if (mode & XimSYNCHRONUS) /* SYNC Request */ + MARK_NEED_SYNC_REPLY(ic->core.im); return True; } @@ -356,7 +352,7 @@ _XimProcEvent( ev->xany.serial |= serial << 16; ev->xany.send_event = False; ev->xany.display = d; - MARK_FABLICATED(ic); + MARK_FABRICATED(ic->core.im); return; } @@ -708,7 +704,7 @@ _XimCommitRecv( (void)_XimRespSyncReply(ic, flag); - MARK_FABLICATED(ic); + MARK_FABRICATED(im); ev.type = KeyPress; ev.send_event = False; diff --git a/libX11/modules/im/ximcp/imExten.c b/libX11/modules/im/ximcp/imExten.c index 97309136e..65e59bcb4 100644 --- a/libX11/modules/im/ximcp/imExten.c +++ b/libX11/modules/im/ximcp/imExten.c @@ -1,576 +1,576 @@ -/******************************************************************
-
- Copyright 1992, 1993, 1994 by FUJITSU LIMITED
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of FUJITSU LIMITED
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-FUJITSU LIMITED makes no representations about the suitability of
-this software for any purpose.
-It is provided "as is" without express or implied warranty.
-
-FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
- Author: Takashi Fujiwara FUJITSU LIMITED
- fujiwara@a80.tech.yk.fujitsu.co.jp
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xatom.h>
-#include "Xlibint.h"
-#include "Xlcint.h"
-#include "Ximint.h"
-
-/*
- * index of extensions
- */
-
-#define XIM_EXT_SET_EVENT_MASK_IDX 0
-#ifdef EXT_FORWARD
-#define XIM_EXT_FORWARD_KEYEVENT_IDX 1
-#endif
-#ifdef EXT_MOVE
-#define XIM_EXT_MOVE_IDX 2
-#endif
-
-typedef struct _XIM_QueryExtRec {
- Bool is_support;
- const char *name;
- int name_len;
- CARD16 major_opcode;
- CARD16 minor_opcode;
- int idx;
-} XIM_QueryExtRec;
-
-Private XIM_QueryExtRec extensions[] = {
- {False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0,
- XIM_EXT_SET_EVENT_MASK_IDX},
-#ifdef EXT_FORWARD
- {False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0,
- XIM_EXT_FORWARD_KEYEVENT_IDX},
-#endif
-#ifdef EXT_MOVE
- {False, "XIM_EXT_MOVE", 0, 0, 0, XIM_EXT_MOVE_IDX},
-#endif
- {False, NULL, 0, 0, 0, 0} /* dummy */
-};
-
-Private int
-_XimIsSupportExt(
- int idx)
-{
- register int i;
- int n = XIMNumber(extensions) - 1;
-
- for (i = 0; i < n; i++) {
- if (extensions[i].idx == idx) {
- if (extensions[i].is_support)
- return i;
- else
- break;
- }
- }
- return -1;
-}
-
-Private Bool
-_XimProcExtSetEventMask(
- Xim im,
- Xic ic,
- XPointer buf)
-{
- EVENTMASK *buf_l = (EVENTMASK *)buf;
- EVENTMASK select_mask = _XimGetWindowEventmask(ic);
-
- ic->private.proto.filter_event_mask = buf_l[0];
- ic->private.proto.intercept_event_mask = buf_l[1];
- ic->private.proto.select_event_mask = buf_l[2];
- ic->private.proto.forward_event_mask = buf_l[3];
- ic->private.proto.synchronous_event_mask = buf_l[4];
-
- select_mask &= ~ic->private.proto.intercept_event_mask;
- /* deselected event mask */
- select_mask |= ic->private.proto.select_event_mask;
- /* selected event mask */
- XSelectInput(im->core.display, ic->core.focus_window, select_mask);
- _XimReregisterFilter(ic);
-
- if (!(_XimProcSyncReply(im, ic)))
- return False;
- return True;
-}
-
-Private Bool
-_XimExtSetEventMaskCallback(
- Xim xim,
- INT16 len,
- XPointer data,
- XPointer call_data)
-{
- CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE);
- XIMID imid = buf_s[0];
- XICID icid = buf_s[1];
- Xim im = (Xim)call_data;
- Xic ic;
-
- if ((imid == im->private.proto.imid)
- && (ic = _XimICOfXICID(im, icid))) {
- (void)_XimProcExtSetEventMask(im, ic, (XPointer)&buf_s[2]);
- return True;
- }
- return False;
-}
-
-#ifdef EXT_FORWARD
-Private Bool
-_XimProcExtForwardKeyEvent(
- Xim im,
- Xic ic,
- XPointer buf)
-{
- CARD8 *buf_b = (CARD8 *)buf;
- CARD16 *buf_s = (CARD16 *)buf;
- CARD32 *buf_l = (CARD32 *)buf;
- XEvent ev;
- XKeyEvent *kev = (XKeyEvent *)&ev;
-
- bzero(&ev, sizeof(XEvent));
- kev->send_event = False;
- kev->display = im->core.display;
- kev->serial = buf_s[1]; /* sequence number */
- kev->type = buf_b[4] & 0x7f; /* xEvent.u.u.type */
- kev->keycode = buf_b[5]; /* Keycode */
- kev->state = buf_s[3]; /* state */
- kev->time = buf_l[2]; /* time */
-
- XPutBackEvent(im->core.display, &ev);
-
- _XimRespSyncReply(ic, buf_s[0]);
- MARK_FABLICATED(ic);
-
- return True;
-}
-
-Private Bool
-_XimExtForwardKeyEventCallback(
- Xim xim,
- INT16 len,
- XPointer data,
- XPointer call_data)
-{
- CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE);
- XIMID imid = buf_s[0];
- XICID icid = buf_s[1];
- Xim im = (Xim)call_data;
- Xic ic;
-
- if ((imid == im->private.proto.imid)
- && (ic = _XimICOfXICID(im, icid))) {
- (void)_XimProcExtForwardKeyEvent(im, ic, (XPointer)&buf_s[2]);
- return True;
- }
- return False;
-}
-
-Private Bool
-_XimExtForwardKeyEventCheck(
- Xim im,
- INT16 len,
- XPointer data,
- XPointer arg)
-{
- Xic ic = (Xic)arg;
- CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE);
- CARD8 major_opcode = *((CARD8 *)data);
- CARD8 minor_opcode = *((CARD8 *)data + 1);
- XIMID imid = buf_s[0];
- XICID icid = buf_s[1];
-
- if ((major_opcode == XIM_SYNC_REPLY)
- && (minor_opcode == 0)
- && (imid == im->private.proto.imid)
- && (icid == ic->private.proto.icid))
- if ((major_opcode == XIM_ERROR)
- && (minor_opcode == 0)
- && (buf_s[2] & XIM_IMID_VALID)
- && (imid == im->private.proto.imid)
- && (buf_s[2] & XIM_ICID_VALID)
- && (icid == ic->private.proto.icid))
- return True;
- return False;
-}
-
-Public Bool
-_XimExtForwardKeyEvent(
- Xic ic,
- XKeyEvent *ev,
- Bool sync)
-{
- Xim im = (Xim) ic->core.im;
- CARD32 buf32[BUFSIZE/4];
- CARD8 *buf = (CARD8 *)buf32;
- CARD8 *buf_b = &buf[XIM_HEADER_SIZE];
- CARD16 *buf_s = (CARD16 *)buf_b;
- CARD32 *buf_l = (CARD32 *)buf_b;
- CARD32 reply32[BUFSIZE/4];
- char *reply = (char *)reply32;
- XPointer preply;
- int buf_size;
- int ret_code;
- INT16 len;
- int idx;
-
- if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) < 0)
- return False;
-
- buf_s[0] = im->private.proto.imid; /* imid */
- buf_s[1] = ic->private.proto.icid; /* icid */
- buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */
- buf_s[3] = (CARD16)(((XAnyEvent *)ev)->serial & ((unsigned long) 0xffff));
- /* sequence number */
- buf_b[8] = ev->type; /* xEvent.u.u.type */
- buf_b[9] = ev->keycode; /* keycode */
- buf_s[5] = ev->state; /* state */
- buf_l[3] = ev->time; /* time */
- len = sizeof(CARD16) /* sizeof imid */
- + sizeof(CARD16) /* sizeof icid */
- + sizeof(BITMASK16) /* sizeof flag */
- + sizeof(CARD16) /* sizeof sequence number */
- + sizeof(BYTE) /* sizeof xEvent.u.u.type */
- + sizeof(BYTE) /* sizeof keycode */
- + sizeof(CARD16) /* sizeof state */
- + sizeof(CARD32); /* sizeof time */
-
- _XimSetHeader((XPointer)buf,
- extensions[idx].major_opcode,
- extensions[idx].minor_opcode, &len);
- if (!(_XimWrite(im, len, (XPointer)buf)))
- return False;
- _XimFlush(im);
- if (sync) {
- buf_size = BUFSIZE;
- ret_code = _XimRead(im, &len, (XPointer)reply, buf_size,
- _XimExtForwardKeyEventCheck, (XPointer)ic);
- if(ret_code == XIM_TRUE) {
- preply = reply;
- } else if(ret_code == XIM_OVERFLOW) {
- if(len <= 0) {
- preply = reply;
- } else {
- buf_sizex = len;
- preply = (XPointer)Xmalloc(buf_size);
- ret_code = _XimRead(im, &len, preply, buf_size,
- _XimExtForwardKeyEventCheck, (XPointer)ic);
- if(ret_code != XIM_TRUE) {
- Xfree(preply);
- return False;
- }
- }
- } else
- return False;
- buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE);
- if (*((CARD8 *)preply) == XIM_ERROR) {
- _XimProcError(im, 0, (XPointer)&buf_s[3]);
- if(reply != preply)
- Xfree(preply);
- return False;
- }
- if(reply != preply)
- Xfree(preply);
- }
- return True;
-}
-#endif /* EXT_FORWARD */
-
-Private int
-_XimCheckExtensionListSize(void)
-{
- register int i;
- int len;
- int total = 0;
- int n = XIMNumber(extensions) - 1;
-
- for (i = 0; i < n; i++) {
- len = strlen(extensions[i].name);
- extensions[i].name_len = len;
- len += sizeof(BYTE);
- total += len;
- }
- return total;
-}
-
-Private void
-_XimSetExtensionList(
- CARD8 *buf)
-{
- register int i;
- int len;
- int n = XIMNumber(extensions) - 1;
-
- for (i = 0; i < n; i++) {
- len = extensions[i].name_len;
- buf[0] = (BYTE)len;
- (void)strcpy((char *)&buf[1], extensions[i].name);
- len += sizeof(BYTE);
- buf += len;
- }
- return;
-}
-
-Private unsigned int
-_XimCountNumberOfExtension(
- INT16 total,
- CARD8 *ext)
-{
- unsigned int n;
- INT16 len;
- INT16 min_len = sizeof(CARD8)
- + sizeof(CARD8)
- + sizeof(INT16);
-
- n = 0;
- while (total > min_len) {
- len = *((INT16 *)(&ext[2]));
- len += (min_len + XIM_PAD(len));
- total -= len;
- ext += len;
- n++;
- }
- return n;
-}
-
-Private Bool
-_XimParseExtensionList(
- Xim im,
- CARD16 *data)
-{
- int num = XIMNumber(extensions) - 1;
- unsigned int n;
- CARD8 *buf;
- register int i;
- register int j;
- INT16 len;
-
- if (!(n = _XimCountNumberOfExtension(data[0], (CARD8 *)&data[1])))
- return True;
-
- buf = (CARD8 *)&data[1];;
- for (i = 0; i < n; i++) {
- len = *((INT16 *)(&buf[2]));
- for (j = 0; j < num; j++) {
- if (!(strncmp(extensions[j].name, (char *)&buf[4], len))) {
- extensions[j].major_opcode = buf[0];
- extensions[j].minor_opcode = buf[1];
- extensions[j].is_support = True;
- break;
- }
- }
- len += sizeof(CARD8) /* sizeof major_opcode */
- + sizeof(CARD8) /* sizeof minor_opcode */
- + sizeof(INT16) /* sizeof length */
- + XIM_PAD(len); /* sizeof pad */
- buf += len;
- }
-
- return True;
-}
-
-Private Bool
-_XimQueryExtensionCheck(
- Xim im,
- INT16 len,
- XPointer data,
- XPointer arg)
-{
- CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE);
- CARD8 major_opcode = *((CARD8 *)data);
- CARD8 minor_opcode = *((CARD8 *)data + 1);
- XIMID imid = buf_s[0];
-
- if ((major_opcode == XIM_QUERY_EXTENSION_REPLY)
- && (minor_opcode == 0)
- && (imid == im->private.proto.imid))
- return True;
- if ((major_opcode == XIM_ERROR)
- && (minor_opcode == 0)
- && (buf_s[2] & XIM_IMID_VALID)
- && (imid == im->private.proto.imid))
- return True;
- return False;
-}
-
-Public Bool
-_XimExtension(
- Xim im)
-{
- CARD8 *buf;
- CARD16 *buf_s;
- int buf_len;
- INT16 len;
- CARD32 reply32[BUFSIZE/4];
- char *reply = (char *)reply32;
- XPointer preply;
- int buf_size;
- int ret_code;
- int idx;
-
- if (!(len = _XimCheckExtensionListSize()))
- return True;
-
- buf_len = XIM_HEADER_SIZE
- + sizeof(CARD16)
- + sizeof(INT16)
- + len
- + XIM_PAD(len);
-
- if (!(buf = (CARD8 *)Xmalloc(buf_len)))
- return False;
- buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
-
- buf_s[0] = im->private.proto.imid; /* imid */
- buf_s[1] = len; /* length of Extensions */
- _XimSetExtensionList((CARD8 *)&buf_s[2]);
- /* extensions supported */
- XIM_SET_PAD(&buf_s[2], len); /* pad */
- len += sizeof(CARD16) /* sizeof imid */
- + sizeof(INT16); /* sizeof length of extensions */
-
- _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len);
- if (!(_XimWrite(im, len, (XPointer)buf))) {
- XFree(buf);
- return False;
- }
- XFree(buf);
- _XimFlush(im);
- buf_size = BUFSIZE;
- ret_code = _XimRead(im, &len, (XPointer)reply, buf_size,
- _XimQueryExtensionCheck, 0);
- if(ret_code == XIM_TRUE) {
- preply = reply;
- } else if(ret_code == XIM_OVERFLOW) {
- if(len <= 0) {
- preply = reply;
- } else {
- buf_size = len;
- preply = (XPointer)Xmalloc(buf_size);
- ret_code = _XimRead(im, &len, reply, buf_size,
- _XimQueryExtensionCheck, 0);
- if(ret_code != XIM_TRUE) {
- Xfree(preply);
- return False;
- }
- }
- } else
- return False;
- buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE);
- if (*((CARD8 *)preply) == XIM_ERROR) {
- _XimProcError(im, 0, (XPointer)&buf_s[3]);
- if(reply != preply)
- Xfree(preply);
- return False;
- }
-
- if (!(_XimParseExtensionList(im, &buf_s[1]))) {
- if(reply != preply)
- Xfree(preply);
- return False;
- }
- if(reply != preply)
- Xfree(preply);
-
- if ((idx = _XimIsSupportExt(XIM_EXT_SET_EVENT_MASK_IDX)) >= 0)
- _XimRegProtoIntrCallback(im,
- extensions[idx].major_opcode,
- extensions[idx].minor_opcode,
- _XimExtSetEventMaskCallback, (XPointer)im);
-#ifdef EXT_FORWARD
- if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) >= 0)
- _XimRegProtoIntrCallback(im,
- extensions[idx].major_opcode,
- extensions[idx].minor_opcode,
- _XimExtForwardKeyEventCallback, (XPointer)im);
-#endif
-
- return True;
-}
-
-#ifdef EXT_MOVE
-/* flag of ExtenArgCheck */
-#define EXT_XNSPOTLOCATION (1L<<0)
-
-/* macro for ExtenArgCheck */
-#define SET_EXT_XNSPOTLOCATION(flag) (flag |= EXT_XNSPOTLOCATION)
-#define IS_EXT_XNSPOTLOCATION(flag) (flag & EXT_XNSPOTLOCATION)
-
-/* length of XPoint attribute */
-#define XIM_Xpoint_length 12
-
-Private Bool
-_XimExtMove(
- Xim im,
- Xic ic,
- CARD16 x,
- CARD16 y)
-{
- CARD32 buf32[BUFSIZE/4];
- CARD8 *buf = (CARD8 *)buf32;
- CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
- INT16 len;
- int idx;
-
- if ((idx = _XimIsSupportExt(XIM_EXT_MOVE_IDX)) < 0)
- return False;
-
- buf_s[0] = im->private.proto.imid; /* imid */
- buf_s[1] = ic->private.proto.icid; /* icid */
- buf_s[2] = x; /* X */
- buf_s[3] = y; /* Y */
- len = sizeof(CARD16) /* sizeof imid */
- + sizeof(CARD16) /* sizeof icid */
- + sizeof(INT16) /* sizeof X */
- + sizeof(INT16); /* sizeof Y */
-
- _XimSetHeader((XPointer)buf, extensions[idx].major_opcode,
- extensions[idx].minor_opcode, &len);
- if (!(_XimWrite(im, len, (XPointer)buf)))
- return False;
- _XimFlush(im);
- return True;
-}
-
-Public BITMASK32
-_XimExtenArgCheck(
- XIMArg *arg)
-{
- CARD32 flag = 0L;
- if (!strcmp(arg->name, XNSpotLocation))
- SET_EXT_XNSPOTLOCATION(flag);
- return flag;
-}
-
-Public Bool
-_XimExtenMove(
- Xim im,
- Xic ic,
- CARD32 flag,
- CARD16 *buf,
- INT16 length)
-{
- if ((IS_EXT_XNSPOTLOCATION(flag)) && (length == XIM_Xpoint_length))
- return _XimExtMove(im, ic, buf[4], buf[5]);
- return False;
-}
-#endif /* EXT_MOVE */
+/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and +that both that copyright notice and this permission notice appear +in supporting documentation, and that the name of FUJITSU LIMITED +not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +FUJITSU LIMITED makes no representations about the suitability of +this software for any purpose. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <X11/Xatom.h> +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +/* + * index of extensions + */ + +#define XIM_EXT_SET_EVENT_MASK_IDX 0 +#ifdef EXT_FORWARD +#define XIM_EXT_FORWARD_KEYEVENT_IDX 1 +#endif +#ifdef EXT_MOVE +#define XIM_EXT_MOVE_IDX 2 +#endif + +typedef struct _XIM_QueryExtRec { + Bool is_support; + const char *name; + int name_len; + CARD16 major_opcode; + CARD16 minor_opcode; + int idx; +} XIM_QueryExtRec; + +Private XIM_QueryExtRec extensions[] = { + {False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0, + XIM_EXT_SET_EVENT_MASK_IDX}, +#ifdef EXT_FORWARD + {False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0, + XIM_EXT_FORWARD_KEYEVENT_IDX}, +#endif +#ifdef EXT_MOVE + {False, "XIM_EXT_MOVE", 0, 0, 0, XIM_EXT_MOVE_IDX}, +#endif + {False, NULL, 0, 0, 0, 0} /* dummy */ +}; + +Private int +_XimIsSupportExt( + int idx) +{ + register int i; + int n = XIMNumber(extensions) - 1; + + for (i = 0; i < n; i++) { + if (extensions[i].idx == idx) { + if (extensions[i].is_support) + return i; + else + break; + } + } + return -1; +} + +Private Bool +_XimProcExtSetEventMask( + Xim im, + Xic ic, + XPointer buf) +{ + EVENTMASK *buf_l = (EVENTMASK *)buf; + EVENTMASK select_mask = _XimGetWindowEventmask(ic); + + ic->private.proto.filter_event_mask = buf_l[0]; + ic->private.proto.intercept_event_mask = buf_l[1]; + ic->private.proto.select_event_mask = buf_l[2]; + ic->private.proto.forward_event_mask = buf_l[3]; + ic->private.proto.synchronous_event_mask = buf_l[4]; + + select_mask &= ~ic->private.proto.intercept_event_mask; + /* deselected event mask */ + select_mask |= ic->private.proto.select_event_mask; + /* selected event mask */ + XSelectInput(im->core.display, ic->core.focus_window, select_mask); + _XimReregisterFilter(ic); + + if (!(_XimProcSyncReply(im, ic))) + return False; + return True; +} + +Private Bool +_XimExtSetEventMaskCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimProcExtSetEventMask(im, ic, (XPointer)&buf_s[2]); + return True; + } + return False; +} + +#ifdef EXT_FORWARD +Private Bool +_XimProcExtForwardKeyEvent( + Xim im, + Xic ic, + XPointer buf) +{ + CARD8 *buf_b = (CARD8 *)buf; + CARD16 *buf_s = (CARD16 *)buf; + CARD32 *buf_l = (CARD32 *)buf; + XEvent ev; + XKeyEvent *kev = (XKeyEvent *)&ev; + + bzero(&ev, sizeof(XEvent)); + kev->send_event = False; + kev->display = im->core.display; + kev->serial = buf_s[1]; /* sequence number */ + kev->type = buf_b[4] & 0x7f; /* xEvent.u.u.type */ + kev->keycode = buf_b[5]; /* Keycode */ + kev->state = buf_s[3]; /* state */ + kev->time = buf_l[2]; /* time */ + + XPutBackEvent(im->core.display, &ev); + + _XimRespSyncReply(ic, buf_s[0]); + MARK_FABRICATED(im); + + return True; +} + +Private Bool +_XimExtForwardKeyEventCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimProcExtForwardKeyEvent(im, ic, (XPointer)&buf_s[2]); + return True; + } + return False; +} + +Private Bool +_XimExtForwardKeyEventCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_SYNC_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +Public Bool +_XimExtForwardKeyEvent( + Xic ic, + XKeyEvent *ev, + Bool sync) +{ + Xim im = (Xim) ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; + CARD16 *buf_s = (CARD16 *)buf_b; + CARD32 *buf_l = (CARD32 *)buf_b; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + INT16 len; + int idx; + + if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) < 0) + return False; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ + buf_s[3] = (CARD16)(((XAnyEvent *)ev)->serial & ((unsigned long) 0xffff)); + /* sequence number */ + buf_b[8] = ev->type; /* xEvent.u.u.type */ + buf_b[9] = ev->keycode; /* keycode */ + buf_s[5] = ev->state; /* state */ + buf_l[3] = ev->time; /* time */ + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(BITMASK16) /* sizeof flag */ + + sizeof(CARD16) /* sizeof sequence number */ + + sizeof(BYTE) /* sizeof xEvent.u.u.type */ + + sizeof(BYTE) /* sizeof keycode */ + + sizeof(CARD16) /* sizeof state */ + + sizeof(CARD32); /* sizeof time */ + + _XimSetHeader((XPointer)buf, + extensions[idx].major_opcode, + extensions[idx].minor_opcode, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + if (sync) { + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimExtForwardKeyEventCheck, (XPointer)ic); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_sizex = len; + preply = (XPointer)Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimExtForwardKeyEventCheck, (XPointer)ic); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + } + return True; +} +#endif /* EXT_FORWARD */ + +Private int +_XimCheckExtensionListSize(void) +{ + register int i; + int len; + int total = 0; + int n = XIMNumber(extensions) - 1; + + for (i = 0; i < n; i++) { + len = strlen(extensions[i].name); + extensions[i].name_len = len; + len += sizeof(BYTE); + total += len; + } + return total; +} + +Private void +_XimSetExtensionList( + CARD8 *buf) +{ + register int i; + int len; + int n = XIMNumber(extensions) - 1; + + for (i = 0; i < n; i++) { + len = extensions[i].name_len; + buf[0] = (BYTE)len; + (void)strcpy((char *)&buf[1], extensions[i].name); + len += sizeof(BYTE); + buf += len; + } + return; +} + +Private unsigned int +_XimCountNumberOfExtension( + INT16 total, + CARD8 *ext) +{ + unsigned int n; + INT16 len; + INT16 min_len = sizeof(CARD8) + + sizeof(CARD8) + + sizeof(INT16); + + n = 0; + while (total > min_len) { + len = *((INT16 *)(&ext[2])); + len += (min_len + XIM_PAD(len)); + total -= len; + ext += len; + n++; + } + return n; +} + +Private Bool +_XimParseExtensionList( + Xim im, + CARD16 *data) +{ + int num = XIMNumber(extensions) - 1; + unsigned int n; + CARD8 *buf; + register int i; + register int j; + INT16 len; + + if (!(n = _XimCountNumberOfExtension(data[0], (CARD8 *)&data[1]))) + return True; + + buf = (CARD8 *)&data[1];; + for (i = 0; i < n; i++) { + len = *((INT16 *)(&buf[2])); + for (j = 0; j < num; j++) { + if (!(strncmp(extensions[j].name, (char *)&buf[4], len))) { + extensions[j].major_opcode = buf[0]; + extensions[j].minor_opcode = buf[1]; + extensions[j].is_support = True; + break; + } + } + len += sizeof(CARD8) /* sizeof major_opcode */ + + sizeof(CARD8) /* sizeof minor_opcode */ + + sizeof(INT16) /* sizeof length */ + + XIM_PAD(len); /* sizeof pad */ + buf += len; + } + + return True; +} + +Private Bool +_XimQueryExtensionCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_QUERY_EXTENSION_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +Public Bool +_XimExtension( + Xim im) +{ + CARD8 *buf; + CARD16 *buf_s; + int buf_len; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + int idx; + + if (!(len = _XimCheckExtensionListSize())) + return True; + + buf_len = XIM_HEADER_SIZE + + sizeof(CARD16) + + sizeof(INT16) + + len + + XIM_PAD(len); + + if (!(buf = (CARD8 *)Xmalloc(buf_len))) + return False; + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = len; /* length of Extensions */ + _XimSetExtensionList((CARD8 *)&buf_s[2]); + /* extensions supported */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += sizeof(CARD16) /* sizeof imid */ + + sizeof(INT16); /* sizeof length of extensions */ + + _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + XFree(buf); + return False; + } + XFree(buf); + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimQueryExtensionCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = (XPointer)Xmalloc(buf_size); + ret_code = _XimRead(im, &len, reply, buf_size, + _XimQueryExtensionCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + + if (!(_XimParseExtensionList(im, &buf_s[1]))) { + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + + if ((idx = _XimIsSupportExt(XIM_EXT_SET_EVENT_MASK_IDX)) >= 0) + _XimRegProtoIntrCallback(im, + extensions[idx].major_opcode, + extensions[idx].minor_opcode, + _XimExtSetEventMaskCallback, (XPointer)im); +#ifdef EXT_FORWARD + if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) >= 0) + _XimRegProtoIntrCallback(im, + extensions[idx].major_opcode, + extensions[idx].minor_opcode, + _XimExtForwardKeyEventCallback, (XPointer)im); +#endif + + return True; +} + +#ifdef EXT_MOVE +/* flag of ExtenArgCheck */ +#define EXT_XNSPOTLOCATION (1L<<0) + +/* macro for ExtenArgCheck */ +#define SET_EXT_XNSPOTLOCATION(flag) (flag |= EXT_XNSPOTLOCATION) +#define IS_EXT_XNSPOTLOCATION(flag) (flag & EXT_XNSPOTLOCATION) + +/* length of XPoint attribute */ +#define XIM_Xpoint_length 12 + +Private Bool +_XimExtMove( + Xim im, + Xic ic, + CARD16 x, + CARD16 y) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + int idx; + + if ((idx = _XimIsSupportExt(XIM_EXT_MOVE_IDX)) < 0) + return False; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] = x; /* X */ + buf_s[3] = y; /* Y */ + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(INT16) /* sizeof X */ + + sizeof(INT16); /* sizeof Y */ + + _XimSetHeader((XPointer)buf, extensions[idx].major_opcode, + extensions[idx].minor_opcode, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + return True; +} + +Public BITMASK32 +_XimExtenArgCheck( + XIMArg *arg) +{ + CARD32 flag = 0L; + if (!strcmp(arg->name, XNSpotLocation)) + SET_EXT_XNSPOTLOCATION(flag); + return flag; +} + +Public Bool +_XimExtenMove( + Xim im, + Xic ic, + CARD32 flag, + CARD16 *buf, + INT16 length) +{ + if ((IS_EXT_XNSPOTLOCATION(flag)) && (length == XIM_Xpoint_length)) + return _XimExtMove(im, ic, buf[4], buf[5]); + return False; +} +#endif /* EXT_MOVE */ diff --git a/libX11/modules/im/ximcp/imRm.c b/libX11/modules/im/ximcp/imRm.c index 936db876a..56c470b9f 100644 --- a/libX11/modules/im/ximcp/imRm.c +++ b/libX11/modules/im/ximcp/imRm.c @@ -2251,17 +2251,17 @@ _XimSetIMValueData( for(p = values; p->name != NULL; p++) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { - return p->value; + return p->name; } check = _XimCheckIMMode(res, XIM_SETIMVALUES); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { - return p->value; + return p->name; } if(!_XimEncodeLocalIMAttr(res, top, p->value)) { - return p->value; + return p->name; } } return NULL; @@ -2281,17 +2281,17 @@ _XimGetIMValueData( for(p = values; p->name != NULL; p++) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { - return p->value; + return p->name; } check = _XimCheckIMMode(res, XIM_GETIMVALUES); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { - return p->value; + return p->name; } if(!_XimDecodeLocalIMAttr(res, top, p->value)) { - return p->value; + return p->name; } } return NULL; @@ -2886,13 +2886,13 @@ _XimSetICValueData( if(mode & XIM_PREEDIT_ATTR) { if (!_XimEncodeLocalPreeditValue(ic, res, (XPointer)p)) - return False; + return p->name; } else if(mode & XIM_STATUS_ATTR) { if (!_XimEncodeLocalStatusValue(ic, res, (XPointer)p)) - return False; + return p->name; } else { if (!_XimEncodeLocalTopValue(ic, res, (XPointer)p, flag)) - return False; + return p->name; } if(_XimEncodeLocalICAttr(ic, res, top, p, mode) == False) { return p->name; diff --git a/libX11/nls/en_US.UTF-8/Compose.pre b/libX11/nls/en_US.UTF-8/Compose.pre index 907720eab..d5b01b16e 100644 --- a/libX11/nls/en_US.UTF-8/Compose.pre +++ b/libX11/nls/en_US.UTF-8/Compose.pre @@ -110,6 +110,14 @@ XCOMM Spaces <Multi_key> <O> <E> : "Œ" OE # LATIN CAPITAL LIGATURE OE <Multi_key> <a> <e> : "æ" ae # LATIN SMALL LETTER AE <Multi_key> <A> <E> : "Æ" AE # LATIN CAPITAL LETTER AE +<Multi_key> <f> <f> : "ff" Ufb00 # LATIN SMALL LIGATURE FF +<Multi_key> <f> <i> : "fi" Ufb01 # LATIN SMALL LIGATURE FI +<Multi_key> <f> <l> : "fl" Ufb02 # LATIN SMALL LIGATURE FL +<Multi_key> <F> <i> : "ffi" Ufb03 # LATIN SMALL LIGATURE FFI +<Multi_key> <F> <l> : "ffl" Ufb04 # LATIN SMALL LIGATURE FFL +<Multi_key> <I> <J> : "IJ" U0132 # LATIN CAPITAL LIGATURE IJ +<Multi_key> <I> <j> : "IJ" U0132 # LATIN CAPITAL LIGATURE IJ +<Multi_key> <i> <j> : "ij" U0133 # LATIN SMALL LIGATURE IJ <Multi_key> <o> <o> : "°" degree # DEGREE SIGN @@ -193,6 +201,8 @@ XCOMM "₵" U20b5 CEDI SIGN XCOMM Long S <Multi_key> <f> <s> : "ſ" U017f # LATIN SMALL LETTER LONG S <Multi_key> <f> <S> : "ſ" U017f # LATIN SMALL LETTER LONG S +<dead_abovedot> <Multi_key> <f> <s> : "ẛ" U1e9b # LATIN SMALL LETTER LONG S WITH DOT ABOVE +<Multi_key> <dead_abovedot> <f> <s> : "ẛ" U1e9b # LATIN SMALL LETTER LONG S WITH DOT ABOVE XCOMM Dashes <Multi_key> <minus> <minus> <period> : "–" U2013 # EN DASH @@ -4173,6 +4183,7 @@ XCOMM Part 3 <Multi_key> <less> <minus> : "←" U2190 # LEFTWARDS ARROW <Multi_key> <minus> <greater> : "→" U2192 # RIGHTWARDS ARROW <Multi_key> <U2203> <U0338> : "∄" U2204 # THERE DOES NOT EXIST +<Multi_key> <braceleft> <braceright> : "∅" U2205 # EMPTY SET <Multi_key> <U2208> <U0338> : "∉" U2209 # NOT AN ELEMENT OF <Multi_key> <U220B> <U0338> : "∌" U220C # DOES NOT CONTAIN AS MEMBER <Multi_key> <U2223> <U0338> : "∤" U2224 # DOES NOT DIVIDE @@ -4219,6 +4230,7 @@ XCOMM Part 3 <Multi_key> <U22B3> <U0338> : "⋫" U22EB # DOES NOT CONTAIN AS NORMAL SUBGROUP <Multi_key> <U22B4> <U0338> : "⋬" U22EC # NOT NORMAL SUBGROUP OF OR EQUAL TO <Multi_key> <U22B5> <U0338> : "⋭" U22ED # DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL +<Multi_key> <d> <i> : "⌀" U2300 # DIAMETER SIGN <Multi_key> <parenleft> <1> <parenright> : "①" U2460 # CIRCLED DIGIT ONE <Multi_key> <parenleft> <KP_1> <parenright> : "①" U2460 # CIRCLED DIGIT ONE <Multi_key> <parenleft> <2> <parenright> : "②" U2461 # CIRCLED DIGIT TWO @@ -4972,6 +4984,7 @@ XCOMM <dead_hook> <p> : "ƥ" U01A5 # LATIN SMALL LETTER P WITH HOOK <dead_hook> <q> : "ʠ" U02A0 # LATIN SMALL LETTER Q WITH HOOK <dead_hook> <U025C> : "ɝ" U025D # LATIN SMALL LETTER REVERSED OPEN E WITH HOOK +<dead_hook> <r> : "ɼ" U027C # LATIN SMALL LETTER R WITH LONG LEG <dead_hook> <s> : "ʂ" U0282 # LATIN SMALL LETTER S WITH HOOK <dead_hook> <schwa> : "ɚ" U025A # LATIN SMALL LETTER SCHWA WITH HOOK <dead_hook> <T> : "Ƭ" U01AC # LATIN CAPITAL LETTER T WITH HOOK diff --git a/libX11/src/xlibi18n/XimintP.h b/libX11/src/xlibi18n/XimintP.h index 214621d66..14a7e6d5a 100644 --- a/libX11/src/xlibi18n/XimintP.h +++ b/libX11/src/xlibi18n/XimintP.h @@ -1,318 +1,310 @@ -/*
- * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-/******************************************************************
-
- Copyright 1992, 1993, 1994 by FUJITSU LIMITED
- Copyright 1993, 1994 by Sony Corporation
-
-Permission to use, copy, modify, distribute, and sell this software and
-its documentation for any purpose is hereby granted without fee, provided
-that the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation, and that the name of FUJITSU LIMITED and Sony Corporation
-not be used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission. FUJITSU LIMITED and
-Sony Corporation makes no representations about the suitability of this
-software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL FUJITSU LIMITED OR SONY CORPORATION BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
- Takashi Fujiwara FUJITSU LIMITED
- fujiwara@a80.tech.yk.fujitsu.co.jp
- Makoto Wakamatsu Sony Corporation
- makoto@sm.sony.co.jp
- Hiroyuki Miyamoto Digital Equipment Corporation
- miyamoto@jrd.dec.com
-
-******************************************************************/
-
-#ifndef _XIMINTP_H
-#define _XIMINTP_H
-
-#include "XimProto.h"
-#include "XlcPublic.h"
-
-/*
- * for protocol layer callback function
- */
-typedef Bool (*XimProtoIntrProc)(
- Xim, INT16, XPointer, XPointer
-);
-typedef struct _XimProtoIntrRec {
- XimProtoIntrProc func;
- CARD16 major_code;
- CARD16 minor_code;
- XPointer call_data;
- struct _XimProtoIntrRec *next;
-} XimProtoIntrRec;
-
-/*
- * for transport layer methods
- */
-typedef Bool (*XimTransConnectProc)(
- Xim
-);
-typedef Bool (*XimTransShutdownProc)(
- Xim
-);
-typedef Bool (*XimTransWriteProc)(
- Xim, INT16, XPointer
-);
-typedef Bool (*XimTransReadProc)(
- Xim, XPointer, int, int *
-);
-typedef void (*XimTransFlushProc)(
- Xim
-);
-typedef Bool (*XimTransRegDispatcher)(
- Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer
-);
-typedef Bool (*XimTransCallDispatcher)(
- Xim, INT16, XPointer
-);
-
-/*
- * private part of IM
- */
-typedef struct _XimProtoPrivateRec {
- /* The first fields are identical with XimCommonPrivateRec. */
- XlcConv ctom_conv;
- XlcConv ctow_conv;
- XlcConv ctoutf8_conv;
- XlcConv cstomb_conv;
- XlcConv cstowc_conv;
- XlcConv cstoutf8_conv;
- XlcConv ucstoc_conv;
- XlcConv ucstoutf8_conv;
-
- Window im_window;
- XIMID imid;
- CARD16 unused;
- XIMStyles *default_styles;
- CARD32 *im_onkeylist;
- CARD32 *im_offkeylist;
- BITMASK32 flag;
-
- BITMASK32 registed_filter_event;
- EVENTMASK forward_event_mask;
- EVENTMASK synchronous_event_mask;
-
- XimProtoIntrRec *intrproto;
- XIMResourceList im_inner_resources;
- unsigned int im_num_inner_resources;
- XIMResourceList ic_inner_resources;
- unsigned int ic_num_inner_resources;
- char *hold_data;
- int hold_data_len;
- char *locale_name;
- CARD16 protocol_major_version;
- CARD16 protocol_minor_version;
- XrmQuark *saved_imvalues;
- int num_saved_imvalues;
-
- /*
- * transport specific
- */
- XimTransConnectProc connect;
- XimTransShutdownProc shutdown;
- XimTransWriteProc write;
- XimTransReadProc read;
- XimTransFlushProc flush;
- XimTransRegDispatcher register_dispatcher;
- XimTransCallDispatcher call_dispatcher;
- XPointer spec;
-} XimProtoPrivateRec;
-
-/*
- * bit mask for the flag of XIMPrivateRec
- */
-#define SERVER_CONNECTED (1L)
-#define DYNAMIC_EVENT_FLOW (1L << 1)
-#define USE_AUTHORIZATION_FUNC (1L << 2)
-#ifdef XIM_CONNECTABLE
-#define DELAYBINDABLE (1L << 3)
-#define RECONNECTABLE (1L << 4)
-#endif /* XIM_CONNECTABLE */
-
-/*
- * macro for the flag of XIMPrivateRec
- */
-#define IS_SERVER_CONNECTED(im) \
- ((((Xim)im))->private.proto.flag & SERVER_CONNECTED)
-#define MARK_SERVER_CONNECTED(im) \
- ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED)
-#define UNMARK_SERVER_CONNECTED(im) \
- ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED)
-
-#define IS_DYNAMIC_EVENT_FLOW(im) \
- (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW)
-#define MARK_DYNAMIC_EVENT_FLOW(im) \
- (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW)
-
-#define IS_USE_AUTHORIZATION_FUNC(im) \
- (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC)
-#define MARK_USE_AUTHORIZATION_FUNC(im) \
- (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC)
-
-#ifdef XIM_CONNECTABLE
-#define IS_DELAYBINDABLE(im) \
- (((Xim)im)->private.proto.flag & DELAYBINDABLE)
-#define MARK_DELAYBINDABLE(im) \
- (((Xim)im)->private.proto.flag |= DELAYBINDABLE)
-
-#define IS_RECONNECTABLE(im) \
- (((Xim)im)->private.proto.flag & RECONNECTABLE)
-#define MARK_RECONNECTABLE(im) \
- (((Xim)im)->private.proto.flag |= RECONNECTABLE)
-
-#define IS_CONNECTABLE(im) \
- (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE))
-#define UNMAKE_CONNECTABLE(im) \
- (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE))
-#endif /* XIM_CONNECTABLE */
-
-/*
- * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec
- */
-#define KEYPRESS_MASK (1L)
-#define KEYRELEASE_MASK (1L << 1)
-#define DESTROYNOTIFY_MASK (1L << 2)
-
-typedef struct _XimCommitInfoRec {
- struct _XimCommitInfoRec *next;
- char *string;
- int string_len;
- KeySym *keysym;
- int keysym_len;
-} XimCommitInfoRec, *XimCommitInfo;
-
-typedef struct _XimPendingCallback {
- int major_opcode;
- Xim im;
- Xic ic;
- char *proto;
- int proto_len;
- struct _XimPendingCallback *next;
-} XimPendingCallbackRec, *XimPendingCallback;
-
-
-/*
- * private part of IC
- */
-typedef struct _XicProtoPrivateRec {
- XICID icid; /* ICID */
- CARD16 dmy;
- BITMASK32 flag; /* Input Mode */
-
- BITMASK32 registed_filter_event; /* registed filter mask */
- EVENTMASK forward_event_mask; /* forward event mask */
- EVENTMASK synchronous_event_mask;/* sync event mask */
- EVENTMASK filter_event_mask; /* negrect event mask */
- EVENTMASK intercept_event_mask; /* deselect event mask */
- EVENTMASK select_event_mask; /* select event mask */
-
- char *preedit_font; /* Base font name list */
- int preedit_font_length; /* length of base font name */
- char *status_font; /* Base font name list */
- int status_font_length; /* length of base font name */
-
- XimCommitInfo commit_info;
- XIMResourceList ic_resources;
- unsigned int ic_num_resources;
- XIMResourceList ic_inner_resources;
- unsigned int ic_num_inner_resources;
- XrmQuark *saved_icvalues;
- int num_saved_icvalues;
- XimPendingCallback pend_cb_que;
- Bool waitCallback;
-} XicProtoPrivateRec ;
-
-/*
- * bit mask for the flag of XICPrivateRec
- */
-#define IC_CONNECTED (1L)
-#define FABLICATED (1L << 1)
-#define NEED_SYNC_REPLY (1L << 2)
-#define FOCUSED (1L << 3)
-
-/*
- * macro for the flag of XICPrivateRec
- */
-#define IS_IC_CONNECTED(ic) \
- (((Xic)ic)->private.proto.flag & IC_CONNECTED)
-#define MARK_IC_CONNECTED(ic) \
- (((Xic)ic)->private.proto.flag |= IC_CONNECTED)
-#define UNMARK_IC_CONNECTED(ic) \
- (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED)
-
-#define IS_FABLICATED(ic) \
- (((Xic)ic)->private.proto.flag & FABLICATED)
-#define MARK_FABLICATED(ic) \
- (((Xic)ic)->private.proto.flag |= FABLICATED)
-#define UNMARK_FABLICATED(ic) \
- (((Xic)ic)->private.proto.flag &= ~FABLICATED)
-
-#define IS_NEED_SYNC_REPLY(ic) \
- (((Xic)ic)->private.proto.flag & NEED_SYNC_REPLY)
-#define MARK_NEED_SYNC_REPLY(ic) \
- (((Xic)ic)->private.proto.flag |= NEED_SYNC_REPLY)
-#define UNMARK_NEED_SYNC_REPLY(ic) \
- (((Xic)ic)->private.proto.flag &= ~NEED_SYNC_REPLY)
-
-#define IS_FOCUSED(ic) \
- (((Xic)ic)->private.proto.flag & FOCUSED)
-#define MARK_FOCUSED(ic) \
- (((Xic)ic)->private.proto.flag |= FOCUSED)
-#define UNMARK_FOCUSED(ic) \
- (((Xic)ic)->private.proto.flag &= ~FOCUSED)
-
-/*
- * macro for the filter_event_mask of XICPrivateRec
- */
-#define IS_NEGLECT_EVENT(ic, mask) \
- (((Xic)ic)->private.proto.filter_event_mask & (mask))
-
-/*
- * macro for the forward_event_mask of XICPrivateRec
- */
-#define IS_FORWARD_EVENT(ic, mask) \
- (((Xic)ic)->private.proto.forward_event_mask & (mask))
-
-/*
- * macro for the synchronous_event_mask of XICPrivateRec
- */
-#define IS_SYNCHRONOUS_EVENT(ic, mask) \
- ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False)
-
-#define XIM_MAXIMNAMELEN 64
-#define XIM_MAXLCNAMELEN 64
-
-#endif /* _XIMINTP_H */
+/* + * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993, 1994 by Sony Corporation + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, provided +that the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of FUJITSU LIMITED and Sony Corporation +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. FUJITSU LIMITED and +Sony Corporation makes no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty. + +FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL FUJITSU LIMITED OR SONY CORPORATION BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. + + Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + Hiroyuki Miyamoto Digital Equipment Corporation + miyamoto@jrd.dec.com + +******************************************************************/ + +#ifndef _XIMINTP_H +#define _XIMINTP_H + +#include "XimProto.h" +#include "XlcPublic.h" + +/* + * for protocol layer callback function + */ +typedef Bool (*XimProtoIntrProc)( + Xim, INT16, XPointer, XPointer +); +typedef struct _XimProtoIntrRec { + XimProtoIntrProc func; + CARD16 major_code; + CARD16 minor_code; + XPointer call_data; + struct _XimProtoIntrRec *next; +} XimProtoIntrRec; + +/* + * for transport layer methods + */ +typedef Bool (*XimTransConnectProc)( + Xim +); +typedef Bool (*XimTransShutdownProc)( + Xim +); +typedef Bool (*XimTransWriteProc)( + Xim, INT16, XPointer +); +typedef Bool (*XimTransReadProc)( + Xim, XPointer, int, int * +); +typedef void (*XimTransFlushProc)( + Xim +); +typedef Bool (*XimTransRegDispatcher)( + Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer +); +typedef Bool (*XimTransCallDispatcher)( + Xim, INT16, XPointer +); + +/* + * private part of IM + */ +typedef struct _XimProtoPrivateRec { + /* The first fields are identical with XimCommonPrivateRec. */ + XlcConv ctom_conv; + XlcConv ctow_conv; + XlcConv ctoutf8_conv; + XlcConv cstomb_conv; + XlcConv cstowc_conv; + XlcConv cstoutf8_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; + + Window im_window; + XIMID imid; + CARD16 unused; + XIMStyles *default_styles; + CARD32 *im_onkeylist; + CARD32 *im_offkeylist; + BITMASK32 flag; + + BITMASK32 registed_filter_event; + EVENTMASK forward_event_mask; + EVENTMASK synchronous_event_mask; + + XimProtoIntrRec *intrproto; + XIMResourceList im_inner_resources; + unsigned int im_num_inner_resources; + XIMResourceList ic_inner_resources; + unsigned int ic_num_inner_resources; + char *hold_data; + int hold_data_len; + char *locale_name; + CARD16 protocol_major_version; + CARD16 protocol_minor_version; + XrmQuark *saved_imvalues; + int num_saved_imvalues; + + /* + * transport specific + */ + XimTransConnectProc connect; + XimTransShutdownProc shutdown; + XimTransWriteProc write; + XimTransReadProc read; + XimTransFlushProc flush; + XimTransRegDispatcher register_dispatcher; + XimTransCallDispatcher call_dispatcher; + XPointer spec; +} XimProtoPrivateRec; + +/* + * bit mask for the flag of XIMPrivateRec + */ +#define SERVER_CONNECTED (1L) +#define DYNAMIC_EVENT_FLOW (1L << 1) +#define USE_AUTHORIZATION_FUNC (1L << 2) +#ifdef XIM_CONNECTABLE +#define DELAYBINDABLE (1L << 3) +#define RECONNECTABLE (1L << 4) +#endif /* XIM_CONNECTABLE */ +#define FABRICATED (1L << 5) +#define NEED_SYNC_REPLY (1L << 6) + +/* + * macro for the flag of XIMPrivateRec + */ +#define IS_SERVER_CONNECTED(im) \ + ((((Xim)im))->private.proto.flag & SERVER_CONNECTED) +#define MARK_SERVER_CONNECTED(im) \ + ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED) +#define UNMARK_SERVER_CONNECTED(im) \ + ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED) + +#define IS_DYNAMIC_EVENT_FLOW(im) \ + (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW) +#define MARK_DYNAMIC_EVENT_FLOW(im) \ + (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW) + +#define IS_USE_AUTHORIZATION_FUNC(im) \ + (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC) +#define MARK_USE_AUTHORIZATION_FUNC(im) \ + (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC) + +#ifdef XIM_CONNECTABLE +#define IS_DELAYBINDABLE(im) \ + (((Xim)im)->private.proto.flag & DELAYBINDABLE) +#define MARK_DELAYBINDABLE(im) \ + (((Xim)im)->private.proto.flag |= DELAYBINDABLE) + +#define IS_RECONNECTABLE(im) \ + (((Xim)im)->private.proto.flag & RECONNECTABLE) +#define MARK_RECONNECTABLE(im) \ + (((Xim)im)->private.proto.flag |= RECONNECTABLE) + +#define IS_CONNECTABLE(im) \ + (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE)) +#define UNMAKE_CONNECTABLE(im) \ + (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) +#endif /* XIM_CONNECTABLE */ + +#define IS_FABRICATED(im) \ + (((Xim)im)->private.proto.flag & FABRICATED) +#define MARK_FABRICATED(im) \ + (((Xim)im)->private.proto.flag |= FABRICATED) +#define UNMARK_FABRICATED(im) \ + (((Xim)im)->private.proto.flag &= ~FABRICATED) + +#define IS_NEED_SYNC_REPLY(im) \ + (((Xim)im)->private.proto.flag & NEED_SYNC_REPLY) +#define MARK_NEED_SYNC_REPLY(im) \ + (((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY) +#define UNMARK_NEED_SYNC_REPLY(im) \ + (((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY) + +/* + * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec + */ +#define KEYPRESS_MASK (1L) +#define KEYRELEASE_MASK (1L << 1) +#define DESTROYNOTIFY_MASK (1L << 2) + +typedef struct _XimCommitInfoRec { + struct _XimCommitInfoRec *next; + char *string; + int string_len; + KeySym *keysym; + int keysym_len; +} XimCommitInfoRec, *XimCommitInfo; + +typedef struct _XimPendingCallback { + int major_opcode; + Xim im; + Xic ic; + char *proto; + int proto_len; + struct _XimPendingCallback *next; +} XimPendingCallbackRec, *XimPendingCallback; + + +/* + * private part of IC + */ +typedef struct _XicProtoPrivateRec { + XICID icid; /* ICID */ + CARD16 dmy; + BITMASK32 flag; /* Input Mode */ + + BITMASK32 registed_filter_event; /* registed filter mask */ + EVENTMASK forward_event_mask; /* forward event mask */ + EVENTMASK synchronous_event_mask;/* sync event mask */ + EVENTMASK filter_event_mask; /* negrect event mask */ + EVENTMASK intercept_event_mask; /* deselect event mask */ + EVENTMASK select_event_mask; /* select event mask */ + + char *preedit_font; /* Base font name list */ + int preedit_font_length; /* length of base font name */ + char *status_font; /* Base font name list */ + int status_font_length; /* length of base font name */ + + XimCommitInfo commit_info; + XIMResourceList ic_resources; + unsigned int ic_num_resources; + XIMResourceList ic_inner_resources; + unsigned int ic_num_inner_resources; + XrmQuark *saved_icvalues; + int num_saved_icvalues; + XimPendingCallback pend_cb_que; + Bool waitCallback; +} XicProtoPrivateRec ; + +/* + * bit mask for the flag of XICPrivateRec + */ +#define IC_CONNECTED (1L) + +/* + * macro for the flag of XICPrivateRec + */ +#define IS_IC_CONNECTED(ic) \ + (((Xic)ic)->private.proto.flag & IC_CONNECTED) +#define MARK_IC_CONNECTED(ic) \ + (((Xic)ic)->private.proto.flag |= IC_CONNECTED) +#define UNMARK_IC_CONNECTED(ic) \ + (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) + +/* + * macro for the filter_event_mask of XICPrivateRec + */ +#define IS_NEGLECT_EVENT(ic, mask) \ + (((Xic)ic)->private.proto.filter_event_mask & (mask)) + +/* + * macro for the forward_event_mask of XICPrivateRec + */ +#define IS_FORWARD_EVENT(ic, mask) \ + (((Xic)ic)->private.proto.forward_event_mask & (mask)) + +/* + * macro for the synchronous_event_mask of XICPrivateRec + */ +#define IS_SYNCHRONOUS_EVENT(ic, mask) \ + ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False) + +#define XIM_MAXIMNAMELEN 64 +#define XIM_MAXLCNAMELEN 64 + +#endif /* _XIMINTP_H */ |