Commit 1baa27d0 authored by Ulrich Sibiller's avatar Ulrich Sibiller

update files from modules dir of libX11 1.3.4

parent da3e7fd2
/*
* Copyright 1991, 1992 Sun Microsystems, Inc. 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 1991, 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
...@@ -947,6 +968,8 @@ _XimProtoSetFocus( ...@@ -947,6 +968,8 @@ _XimProtoSetFocus(
(void)_XimWrite(im, len, (XPointer)buf); (void)_XimWrite(im, len, (XPointer)buf);
_XimFlush(im); _XimFlush(im);
MARK_FOCUSED(ic);
_XimRegisterFilter(ic); _XimRegisterFilter(ic);
return; return;
} }
...@@ -992,6 +1015,8 @@ _XimProtoUnsetFocus( ...@@ -992,6 +1015,8 @@ _XimProtoUnsetFocus(
(void)_XimWrite(im, len, (XPointer)buf); (void)_XimWrite(im, len, (XPointer)buf);
_XimFlush(im); _XimFlush(im);
UNMARK_FOCUSED(ic);
_XimUnregisterFilter(ic); _XimUnregisterFilter(ic);
return; return;
} }
......
/*
* Copyright 1990, 1991, 1992 Sun Microsystems, Inc. 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 1990, 1991, 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Copyright 1993, 1994 by Sony Corporation Copyright 1993, 1994 by Sony Corporation
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose and without fee is hereby granted,
the above copyright notice appear in all copies and that both that copyright provided that the above copyright notice appear in all copies and that
notice and this permission notice appear in supporting documentation, and both that copyright notice and this permission notice appear in
that the name of Sun Microsystems, Inc., FUJITSU LIMITED and Sony supporting documentation, and that the names of Digital, FUJITSU
Corporation not be used in advertising or publicity pertaining to LIMITED and Sony Corporation not be used in advertising or publicity
distribution of the software without specific, written prior permission. pertaining to distribution of the software without specific, written
Sun Microsystems, Inc., FUJITSU LIMITED and Sony Corporation makes no prior permission.
representations about the suitability of this software for any purpose. It
is provided "as is" without express or implied warranty. DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
Sun Microsystems Inc., FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc., CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
FUJITSU LIMITED AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER PERFORMANCE OF THIS SOFTWARE.
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. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
...@@ -73,7 +93,7 @@ _XimSetHeader( ...@@ -73,7 +93,7 @@ _XimSetHeader(
return; return;
} }
Private char Public char
_XimGetMyEndian(void) _XimGetMyEndian(void)
{ {
CARD16 test_card = 1; CARD16 test_card = 1;
...@@ -166,7 +186,7 @@ Private Bool ...@@ -166,7 +186,7 @@ Private Bool
_XimCheckTransport( _XimCheckTransport(
char *address, char *address,
int address_len, int address_len,
char *transport, const char *transport,
int len, int len,
char **trans_addr) char **trans_addr)
{ {
......
...@@ -213,8 +213,13 @@ _XimRespSyncReply( ...@@ -213,8 +213,13 @@ _XimRespSyncReply(
Xic ic, Xic ic,
BITMASK16 mode) BITMASK16 mode)
{ {
if (mode & XimSYNCHRONUS) /* SYNC Request */ if (mode & XimSYNCHRONUS) /* SYNC Request */ {
if (IS_FOCUSED(ic))
MARK_NEED_SYNC_REPLY(ic); MARK_NEED_SYNC_REPLY(ic);
else
_XimProcSyncReply((Xim)ic->core.im, ic);
}
return True; return True;
} }
...@@ -463,7 +468,7 @@ _XimGetWindowEventmask( ...@@ -463,7 +468,7 @@ _XimGetWindowEventmask(
Xim im = (Xim )ic->core.im; Xim im = (Xim )ic->core.im;
XWindowAttributes atr; XWindowAttributes atr;
if (!_XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr)) if (!XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr))
return 0; return 0;
return (EVENTMASK)atr.your_event_mask; return (EVENTMASK)atr.your_event_mask;
} }
...@@ -885,13 +890,8 @@ _Ximctsconvert( ...@@ -885,13 +890,8 @@ _Ximctsconvert(
} }
Public int Public int
_Ximctstombs(xim, from, from_len, to, to_len, state) _Ximctstombs(XIM xim, char *from, int from_len,
XIM xim; char *to, int to_len, Status *state)
char *from;
int from_len;
char *to;
int to_len;
Status *state;
{ {
return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv, return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv,
from, from_len, to, to_len, state); from, from_len, to, to_len, state);
......
...@@ -61,8 +61,7 @@ _XimRegProtoIntrCallback( ...@@ -61,8 +61,7 @@ _XimRegProtoIntrCallback(
} }
Public void Public void
_XimFreeProtoIntrCallback(im) _XimFreeProtoIntrCallback(Xim im)
Xim im;
{ {
register XimProtoIntrRec *rec, *next; register XimProtoIntrRec *rec, *next;
...@@ -97,8 +96,7 @@ _XimTransportIntr( ...@@ -97,8 +96,7 @@ _XimTransportIntr(
} }
Public Bool Public Bool
_XimDispatchInit(im) _XimDispatchInit(Xim im)
Xim im;
{ {
if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im)) if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im))
return True; return True;
......
...@@ -48,7 +48,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -48,7 +48,7 @@ PERFORMANCE OF THIS SOFTWARE.
typedef struct _XIM_QueryExtRec { typedef struct _XIM_QueryExtRec {
Bool is_support; Bool is_support;
char *name; const char *name;
int name_len; int name_len;
CARD16 major_opcode; CARD16 major_opcode;
CARD16 minor_opcode; CARD16 minor_opcode;
......
...@@ -108,7 +108,7 @@ _XimFilterPropertyNotify( ...@@ -108,7 +108,7 @@ _XimFilterPropertyNotify(
} }
lock = True; lock = True;
for( ii = 0; ii < nitems; ii++ ) { for( ii = 0; ii < nitems; ii++, atoms ) {
if(XGetSelectionOwner (display, atoms[ii])) { if(XGetSelectionOwner (display, atoms[ii])) {
for( icb = callback_list; icb; icb = icb->next ) { for( icb = callback_list; icb; icb = icb->next ) {
if( !icb->call && !icb->destroy ) { if( !icb->call && !icb->destroy ) {
...@@ -268,8 +268,7 @@ _XimUnRegisterIMInstantiateCallback( ...@@ -268,8 +268,7 @@ _XimUnRegisterIMInstantiateCallback(
Public void Public void
_XimResetIMInstantiateCallback( xim ) _XimResetIMInstantiateCallback(Xim xim)
Xim xim;
{ {
char locale[XIM_MAXLCNAMELEN]; char locale[XIM_MAXLCNAMELEN];
XimInstCallback icb; XimInstCallback icb;
......
...@@ -73,8 +73,7 @@ _XimSetIMStructureList( ...@@ -73,8 +73,7 @@ _XimSetIMStructureList(
} }
Public void Public void
_XimDestroyIMStructureList(im) _XimDestroyIMStructureList(Xim im)
Xim im;
{ {
register int i; register int i;
...@@ -88,8 +87,7 @@ _XimDestroyIMStructureList(im) ...@@ -88,8 +87,7 @@ _XimDestroyIMStructureList(im)
} }
Public void Public void
_XimServerDestroy(im_2_destroy) _XimServerDestroy(Xim im_2_destroy)
Xim im_2_destroy;
{ {
register int i; register int i;
Xim im; Xim im;
...@@ -123,7 +121,7 @@ _XimServerDestroy(im_2_destroy) ...@@ -123,7 +121,7 @@ _XimServerDestroy(im_2_destroy)
#ifdef XIM_CONNECTABLE #ifdef XIM_CONNECTABLE
Public void Public void
_XimServerReconectableDestroy() _XimServerReconectableDestroy(void)
{ {
register int i; register int i;
Xim im; Xim im;
...@@ -149,10 +147,10 @@ _XimServerReconectableDestroy() ...@@ -149,10 +147,10 @@ _XimServerReconectableDestroy()
} }
#endif /* XIM_CONNECTABLE */ #endif /* XIM_CONNECTABLE */
Private char * Private const char *
_XimStrstr( _XimStrstr(
register char *src, register const char *src,
register char *dest) register const char *dest)
{ {
int len; int len;
...@@ -169,10 +167,10 @@ Private char * ...@@ -169,10 +167,10 @@ Private char *
_XimMakeImName( _XimMakeImName(
XLCd lcd) XLCd lcd)
{ {
char* begin = NULL; const char* begin = NULL;
char* end = NULL; const char* end = NULL;
char* ret = NULL; char* ret = NULL;
char* ximmodifier = XIMMODIFIER; const char* ximmodifier = XIMMODIFIER;
if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') { if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') {
begin = _XimStrstr(lcd->core->modifiers, ximmodifier); begin = _XimStrstr(lcd->core->modifiers, ximmodifier);
...@@ -257,8 +255,7 @@ Error1: ...@@ -257,8 +255,7 @@ Error1:
} }
Public Bool Public Bool
_XInitIM(lcd) _XInitIM(XLCd lcd)
XLCd lcd;
{ {
if(lcd == (XLCd)NULL) if(lcd == (XLCd)NULL)
return False; return False;
......
...@@ -38,43 +38,67 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -38,43 +38,67 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Bool Bool
_XimLocalFilter(d, w, ev, client_data) _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data)
Display *d;
Window w;
XEvent *ev;
XPointer client_data;
{ {
Xic ic = (Xic)client_data; Xic ic = (Xic)client_data;
KeySym keysym; KeySym keysym;
static char buf[256]; static char buf[256];
DefTree *p; DefTree *b = ic->private.local.base.tree;
DTIndex t;
if( (ev->type != KeyPress) if(ev->xkey.keycode == 0)
|| (ev->xkey.keycode == 0) return (False);
|| (((Xim)ic->core.im)->private.local.top == (DefTree *)NULL) )
return(False);
XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL);
if(IsModifierKey(keysym)) if(IsModifierKey(keysym))
return (False); return (False);
for(p = ic->private.local.context; p; p = p->next) { if(keysym >= XK_braille_dot_1 && keysym <= XK_braille_dot_8) {
if(((ev->xkey.state & p->modifier_mask) == p->modifier) && if(ev->type == KeyPress) {
(keysym == p->keysym)) { ic->private.local.brl_pressed |=
break; 1<<(keysym-XK_braille_dot_1);
} else {
if(!ic->private.local.brl_committing
|| ev->xkey.time - ic->private.local.brl_release_start > 300) {
ic->private.local.brl_committing = ic->private.local.brl_pressed;
ic->private.local.brl_release_start = ev->xkey.time;
}
ic->private.local.brl_pressed &= ~(1<<(keysym-XK_braille_dot_1));
if(!ic->private.local.brl_pressed) {
if(ic->private.local.brl_committing) {
ic->private.local.brl_committed =
ic->private.local.brl_committing;
ic->private.local.composed = 0;
ev->type = KeyPress;
ev->xkey.keycode = 0;
_XPutBackEvent(d, ev);
} }
} }
}
return(True);
}
if( (ev->type != KeyPress)
|| (((Xim)ic->core.im)->private.local.top == 0 ) )
return(False);
if(p) { /* Matched */ for(t = ic->private.local.context; t; t = b[t].next) {
if(p->succession) { /* Intermediate */ if(((ev->xkey.state & b[t].modifier_mask) == b[t].modifier) &&
ic->private.local.context = p->succession; (keysym == b[t].keysym))
break;
}
if(t) { /* Matched */
if(b[t].succession) { /* Intermediate */
ic->private.local.context = b[t].succession;
return(True); return(True);
} else { /* Terminate (reached to leaf) */ } else { /* Terminate (reached to leaf) */
ic->private.local.composed = p; ic->private.local.composed = t;
ic->private.local.brl_committed = 0;
/* return back to client KeyPressEvent keycode == 0 */ /* return back to client KeyPressEvent keycode == 0 */
ev->xkey.keycode = 0; ev->xkey.keycode = 0;
_XPutBackEvent(d, ev); XPutBackEvent(d, ev);
/* initialize internal state for next key sequence */ /* initialize internal state for next key sequence */
ic->private.local.context = ((Xim)ic->core.im)->private.local.top; ic->private.local.context = ((Xim)ic->core.im)->private.local.top;
return(True); return(True);
......
...@@ -34,9 +34,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -34,9 +34,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Public char * Public char *
_XimLocalGetICValues(xic, values) _XimLocalGetICValues(XIC xic, XIMArg *values)
XIC xic;
XIMArg *values;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
XimDefICValues ic_values; XimDefICValues ic_values;
......
...@@ -85,7 +85,7 @@ _XimLocalSetFocus( ...@@ -85,7 +85,7 @@ _XimLocalSetFocus(
if (ic->core.focus_window) if (ic->core.focus_window)
_XRegisterFilterByType(ic->core.im->core.display, _XRegisterFilterByType(ic->core.im->core.display,
ic->core.focus_window, KeyPress, KeyPress, ic->core.focus_window, KeyPress, KeyRelease,
_XimLocalFilter, (XPointer)ic); _XimLocalFilter, (XPointer)ic);
return; return;
} }
...@@ -95,8 +95,11 @@ _XimLocalReset( ...@@ -95,8 +95,11 @@ _XimLocalReset(
XIC xic) XIC xic)
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
ic->private.local.composed = (DefTree *)NULL; ic->private.local.composed = 0;
ic->private.local.context = ((Xim)ic->core.im)->private.local.top; ic->private.local.context = ((Xim)ic->core.im)->private.local.top;
ic->private.local.brl_pressed = 0;
ic->private.local.brl_committing = 0;
ic->private.local.brl_committed = 0;
} }
Private char * Private char *
...@@ -147,8 +150,12 @@ _XimLocalCreateIC( ...@@ -147,8 +150,12 @@ _XimLocalCreateIC(
ic->methods = &Local_ic_methods; ic->methods = &Local_ic_methods;
ic->core.im = im; ic->core.im = im;
ic->private.local.base = ((Xim)im)->private.local.base;
ic->private.local.context = ((Xim)im)->private.local.top; ic->private.local.context = ((Xim)im)->private.local.top;
ic->private.local.composed = (DefTree *)NULL; ic->private.local.composed = 0;
ic->private.local.brl_pressed = 0;
ic->private.local.brl_committing = 0;
ic->private.local.brl_committed = 0;
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
......
...@@ -40,32 +40,47 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -40,32 +40,47 @@ PERFORMANCE OF THIS SOFTWARE.
#include <nx-X11/Xutil.h> #include <nx-X11/Xutil.h>
#include "Xlibint.h" #include "Xlibint.h"
#include "Xlcint.h" #include "Xlcint.h"
#include "XlcPubI.h"
#include "Ximint.h" #include "Ximint.h"
Public int Public int
_XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
XIC xic; KeySym *keysym, Status *status)
XKeyEvent *ev;
char *buffer;
int bytes;
KeySym *keysym;
Status *status;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
int ret; int ret;
DefTree *b = ic->private.local.base.tree;
char *mb = ic->private.local.base.mb;
if(ev->type != KeyPress) { if(ev->type != KeyPress) {
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
return(0); return(0);
} }
if(ev->keycode == 0 && ic->private.local.composed != NULL) { /* Composed Event */ if(ev->keycode == 0 &&
ret = strlen(ic->private.local.composed->mb); ( (ic->private.local.composed != 0)
||(ic->private.local.brl_committed != 0))) {
if (ic->private.local.brl_committed != 0) { /* Braille Event */
unsigned char pattern = ic->private.local.brl_committed;
char mb[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern);
if(ret > bytes) { if(ret > bytes) {
if(status) *status = XBufferOverflow; if(status) *status = XBufferOverflow;
return(ret); return(ret);
} }
memcpy(buffer, ic->private.local.composed->mb, ret); if(keysym) {
if(keysym) *keysym = ic->private.local.composed->ks; *keysym = XK_braille_blank | pattern;
if(status) *status = XLookupBoth;
} else
if(status) *status = XLookupChars;
memcpy(buffer, mb, ret);
} else { /* Composed Event */
ret = strlen(&mb[b[ic->private.local.composed].mb]);
if(ret > bytes) {
if(status) *status = XBufferOverflow;
return(ret);
}
memcpy(buffer, &mb[b[ic->private.local.composed].mb], ret);
if(keysym) *keysym = b[ic->private.local.composed].ks;
if (ret > 0) { if (ret > 0) {
if (keysym && *keysym != NoSymbol) { if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth; if(status) *status = XLookupBoth;
...@@ -79,6 +94,7 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) ...@@ -79,6 +94,7 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status)
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
} }
} }
}
return (ret); return (ret);
} else { /* Throughed Event */ } else { /* Throughed Event */
ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL);
...@@ -102,30 +118,41 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) ...@@ -102,30 +118,41 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status)
} }
Public int Public int
_XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) _XimLocalWcLookupString(XIC xic, XKeyEvent *ev, wchar_t *buffer, int wlen,
XIC xic; KeySym *keysym, Status *status)
XKeyEvent *ev;
wchar_t *buffer;
int wlen;
KeySym *keysym;
Status *status;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
int ret; int ret;
DefTree *b = ic->private.local.base.tree;
wchar_t *wc = ic->private.local.base.wc;
if(ev->type != KeyPress) { if(ev->type != KeyPress) {
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
return(0); return(0);
} }
if(ev->keycode == 0) { /* Composed Event */ if(ev->keycode == 0) {
ret = _Xwcslen(ic->private.local.composed->wc); if (ic->private.local.brl_committed != 0) { /* Braille Event */
unsigned char pattern = ic->private.local.brl_committed;
ret = 1;
if (ret > wlen) {
if(status) *status = XBufferOverflow;
return (ret);
}
*buffer = BRL_UC_ROW | pattern;
if(keysym) {
*keysym = XK_braille_blank | pattern;
if(status) *status = XLookupBoth;
} else
if(status) *status = XLookupChars;
} else { /* Composed Event */
ret = _Xwcslen(&wc[b[ic->private.local.composed].wc]);
if(ret > wlen) { if(ret > wlen) {
if(status) *status = XBufferOverflow; if(status) *status = XBufferOverflow;
return (ret); return (ret);
} }
memcpy((char *)buffer, (char *)ic->private.local.composed->wc, memcpy((char *)buffer, (char *)&wc[b[ic->private.local.composed].wc],
ret * sizeof(wchar_t)); ret * sizeof(wchar_t));
if(keysym) *keysym = ic->private.local.composed->ks; if(keysym) *keysym = b[ic->private.local.composed].ks;
if (ret > 0) { if (ret > 0) {
if (keysym && *keysym != NoSymbol) { if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth; if(status) *status = XLookupBoth;
...@@ -139,6 +166,7 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) ...@@ -139,6 +166,7 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status)
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
} }
} }
}
return (ret); return (ret);
} else { /* Throughed Event */ } else { /* Throughed Event */
ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL); ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL);
...@@ -162,29 +190,37 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) ...@@ -162,29 +190,37 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status)
} }
Public int Public int
_XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status) _XimLocalUtf8LookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
XIC xic; KeySym *keysym, Status *status)
XKeyEvent *ev;
char *buffer;
int bytes;
KeySym *keysym;
Status *status;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
int ret; int ret;
DefTree *b = ic->private.local.base.tree;
char *utf8 = ic->private.local.base.utf8;
if(ev->type != KeyPress) { if(ev->type != KeyPress) {
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
return(0); return(0);
} }
if(ev->keycode == 0) { /* Composed Event */ if(ev->keycode == 0) {
ret = strlen(ic->private.local.composed->utf8); if (ic->private.local.brl_committed != 0) { /* Braille Event */
unsigned char pattern = ic->private.local.brl_committed;
ret = 3;
if (ret > bytes) {
if(status) *status = XBufferOverflow;
return (ret);
}
buffer[0] = 0xe0 | ((BRL_UC_ROW >> 12) & 0x0f);
buffer[1] = 0x80 | ((BRL_UC_ROW >> 8) & 0x30) | (pattern >> 6);
buffer[2] = 0x80 | (pattern & 0x3f);
} else { /* Composed Event */
ret = strlen(&utf8[b[ic->private.local.composed].utf8]);
if(ret > bytes) { if(ret > bytes) {
if(status) *status = XBufferOverflow; if(status) *status = XBufferOverflow;
return (ret); return (ret);
} }
memcpy(buffer, ic->private.local.composed->utf8, ret); memcpy(buffer, &utf8[b[ic->private.local.composed].utf8], ret);
if(keysym) *keysym = ic->private.local.composed->ks; if(keysym) *keysym = b[ic->private.local.composed].ks;
if (ret > 0) { if (ret > 0) {
if (keysym && *keysym != NoSymbol) { if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth; if(status) *status = XLookupBoth;
...@@ -198,6 +234,7 @@ _XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status) ...@@ -198,6 +234,7 @@ _XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status)
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
} }
} }
}
return (ret); return (ret);
} else { /* Throughed Event */ } else { /* Throughed Event */
ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL);
...@@ -287,26 +324,16 @@ _XimLcctsconvert( ...@@ -287,26 +324,16 @@ _XimLcctsconvert(
} }
Public int Public int
_XimLcctstombs(xim, from, from_len, to, to_len, state) _XimLcctstombs(XIM xim, char *from, int from_len,
XIM xim; char *to, int to_len, Status *state)
char *from;
int from_len;
char *to;
int to_len;
Status *state;
{ {
return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv, return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv,
from, from_len, to, to_len, state); from, from_len, to, to_len, state);
} }
Public int Public int
_XimLcctstowcs(xim, from, from_len, to, to_len, state) _XimLcctstowcs(XIM xim, char *from, int from_len,
XIM xim; wchar_t *to, int to_len, Status *state)
char *from;
int from_len;
wchar_t *to;
int to_len;
Status *state;
{ {
Xim im = (Xim)xim; Xim im = (Xim)xim;
XlcConv conv = im->private.local.ctow_conv; XlcConv conv = im->private.local.ctow_conv;
...@@ -368,13 +395,8 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state) ...@@ -368,13 +395,8 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state)
} }
Public int Public int
_XimLcctstoutf8(xim, from, from_len, to, to_len, state) _XimLcctstoutf8(XIM xim, char *from, int from_len,
XIM xim; char *to, int to_len, Status *state)
char *from;
int from_len;
char *to;
int to_len;
Status *state;
{ {
return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv, return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv,
from, from_len, to, to_len, state); from, from_len, to, to_len, state);
......
...@@ -42,6 +42,8 @@ OR PERFORMANCE OF THIS SOFTWARE. ...@@ -42,6 +42,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#define XLC_BUFSIZE 256
extern int _Xmbstowcs( extern int _Xmbstowcs(
wchar_t *wstr, wchar_t *wstr,
char *str, char *str,
...@@ -276,38 +278,33 @@ static long ...@@ -276,38 +278,33 @@ static long
modmask( modmask(
char *name) char *name)
{ {
long mask;
struct _modtbl { struct _modtbl {
char *name; const char name[6];
long mask; long mask;
}; };
struct _modtbl *p;
static struct _modtbl tbl[] = { static const struct _modtbl tbl[] = {
{ "Ctrl", ControlMask }, { "Ctrl", ControlMask },
{ "Lock", LockMask }, { "Lock", LockMask },
{ "Caps", LockMask }, { "Caps", LockMask },
{ "Shift", ShiftMask }, { "Shift", ShiftMask },
{ "Alt", Mod1Mask }, { "Alt", Mod1Mask },
{ "Meta", Mod1Mask }, { "Meta", Mod1Mask }};
{ NULL, 0 }};
int i, num_entries = sizeof (tbl) / sizeof (tbl[0]);
p = tbl;
mask = 0; for (i = 0; i < num_entries; i++)
for (p = tbl; p->name != NULL; p++) { if (!strcmp (name, tbl[i].name))
if (strcmp(name, p->name) == 0) { return tbl[i].mask;
mask = p->mask;
break; return 0;
}
}
return(mask);
} }
static char* static char*
TransFileName(Xim im, char *name) TransFileName(Xim im, char *name)
{ {
char *home = NULL, *lcCompose = NULL; char *home = NULL, *lcCompose = NULL;
char dir[XLC_BUFSIZE];
char *i = name, *ret, *j; char *i = name, *ret, *j;
int l = 0; int l = 0;
...@@ -328,6 +325,10 @@ TransFileName(Xim im, char *name) ...@@ -328,6 +325,10 @@ TransFileName(Xim im, char *name)
if (lcCompose) if (lcCompose)
l += strlen(lcCompose); l += strlen(lcCompose);
break; break;
case 'S':
xlocaledir(dir, XLC_BUFSIZE);
l += strlen(dir);
break;
} }
} else { } else {
l++; l++;
...@@ -359,6 +360,10 @@ TransFileName(Xim im, char *name) ...@@ -359,6 +360,10 @@ TransFileName(Xim im, char *name)
Xfree(lcCompose); Xfree(lcCompose);
} }
break; break;
case 'S':
strcpy(j, dir);
j += strlen(dir);
break;
} }
i++; i++;
} else { } else {
...@@ -420,11 +425,13 @@ parseline( ...@@ -420,11 +425,13 @@ parseline(
char* tokenbuf) char* tokenbuf)
{ {
int token; int token;
unsigned modifier_mask; DTModifier modifier_mask;
unsigned modifier; DTModifier modifier;
unsigned tmp; DTModifier tmp;
KeySym keysym = NoSymbol; KeySym keysym = NoSymbol;
DefTree **top = &im->private.local.top; DTIndex *top = &im->private.local.top;
DefTreeBase *b = &im->private.local.base;
DTIndex t;
DefTree *p = NULL; DefTree *p = NULL;
Bool exclam, tilde; Bool exclam, tilde;
KeySym rhs_keysym = 0; KeySym rhs_keysym = 0;
...@@ -436,8 +443,8 @@ parseline( ...@@ -436,8 +443,8 @@ parseline(
char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8; char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8;
struct DefBuffer { struct DefBuffer {
unsigned modifier_mask; DTModifier modifier_mask;
unsigned modifier; DTModifier modifier;
KeySym keysym; KeySym keysym;
}; };
...@@ -467,6 +474,7 @@ parseline( ...@@ -467,6 +474,7 @@ parseline(
if (infp == NULL) if (infp == NULL)
goto error; goto error;
_XimParseStringFile(infp, im); _XimParseStringFile(infp, im);
fclose(infp);
return (0); return (0);
} else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { } else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) {
modifier = 0; modifier = 0;
...@@ -534,20 +542,24 @@ parseline( ...@@ -534,20 +542,24 @@ parseline(
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
if (token == STRING) { if (token == STRING) {
if( (rhs_string_mb = Xmalloc(strlen(tokenbuf) + 1)) == NULL ) l = strlen(tokenbuf) + 1;
while (b->mbused + l > b->mbsize) {
b->mbsize = b->mbsize ? b->mbsize * 1.5 : 1024;
if (! (b->mb = Xrealloc (b->mb, b->mbsize)) )
goto error; goto error;
}
rhs_string_mb = &b->mb[b->mbused];
b->mbused += l;
strcpy(rhs_string_mb, tokenbuf); strcpy(rhs_string_mb, tokenbuf);
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
if (token == KEY) { if (token == KEY) {
rhs_keysym = XStringToKeysym(tokenbuf); rhs_keysym = XStringToKeysym(tokenbuf);
if (rhs_keysym == NoSymbol) { if (rhs_keysym == NoSymbol) {
Xfree(rhs_string_mb);
goto error; goto error;
} }
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
} }
if (token != ENDOFLINE && token != ENDOFFILE) { if (token != ENDOFLINE && token != ENDOFFILE) {
Xfree(rhs_string_mb);
goto error; goto error;
} }
} else if (token == KEY) { } else if (token == KEY) {
...@@ -561,14 +573,13 @@ parseline( ...@@ -561,14 +573,13 @@ parseline(
} }
l = get_mb_string(im, local_mb_buf, rhs_keysym); l = get_mb_string(im, local_mb_buf, rhs_keysym);
if (l == 0) { while (b->mbused + l + 1 > b->mbsize) {
rhs_string_mb = Xmalloc(1); b->mbsize = b->mbsize ? b->mbsize * 1.5 : 1024;
} else { if (! (b->mb = Xrealloc (b->mb, b->mbsize)) )
rhs_string_mb = Xmalloc(l + 1);
}
if( rhs_string_mb == NULL ) {
goto error; goto error;
} }
rhs_string_mb = &b->mb[b->mbused];
b->mbused += l + 1;
memcpy(rhs_string_mb, local_mb_buf, l); memcpy(rhs_string_mb, local_mb_buf, l);
rhs_string_mb[l] = '\0'; rhs_string_mb[l] = '\0';
} else { } else {
...@@ -579,61 +590,69 @@ parseline( ...@@ -579,61 +590,69 @@ parseline(
if (l == LOCAL_WC_BUFSIZE - 1) { if (l == LOCAL_WC_BUFSIZE - 1) {
local_wc_buf[l] = (wchar_t)'\0'; local_wc_buf[l] = (wchar_t)'\0';
} }
if( (rhs_string_wc = (wchar_t *)Xmalloc((l + 1) * sizeof(wchar_t))) == NULL ) { while (b->wcused + l + 1 > b->wcsize) {
Xfree( rhs_string_mb ); b->wcsize = b->wcsize ? b->wcsize * 1.5 : 512;
return( 0 ); if (! (b->wc = Xrealloc (b->wc, sizeof(wchar_t) * b->wcsize)) )
goto error;
} }
rhs_string_wc = &b->wc[b->wcused];
b->wcused += l + 1;
memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) ); memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) );
l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1); l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1);
if (l == LOCAL_UTF8_BUFSIZE - 1) { if (l == LOCAL_UTF8_BUFSIZE - 1) {
local_utf8_buf[l] = '\0'; local_utf8_buf[l] = '\0';
} }
if( (rhs_string_utf8 = (char *)Xmalloc(l + 1)) == NULL ) { while (b->utf8used + l + 1 > b->utf8size) {
Xfree( rhs_string_wc ); b->utf8size = b->utf8size ? b->utf8size * 1.5 : 1024;
Xfree( rhs_string_mb ); if (! (b->utf8 = Xrealloc (b->utf8, b->utf8size)) )
return( 0 ); goto error;
} }
rhs_string_utf8 = &b->utf8[b->utf8used];
b->utf8used += l + 1;
memcpy(rhs_string_utf8, local_utf8_buf, l + 1); memcpy(rhs_string_utf8, local_utf8_buf, l + 1);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (p = *top; p; p = p->next) { for (t = *top; t; t = b->tree[t].next) {
if (buf[i].keysym == p->keysym && if (buf[i].keysym == b->tree[t].keysym &&
buf[i].modifier == p->modifier && buf[i].modifier == b->tree[t].modifier &&
buf[i].modifier_mask == p->modifier_mask) { buf[i].modifier_mask == b->tree[t].modifier_mask) {
break; break;
} }
} }
if (p) { if (t) {
p = &b->tree[t];
top = &p->succession; top = &p->succession;
} else { } else {
if( (p = (DefTree*)Xmalloc(sizeof(DefTree))) == NULL ) { while (b->treeused >= b->treesize) {
Xfree( rhs_string_mb ); DefTree *old = b->tree;
int oldsize = b->treesize;
b->treesize = b->treesize ? b->treesize * 1.5 : 256;
if (! (b->tree = Xrealloc (b->tree, sizeof(DefTree) * b->treesize)) )
goto error; goto error;
if (top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize])
top = (DTIndex *) (((char *) top) + (((char *)b->tree)-(char *)old));
} }
p = &b->tree[b->treeused];
p->keysym = buf[i].keysym; p->keysym = buf[i].keysym;
p->modifier = buf[i].modifier; p->modifier = buf[i].modifier;
p->modifier_mask = buf[i].modifier_mask; p->modifier_mask = buf[i].modifier_mask;
p->succession = NULL; p->succession = 0;
p->next = *top; p->next = *top;
p->mb = NULL; p->mb = 0;
p->wc = NULL; p->wc = 0;
p->utf8 = NULL; p->utf8 = 0;
p->ks = NoSymbol; p->ks = NoSymbol;
*top = p; *top = b->treeused;
top = &p->succession; top = &p->succession;
b->treeused++;
} }
} }
if( p->mb != NULL ) /* old entries no longer freed... */
Xfree( p->mb ); p->mb = rhs_string_mb - b->mb;
p->mb = rhs_string_mb; p->wc = rhs_string_wc - b->wc;
if( p->wc != NULL ) p->utf8 = rhs_string_utf8 - b->utf8;
Xfree( p->wc );
p->wc = rhs_string_wc;
if( p->utf8 != NULL )
Xfree( p->utf8 );
p->utf8 = rhs_string_utf8;
p->ks = rhs_keysym; p->ks = rhs_keysym;
return(n); return(n);
error: error:
......
...@@ -38,9 +38,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -38,9 +38,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Public char * Public char *
_XimLocalSetICValues(xic, values) _XimLocalSetICValues(XIC xic, XIMArg *values)
XIC xic;
XIMArg *values;
{ {
XimDefICValues ic_values; XimDefICValues ic_values;
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
......
...@@ -520,9 +520,9 @@ Private Bool ThaiComposeConvert( ...@@ -520,9 +520,9 @@ Private Bool ThaiComposeConvert(
* Macros to save and recall last input character in XIC * Macros to save and recall last input character in XIC
*/ */
#define IC_SavePreviousChar(ic,ch) \ #define IC_SavePreviousChar(ic,ch) \
(*((ic)->private.local.context->mb) = (char) (ch)) ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = (char) (ch))
#define IC_ClearPreviousChar(ic) \ #define IC_ClearPreviousChar(ic) \
(*((ic)->private.local.context->mb) = 0) ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = 0)
#define IC_GetPreviousChar(ic) \ #define IC_GetPreviousChar(ic) \
(IC_RealGetPreviousChar(ic,1)) (IC_RealGetPreviousChar(ic,1))
#define IC_GetContextChar(ic) \ #define IC_GetContextChar(ic) \
...@@ -534,6 +534,7 @@ Private unsigned char ...@@ -534,6 +534,7 @@ Private unsigned char
IC_RealGetPreviousChar(Xic ic, unsigned short pos) IC_RealGetPreviousChar(Xic ic, unsigned short pos)
{ {
XICCallback* cb = &ic->core.string_conversion_callback; XICCallback* cb = &ic->core.string_conversion_callback;
DefTreeBase *b = &ic->private.local.base;
if (cb && cb->callback) { if (cb && cb->callback) {
XIMStringConversionCallbackStruct screc; XIMStringConversionCallbackStruct screc;
...@@ -550,25 +551,49 @@ IC_RealGetPreviousChar(Xic ic, unsigned short pos) ...@@ -550,25 +551,49 @@ IC_RealGetPreviousChar(Xic ic, unsigned short pos)
(cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc);
if (!screc.text) if (!screc.text)
return (unsigned char) *((ic)->private.local.context->mb); return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
if ((screc.text->feedback && if ((screc.text->feedback &&
*screc.text->feedback == XIMStringConversionLeftEdge) || *screc.text->feedback == XIMStringConversionLeftEdge) ||
screc.text->length < 1) screc.text->length < 1)
{ {
c = 0; c = 0;
} else { } else {
Xim im;
XlcConv conv;
int from_left;
int to_left;
char *from_buf;
char *to_buf;
im = (Xim) XIMOfIC((XIC)ic);
if (screc.text->encoding_is_wchar) { if (screc.text->encoding_is_wchar) {
c = ucs2tis(screc.text->string.wcs[0]); conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar,
XFree(screc.text->string.wcs); im->core.lcd, XlcNCharSet);
from_buf = (char *) screc.text->string.wcs;
from_left = screc.text->length * sizeof(wchar_t);
} else { } else {
c = screc.text->string.mbs[0]; conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte,
XFree(screc.text->string.mbs); im->core.lcd, XlcNCharSet);
from_buf = screc.text->string.mbs;
from_left = screc.text->length;
} }
to_buf = (char *)&c;
to_left = 1;
_XlcResetConverter(conv);
if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left,
(XPointer *)&to_buf, &to_left, NULL, 0) < 0)
{
c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
}
_XlcCloseConverter(conv);
XFree(screc.text->string.mbs);
} }
XFree(screc.text); XFree(screc.text);
return c; return c;
} else { } else {
return (unsigned char) *((ic)->private.local.context->mb); return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
} }
} }
...@@ -1191,13 +1216,14 @@ Private void InitIscMode(Xic ic) ...@@ -1191,13 +1216,14 @@ Private void InitIscMode(Xic ic)
Private Bool Private Bool
ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol)
{ {
ic->private.local.composed->wc[0] = tis2ucs(new_char); DefTreeBase *b = &ic->private.local.base;
ic->private.local.composed->wc[1] = '\0'; b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char);
b->wc[b->tree[ic->private.local.composed].wc+1] = '\0';
if ((new_char <= 0x1f) || (new_char == 0x7f)) if ((new_char <= 0x1f) || (new_char == 0x7f))
ic->private.local.composed->keysym = symbol; b->tree[ic->private.local.composed].keysym = symbol;
else else
ic->private.local.composed->keysym = NoSymbol; b->tree[ic->private.local.composed].keysym = NoSymbol;
return True; return True;
} }
...@@ -1205,12 +1231,13 @@ ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) ...@@ -1205,12 +1231,13 @@ ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol)
Private Bool Private Bool
ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char)
{ {
DefTreeBase *b = &ic->private.local.base;
if (!IC_DeletePreviousChar(ic)) return False; if (!IC_DeletePreviousChar(ic)) return False;
ic->private.local.composed->wc[0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char);
ic->private.local.composed->wc[1] = tis2ucs(previous_char); b->wc[b->tree[ic->private.local.composed].wc+1] = tis2ucs(previous_char);
ic->private.local.composed->wc[2] = '\0'; b->wc[b->tree[ic->private.local.composed].wc+2] = '\0';
ic->private.local.composed->keysym = NoSymbol; b->tree[ic->private.local.composed].keysym = NoSymbol;
return True; return True;
} }
...@@ -1218,27 +1245,40 @@ ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) ...@@ -1218,27 +1245,40 @@ ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char)
Private Bool Private Bool
ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol) ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol)
{ {
DefTreeBase *b = &ic->private.local.base;
if (!IC_DeletePreviousChar(ic)) return False; if (!IC_DeletePreviousChar(ic)) return False;
ic->private.local.composed->wc[0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char);
ic->private.local.composed->wc[1] = '\0'; b->wc[b->tree[ic->private.local.composed].wc+1] = '\0';
if ((new_char <= 0x1f) || (new_char == 0x7f)) if ((new_char <= 0x1f) || (new_char == 0x7f))
ic->private.local.composed->keysym = symbol; b->tree[ic->private.local.composed].keysym = symbol;
else else
ic->private.local.composed->keysym = NoSymbol; b->tree[ic->private.local.composed].keysym = NoSymbol;
return True; return True;
} }
Private unsigned
NumLockMask(Display *d)
{
int i;
XModifierKeymap *map = XGetModifierMapping (d);
KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock);
if (numlock_keycode == NoSymbol)
return 0;
for (i = 0; i < 8; i++) {
if (map->modifiermap[map->max_keypermod * i] == numlock_keycode)
return 1 << i;
}
return 0;
}
/* /*
* Filter function for TACTIS * Filter function for TACTIS
*/ */
Bool Bool
_XimThaiFilter(d, w, ev, client_data) _XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data)
Display *d;
Window w;
XEvent *ev;
XPointer client_data;
{ {
Xic ic = (Xic)client_data; Xic ic = (Xic)client_data;
KeySym symbol; KeySym symbol;
...@@ -1254,6 +1294,7 @@ XPointer client_data; ...@@ -1254,6 +1294,7 @@ XPointer client_data;
#endif #endif
wchar_t wbuf[10]; wchar_t wbuf[10];
Bool isReject; Bool isReject;
DefTreeBase *b = &ic->private.local.base;
if ((ev->type != KeyPress) if ((ev->type != KeyPress)
|| (ev->xkey.keycode == 0)) || (ev->xkey.keycode == 0))
...@@ -1264,7 +1305,7 @@ XPointer client_data; ...@@ -1264,7 +1305,7 @@ XPointer client_data;
XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]),
&symbol, NULL); &symbol, NULL);
if ((ev->xkey.state & (AllMods & ~ShiftMask)) || if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) ||
((symbol >> 8 == 0xFF) && ((symbol >> 8 == 0xFF) &&
((XK_BackSpace <= symbol && symbol <= XK_Clear) || ((XK_BackSpace <= symbol && symbol <= XK_Clear) ||
(symbol == XK_Return) || (symbol == XK_Return) ||
...@@ -1356,11 +1397,11 @@ XPointer client_data; ...@@ -1356,11 +1397,11 @@ XPointer client_data;
return True; return True;
} }
_Xlcwcstombs(ic->core.im->core.lcd, ic->private.local.composed->mb, _Xlcwcstombs(ic->core.im->core.lcd, &b->mb[b->tree[ic->private.local.composed].mb],
ic->private.local.composed->wc, 10); &b->wc[b->tree[ic->private.local.composed].wc], 10);
_Xlcmbstoutf8(ic->core.im->core.lcd, ic->private.local.composed->utf8, _Xlcmbstoutf8(ic->core.im->core.lcd, &b->utf8[b->tree[ic->private.local.composed].utf8],
ic->private.local.composed->mb, 10); &b->mb[b->tree[ic->private.local.composed].mb], 10);
/* Remember the last character inputted /* Remember the last character inputted
* (as fallback in case StringConversionCallback is not provided) * (as fallback in case StringConversionCallback is not provided)
......
...@@ -60,6 +60,8 @@ _XimThaiDestroyIC( ...@@ -60,6 +60,8 @@ _XimThaiDestroyIC(
XIC xic) XIC xic)
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
DefTreeBase *b = &ic->private.local.base;
if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) {
_XimThaiUnSetFocus(xic); _XimThaiUnSetFocus(xic);
} }
...@@ -68,14 +70,14 @@ _XimThaiDestroyIC( ...@@ -68,14 +70,14 @@ _XimThaiDestroyIC(
ic->private.local.ic_resources = NULL; ic->private.local.ic_resources = NULL;
} }
Xfree(ic->private.local.context->mb); if (b->tree) Xfree (b->tree);
Xfree(ic->private.local.context->wc); if (b->mb) Xfree (b->mb);
Xfree(ic->private.local.context->utf8); if (b->wc) Xfree (b->wc);
Xfree(ic->private.local.context); if (b->utf8) Xfree (b->utf8);
Xfree(ic->private.local.composed->mb); b->tree = NULL;
Xfree(ic->private.local.composed->wc); b->mb = NULL;
Xfree(ic->private.local.composed->utf8); b->wc = NULL;
Xfree(ic->private.local.composed); b->utf8 = NULL;
return; return;
} }
...@@ -105,11 +107,12 @@ _XimThaiReset( ...@@ -105,11 +107,12 @@ _XimThaiReset(
XIC xic) XIC xic)
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
DefTreeBase *b = &ic->private.local.base;
ic->private.local.thai.comp_state = 0; ic->private.local.thai.comp_state = 0;
ic->private.local.thai.keysym = 0; ic->private.local.thai.keysym = 0;
ic->private.local.composed->mb[0] = '\0'; b->mb[b->tree[ic->private.local.composed].mb] = '\0';
ic->private.local.composed->wc[0] = 0; b->wc[b->tree[ic->private.local.composed].wc] = '\0';
ic->private.local.composed->utf8[0] = '\0'; b->utf8[b->tree[ic->private.local.composed].utf8] = '\0';
} }
Private char * Private char *
...@@ -152,6 +155,7 @@ _XimThaiCreateIC( ...@@ -152,6 +155,7 @@ _XimThaiCreateIC(
XIMResourceList res; XIMResourceList res;
unsigned int num; unsigned int num;
int len; int len;
DefTree *tree;
if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) { if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) {
return ((XIC)NULL); return ((XIC)NULL);
...@@ -161,30 +165,23 @@ _XimThaiCreateIC( ...@@ -161,30 +165,23 @@ _XimThaiCreateIC(
ic->methods = &Thai_ic_methods; ic->methods = &Thai_ic_methods;
ic->core.im = im; ic->core.im = im;
ic->core.filter_events = KeyPressMask; ic->core.filter_events = KeyPressMask;
if ((ic->private.local.context = (DefTree *)Xmalloc(sizeof(DefTree)))
== (DefTree *)NULL) if (! (ic->private.local.base.tree = tree = (DefTree *)Xmalloc(sizeof(DefTree)*3)) )
goto Set_Error;
if ((ic->private.local.context->mb = (char *)Xmalloc(10))
== (char *)NULL)
goto Set_Error;
if ((ic->private.local.context->wc = (wchar_t *)Xmalloc(10*sizeof(wchar_t)))
== (wchar_t *)NULL)
goto Set_Error;
if ((ic->private.local.context->utf8 = (char *)Xmalloc(10))
== (char *)NULL)
goto Set_Error;
if ((ic->private.local.composed = (DefTree *)Xmalloc(sizeof(DefTree)))
== (DefTree *)NULL)
goto Set_Error; goto Set_Error;
if ((ic->private.local.composed->mb = (char *)Xmalloc(10)) if (! (ic->private.local.base.mb = (char *)Xmalloc(21)) )
== (char *)NULL)
goto Set_Error; goto Set_Error;
if ((ic->private.local.composed->wc = (wchar_t *)Xmalloc(10*sizeof(wchar_t))) if (! (ic->private.local.base.wc = (wchar_t*)Xmalloc(sizeof(wchar_t)*21)) )
== (wchar_t *)NULL)
goto Set_Error; goto Set_Error;
if ((ic->private.local.composed->utf8 = (char *)Xmalloc(10)) if (! (ic->private.local.base.utf8 = (char *)Xmalloc(21)) )
== (char *)NULL)
goto Set_Error; goto Set_Error;
ic->private.local.context = 1;
tree[1].mb = 1;
tree[1].wc = 1;
tree[1].utf8 = 1;
ic->private.local.composed = 2;
tree[2].mb = 11;
tree[2].wc = 11;
tree[2].utf8 = 11;
ic->private.local.thai.comp_state = 0; ic->private.local.thai.comp_state = 0;
ic->private.local.thai.keysym = 0; ic->private.local.thai.keysym = 0;
......
...@@ -59,21 +59,25 @@ Private XIMMethodsRec Xim_im_thai_methods = { ...@@ -59,21 +59,25 @@ Private XIMMethodsRec Xim_im_thai_methods = {
#define THAI_LANGUAGE_NAME "th" #define THAI_LANGUAGE_NAME "th"
Bool Bool
_XimCheckIfThaiProcessing(im) _XimCheckIfThaiProcessing(Xim im)
Xim im;
{ {
char *language; char *language;
_XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL); _XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL);
if(strcmp(language, THAI_LANGUAGE_NAME) == 0) { if(strcmp(language, THAI_LANGUAGE_NAME) == 0 &&
(strcmp(im->core.im_name, "") == 0 ||
strcmp(im->core.im_name, "BasicCheck") == 0 ||
strcmp(im->core.im_name, "Strict") == 0 ||
strcmp(im->core.im_name, "Thaicat") == 0 ||
strcmp(im->core.im_name, "Passthrough") == 0))
{
return(True); return(True);
} }
return(False); return(False);
} }
Public Bool Public Bool
_XimThaiOpenIM(im) _XimThaiOpenIM(Xim im)
Xim im;
{ {
XLCd lcd = im->core.lcd; XLCd lcd = im->core.lcd;
XlcConv conv; XlcConv conv;
...@@ -142,8 +146,7 @@ Open_Error : ...@@ -142,8 +146,7 @@ Open_Error :
} }
Public void Public void
_XimThaiIMFree(im) _XimThaiIMFree(Xim im)
Xim im;
{ {
if(im->core.im_resources) { if(im->core.im_resources) {
Xfree(im->core.im_resources); Xfree(im->core.im_resources);
...@@ -213,8 +216,7 @@ _XimThaiIMFree(im) ...@@ -213,8 +216,7 @@ _XimThaiIMFree(im)
} }
Public Status Public Status
_XimThaiCloseIM(xim) _XimThaiCloseIM(XIM xim)
XIM xim;
{ {
Xim im = (Xim)xim; Xim im = (Xim)xim;
XIC ic; XIC ic;
......
/*
* Copyright 1992 Sun Microsystems, Inc. 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 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
...@@ -153,6 +174,8 @@ _XimXConnect(Xim im) ...@@ -153,6 +174,8 @@ _XimXConnect(Xim im)
event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid; event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid;
event.xclient.data.l[1] = spec->major_code; event.xclient.data.l[1] = spec->major_code;
event.xclient.data.l[2] = spec->minor_code; event.xclient.data.l[2] = spec->minor_code;
event.xclient.data.l[3] = 0;
event.xclient.data.l[4] = 0;
if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) { if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) {
XWindowAttributes atr; XWindowAttributes atr;
...@@ -353,6 +376,7 @@ _XimXGetReadData( ...@@ -353,6 +376,7 @@ _XimXGetReadData(
(void)memcpy(buf, prop_ret, (int)nitems); (void)memcpy(buf, prop_ret, (int)nitems);
*ret_len = (int)nitems; *ret_len = (int)nitems;
if (bytes_after_ret > 0) { if (bytes_after_ret > 0) {
XFree(prop_ret);
XGetWindowProperty(im->core.display, XGetWindowProperty(im->core.display,
spec->lib_connect_wid, prop, 0L, spec->lib_connect_wid, prop, 0L,
((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType, ((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType,
...@@ -459,9 +483,7 @@ _XimXFlush(Xim im) ...@@ -459,9 +483,7 @@ _XimXFlush(Xim im)
} }
Public Bool Public Bool
_XimXConf(im, address) _XimXConf(Xim im, char *address)
Xim im;
char *address;
{ {
XSpecRec *spec; XSpecRec *spec;
......
/*
* Copyright 1992 Sun Microsystems, Inc. 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 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
...@@ -74,10 +95,7 @@ _XimTransConnect( ...@@ -74,10 +95,7 @@ _XimTransConnect(
spec->trans_conn = NULL; spec->trans_conn = NULL;
if (connect_stat == TRANS_TRY_CONNECT_AGAIN) if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
{
sleep(1);
continue; continue;
}
else else
break; break;
} }
......
/*
* Copyright 1992 Sun Microsystems, Inc. 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 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
...@@ -55,15 +76,13 @@ Public TransportSW _XimTransportRec[] = { ...@@ -55,15 +76,13 @@ Public TransportSW _XimTransportRec[] = {
}; };
Public Bool Public Bool
_XimConnect(im) _XimConnect(Xim im)
Xim im;
{ {
return im->private.proto.connect(im); return im->private.proto.connect(im);
} }
Public Bool Public Bool
_XimShutdown(im) _XimShutdown(Xim im)
Xim im;
{ {
return im->private.proto.shutdown(im); return im->private.proto.shutdown(im);
} }
...@@ -212,15 +231,8 @@ _XimCallDispatcher( ...@@ -212,15 +231,8 @@ _XimCallDispatcher(
} }
Public int Public int
_XimRead(im, len, buf, buf_size, predicate, arg) _XimRead(Xim im, INT16 *len, XPointer buf, int buf_size,
Xim im; Bool (*predicate)(Xim, INT16, XPointer, XPointer), XPointer arg)
INT16 *len;
XPointer buf;
int buf_size;
Bool (*predicate)(
Xim, INT16, XPointer, XPointer
);
XPointer arg;
{ {
INT16 read_len; INT16 read_len;
int ret_code; int ret_code;
...@@ -252,16 +264,14 @@ _XimRegisterDispatcher( ...@@ -252,16 +264,14 @@ _XimRegisterDispatcher(
} }
Public void Public void
_XimFlush(im) _XimFlush(Xim im)
Xim im;
{ {
im->private.proto.flush(im); im->private.proto.flush(im);
return; return;
} }
Public Bool Public Bool
_XimFilterWaitEvent(im) _XimFilterWaitEvent(Xim im)
Xim im;
{ {
INT16 read_len; INT16 read_len;
CARD32 reply32[BUFSIZE/4]; CARD32 reply32[BUFSIZE/4];
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#define MB_LEN_MAX 6 #define MB_LEN_MAX 6
#endif #endif
#if !defined(macII) && !defined(Lynx_22) && !defined(X_LOCALE) #if !defined(Lynx_22) && !defined(X_LOCALE)
#define STDCVT #define STDCVT
#endif #endif
......
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
#include "XlcGeneric.h" #include "XlcGeneric.h"
#include <stdio.h> #include <stdio.h>
#if !defined(macII) && !defined(Lynx_22) && !defined(X_LOCALE) #if !defined(Lynx_22) && !defined(X_LOCALE)
#define STDCVT #define STDCVT
#endif #endif
typedef struct _CTDataRec { typedef struct _CTDataRec {
char *name; const char *name;
char *encoding; /* Compound Text encoding */ const char *encoding; /* Compound Text encoding */
} CTDataRec, *CTData; } CTDataRec, *CTData;
static CTDataRec directionality_data[] = static CTDataRec directionality_data[] =
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "XlcGeneric.h" #include "XlcGeneric.h"
#include <stdio.h> #include <stdio.h>
#if !defined(macII) && !defined(X_LOCALE) #if !defined(X_LOCALE)
#define STDCVT #define STDCVT
#endif #endif
......
/* $TOG: $ */
/****************************************************************** /******************************************************************
Copyright 1993 by SunSoft, Inc. Copyright 1993 by SunSoft, Inc.
...@@ -50,13 +49,21 @@ _XlcUtf8Loader( ...@@ -50,13 +49,21 @@ _XlcUtf8Loader(
return lcd; return lcd;
/* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */
if (!XLC_PUBLIC_PART(lcd)->codeset || if (!XLC_PUBLIC_PART(lcd)->codeset) {
(_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8"))) {
_XlcDestroyLC(lcd); _XlcDestroyLC(lcd);
return (XLCd) NULL; return (XLCd) NULL;
} }
else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) {
_XlcAddUtf8LocaleConverters(lcd); _XlcAddUtf8LocaleConverters(lcd);
}
else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) {
_XlcAddGB18030LocaleConverters(lcd);
}
else {
_XlcDestroyLC(lcd);
return (XLCd) NULL;
}
_XlcAddUtf8Converters(lcd); _XlcAddUtf8Converters(lcd);
return lcd; return lcd;
......
...@@ -410,11 +410,10 @@ set_fontset_extents( ...@@ -410,11 +410,10 @@ set_fontset_extents(
} }
} }
if(font_set->vrotate_num > 0) { if(font_set->vrotate_num > 0 && font_set->vrotate != NULL) {
font_data = (FontData) font_set->vrotate; font_data = (FontData) font_set->vrotate;
font_data_count = font_set->vrotate_num; font_data_count = font_set->vrotate_num;
for( ; font_data_count-- ; font_data++) { for( ; font_data_count-- ; font_data++) {
if(font_data != NULL)
if(font_data->font != NULL) { if(font_data->font != NULL) {
check_fontset_extents(&overall, &logical_ascent, check_fontset_extents(&overall, &logical_ascent,
&logical_descent, &logical_descent,
...@@ -569,6 +568,9 @@ get_rotate_fontname( ...@@ -569,6 +568,9 @@ get_rotate_fontname(
if((ptr = strchr(ptr, '-'))) { if((ptr = strchr(ptr, '-'))) {
*ptr = '\0'; *ptr = '\0';
} else {
field_num++; /* Count last field */
break;
} }
} }
...@@ -613,7 +615,8 @@ get_rotate_fontname( ...@@ -613,7 +615,8 @@ get_rotate_fontname(
for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD &&
fields[field_num] ; field_num++) { fields[field_num] ; field_num++) {
sprintf(rotate_font_ptr, "%s-%s", rotate_font_ptr, fields[field_num]); strcat(rotate_font_ptr, "-");
strcat(rotate_font_ptr, fields[field_num]);
} }
if(pattern) if(pattern)
...@@ -1614,7 +1617,7 @@ static XOCMethodsRec oc_generic_methods = { ...@@ -1614,7 +1617,7 @@ static XOCMethodsRec oc_generic_methods = {
}; };
typedef struct _XOCMethodsListRec { typedef struct _XOCMethodsListRec {
char *name; const char *name;
XOCMethods methods; XOCMethods methods;
} XOCMethodsListRec, *XOCMethodsList; } XOCMethodsListRec, *XOCMethodsList;
......
...@@ -365,7 +365,7 @@ _XomInitConverter( ...@@ -365,7 +365,7 @@ _XomInitConverter(
{ {
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
XlcConv *convp; XlcConv *convp;
char *conv_type; const char *conv_type;
XlcConv conv; XlcConv conv;
XLCd lcd; XLCd lcd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment