From e1938c189223164f3a75cf848e90ecc1d2e55d15 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 22 Aug 2018 22:30:34 +0200 Subject: libNX_X11: upgrade to X.org upstream version 1.6.6 We are at X.Org libX11 upstream commit 733f64b Fixes: ArcticaProject/nx-libs #716, #719 and #720 --- nx-X11/lib/modules/im/ximcp/imCallbk.c | 6 +-- nx-X11/lib/modules/im/ximcp/imDefIc.c | 82 ++++++++++++++++++++----------- nx-X11/lib/modules/im/ximcp/imInsClbk.c | 2 +- nx-X11/lib/modules/im/ximcp/imLcIm.c | 8 +-- nx-X11/lib/modules/im/ximcp/imLcLkup.c | 6 +-- nx-X11/lib/modules/om/generic/omGeneric.c | 32 ++++-------- 6 files changed, 74 insertions(+), 62 deletions(-) (limited to 'nx-X11/lib/modules') diff --git a/nx-X11/lib/modules/im/ximcp/imCallbk.c b/nx-X11/lib/modules/im/ximcp/imCallbk.c index 4e091d8ef..ead0806c6 100644 --- a/nx-X11/lib/modules/im/ximcp/imCallbk.c +++ b/nx-X11/lib/modules/im/ximcp/imCallbk.c @@ -624,16 +624,16 @@ _XimPreeditCaretCallback(Xim im, */ { CARD8 buf[sz_ximPacketHeader + sz_ximPreeditCaretReply]; - INT16 len = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply; + INT16 rlen = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply; int p; - _XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &len); + _XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &rlen); p = XIM_HEADER_SIZE; *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; *(CARD32*)&buf[p] = (CARD32)cbs.position; - if (!(_XimWriteData(im, len, buf))) { + if (!(_XimWriteData(im, rlen, buf))) { return XimCbError; } _XimFlushData(im); diff --git a/nx-X11/lib/modules/im/ximcp/imDefIc.c b/nx-X11/lib/modules/im/ximcp/imDefIc.c index 3cf46827a..30c2d0136 100644 --- a/nx-X11/lib/modules/im/ximcp/imDefIc.c +++ b/nx-X11/lib/modules/im/ximcp/imDefIc.c @@ -231,10 +231,9 @@ _XimReCreateIC(ic) _XimRegisterFilter(ic); MARK_IC_CONNECTED(ic); - if (save_ic->private.proto.ic_resources) - Xfree(save_ic->private.proto.ic_resources); - if (save_ic->private.proto.ic_inner_resources) - Xfree(save_ic->private.proto.ic_inner_resources); + + Xfree(save_ic->private.proto.ic_resources); + Xfree(save_ic->private.proto.ic_inner_resources); Xfree(save_ic); return True; @@ -833,7 +832,7 @@ _XimDestroyICCheck( && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) - ret = False; + ret = False; return ret; } @@ -845,22 +844,22 @@ _XimProtoICFree( Xim im = (Xim)ic->core.im; #endif - if (ic->private.proto.preedit_font) { - Xfree(ic->private.proto.preedit_font); - ic->private.proto.preedit_font = NULL; - } - if (ic->private.proto.status_font) { - Xfree(ic->private.proto.status_font); - ic->private.proto.status_font = NULL; - } + + Xfree(ic->private.proto.preedit_font); + ic->private.proto.preedit_font = NULL; + + + Xfree(ic->private.proto.status_font); + ic->private.proto.status_font = NULL; + if (ic->private.proto.commit_info) { _XimFreeCommitInfo(ic); ic->private.proto.commit_info = NULL; } - if (ic->private.proto.ic_inner_resources) { - Xfree(ic->private.proto.ic_inner_resources); - ic->private.proto.ic_inner_resources = NULL; - } + + Xfree(ic->private.proto.ic_inner_resources); + ic->private.proto.ic_inner_resources = NULL; + #ifdef XIM_CONNECTABLE if (IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { @@ -868,18 +867,16 @@ _XimProtoICFree( } #endif /* XIM_CONNECTABLE */ - if (ic->private.proto.saved_icvalues) { - Xfree(ic->private.proto.saved_icvalues); - ic->private.proto.saved_icvalues = NULL; - } - if (ic->private.proto.ic_resources) { - Xfree(ic->private.proto.ic_resources); - ic->private.proto.ic_resources = NULL; - } - if (ic->core.hotkey) { - Xfree(ic->core.hotkey); - ic->core.hotkey = NULL; - } + Xfree(ic->private.proto.saved_icvalues); + ic->private.proto.saved_icvalues = NULL; + + + Xfree(ic->private.proto.ic_resources); + ic->private.proto.ic_resources = NULL; + + + Xfree(ic->core.hotkey); + ic->core.hotkey = NULL; return; } @@ -927,6 +924,30 @@ _XimProtoDestroyIC( return; } +/* + * Some functions require the request queue from the server to be flushed + * so that the ordering of client initiated status changes and those requested + * by the server is well defined. + * _XimSync() would be the function of choice here as it should get a + * XIM_SYNC_REPLY back from the server. + * This however isn't implemented in the piece of junk that is used by most + * input servers as the server side protocol if to XIM. + * Since this code is not shipped as a library together with the client side + * XIM code but is duplicated by every input server around the world there + * is no easy fix to this but this ugly hack below. + * Obtaining an IC value from the server sends a request and empties out the + * event/server request queue until the answer to this request is found. + * Thus it is guaranteed that any pending server side request gets processed. + * This is what the hack below is doing. + */ + +static void +BrokenSyncWithServer(XIC xic) +{ + CARD32 dummy; + XGetICValues(xic, XNFilterEvents, &dummy, NULL); +} + static void _XimProtoSetFocus( XIC xic) @@ -957,6 +978,7 @@ _XimProtoSetFocus( } } #endif /* XIM_CONNECTABLE */ + BrokenSyncWithServer(xic); buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ @@ -1003,6 +1025,8 @@ _XimProtoUnsetFocus( } #endif /* XIM_CONNECTABLE */ + BrokenSyncWithServer(xic); + buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ diff --git a/nx-X11/lib/modules/im/ximcp/imInsClbk.c b/nx-X11/lib/modules/im/ximcp/imInsClbk.c index 3ae6b1bd7..214e0a9af 100644 --- a/nx-X11/lib/modules/im/ximcp/imInsClbk.c +++ b/nx-X11/lib/modules/im/ximcp/imInsClbk.c @@ -108,7 +108,7 @@ _XimFilterPropertyNotify( } lock = True; - for( ii = 0; ii < nitems; ii++, atoms ) { + for( ii = 0; ii < nitems; ii++ ) { if(XGetSelectionOwner (display, atoms[ii])) { for( icb = callback_list; icb; icb = icb->next ) { if( !icb->call && !icb->destroy ) { diff --git a/nx-X11/lib/modules/im/ximcp/imLcIm.c b/nx-X11/lib/modules/im/ximcp/imLcIm.c index b3662bc96..41d4fb3fa 100644 --- a/nx-X11/lib/modules/im/ximcp/imLcIm.c +++ b/nx-X11/lib/modules/im/ximcp/imLcIm.c @@ -82,8 +82,8 @@ struct _XimCacheStruct { DTCharIndex mbused; DTCharIndex wcused; DTCharIndex utf8used; - char fname[1]; - /* char encoding[1] */ + char fname[]; + /* char encoding[] */ }; static struct _XimCacheStruct* _XimCache_mmap = NULL; @@ -281,7 +281,7 @@ _XimReadCachedDefaultTree( assert (m->id == XIM_CACHE_MAGIC); assert (m->version == XIM_CACHE_VERSION); if (size != m->size || - size < XOffsetOf (struct _XimCacheStruct, fname) + namelen + encodinglen) { + size < sizeof (struct _XimCacheStruct) + namelen + encodinglen) { fprintf (stderr, "Ignoring broken XimCache %s [%s]\n", name, encoding); munmap (m, size); return False; @@ -442,7 +442,7 @@ _XimWriteCachedDefaultTree( int fd; FILE *fp; struct _XimCacheStruct *m; - int msize = (XOffsetOf(struct _XimCacheStruct, fname) + int msize = (sizeof(struct _XimCacheStruct) + strlen(name) + strlen(encoding) + 2 + XIM_CACHE_TREE_ALIGNMENT-1) & -XIM_CACHE_TREE_ALIGNMENT; DefTreeBase *b = &im->private.local.base; diff --git a/nx-X11/lib/modules/im/ximcp/imLcLkup.c b/nx-X11/lib/modules/im/ximcp/imLcLkup.c index 878b8e350..ac9a1705c 100644 --- a/nx-X11/lib/modules/im/ximcp/imLcLkup.c +++ b/nx-X11/lib/modules/im/ximcp/imLcLkup.c @@ -61,8 +61,8 @@ _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, ||(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); + char mb2[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)]; + ret = _Xlcwctomb(ic->core.im->core.lcd, mb2, BRL_UC_ROW | pattern); if(ret > bytes) { if(status) *status = XBufferOverflow; return(ret); @@ -74,7 +74,7 @@ _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, } else { if(status) *status = XLookupChars; } - memcpy(buffer, mb, ret); + memcpy(buffer, mb2, ret); } else { if(keysym) { if(status) *status = XLookupKeySym; diff --git a/nx-X11/lib/modules/om/generic/omGeneric.c b/nx-X11/lib/modules/om/generic/omGeneric.c index 68eec01c0..ec612d379 100644 --- a/nx-X11/lib/modules/om/generic/omGeneric.c +++ b/nx-X11/lib/modules/om/generic/omGeneric.c @@ -1617,15 +1617,14 @@ free_fontdataOM( FontData font_data, int font_data_count) { + if (!font_data) + return; + for( ; font_data_count-- ; font_data++) { - if(font_data->name){ Xfree(font_data->name); font_data->name = NULL; - } - if(font_data->scopes){ Xfree(font_data->scopes); font_data->scopes = NULL; - } } } @@ -1639,51 +1638,41 @@ close_om( if ((data = gen->data)) { for (count = gen->data_num; count-- > 0; data++) { - if (data->charset_list){ Xfree(data->charset_list); data->charset_list = NULL; - } + /* free font_data for om */ - if (data->font_data) { free_fontdataOM(data->font_data,data->font_data_count); Xfree(data->font_data); data->font_data = NULL; - } + /* free substitute for om */ - if (data->substitute) { free_fontdataOM(data->substitute,data->substitute_num); Xfree(data->substitute); data->substitute = NULL; - } + /* free vmap for om */ - if (data->vmap) { free_fontdataOM(data->vmap,data->vmap_num); Xfree(data->vmap); data->vmap = NULL; - } + /* free vrotate for om */ - if (data->vrotate) { Xfree(data->vrotate); data->vrotate = NULL; - } } Xfree(gen->data); gen->data = NULL; } - if (gen->object_name){ Xfree(gen->object_name); gen->object_name = NULL; - } - if (om->core.res_name){ Xfree(om->core.res_name); om->core.res_name = NULL; - } - if (om->core.res_class){ + Xfree(om->core.res_class); om->core.res_class = NULL; - } + if (om->core.required_charset.charset_list && om->core.required_charset.charset_count > 0){ XFreeStringList(om->core.required_charset.charset_list); @@ -1692,10 +1681,9 @@ close_om( Xfree((char*)om->core.required_charset.charset_list); om->core.required_charset.charset_list = NULL; } - if (om->core.orientation_list.orientation){ + Xfree(om->core.orientation_list.orientation); om->core.orientation_list.orientation = NULL; - } Xfree(om); -- cgit v1.2.3