[PATCH libX11] Remove dead USE_OWN_COMPOSE-protected code

Ran Benita ran234 at gmail.com
Tue Feb 11 03:26:16 PST 2014


The build doesn't provide any way to define this option. It also refers
to files (imComp.h) and functions (e.g. XimCompInitTables(),
XimCompProcessSym()) which are not found anywhere, and the ordinary
Compose implementation in xim doesn't use any of it.

Signed-off-by: Ran Benita <ran234 at gmail.com>
---

Some archeology uncovers this was some proprietary SGI thing:

http://cgit.freedesktop.org/~alanc/xc-historical/commit/xc/lib?id=5e0c3fb8ff8178c644b9b4ef5fc566683ab85b65
http://cgit.freedesktop.org/~libv/xfree86/commit/?id=f672e940f91aaaea21feb4395fcb4f7bd701a9a9
http://cgit.freedesktop.org/~libv/xfree86/commit/?id=452696362c65cbc2e1a28ebaf4cc3cda51768cdb
http://people.kth.se/~e96_coj/oopk_home/Compose.h

Anyway it's definitely not needed anymore (if it ever was).

 src/KeyBind.c     |  72 --------------------------------------
 src/xkb/XKBBind.c | 102 ------------------------------------------------------
 2 files changed, 174 deletions(-)

diff --git a/src/KeyBind.c b/src/KeyBind.c
index a49de3d..f64f116 100644
--- a/src/KeyBind.c
+++ b/src/KeyBind.c
@@ -48,11 +48,6 @@ in this Software without prior written authorization from The Open Group.
 #include <X11/keysymdef.h>
 #include <stdio.h>
 
-#ifdef USE_OWN_COMPOSE
-#include "imComp.h"
-
-#endif
-
 #include "Xresource.h"
 #include "Key.h"
 
@@ -891,73 +886,6 @@ XLookupString (
 		  &modifiers, &symbol))
 	return 0;
 
-#ifdef USE_OWN_COMPOSE
-    if ( status ) {
-	static int been_here= 0;
-	if ( !been_here ) {
-	    XimCompInitTables();
-	    been_here = 1;
-	}
-	if ( !XimCompLegalStatus(status) ) {
-	    status->compose_ptr = NULL;
-	    status->chars_matched = 0;
-	}
-	if ( ((status->chars_matched>0)&&(status->compose_ptr!=NULL)) ||
-		XimCompIsComposeKey(symbol,event->keycode,status) ) {
-	    XimCompRtrn rtrn;
-	    switch (XimCompProcessSym(status,symbol,&rtrn)) {
-		case XIM_COMP_IGNORE:
-		    break;
-		case XIM_COMP_IN_PROGRESS:
-		    if ( keysym!=NULL )
-			*keysym = NoSymbol;
-		    return 0;
-		case XIM_COMP_FAIL:
-		{
-		    int n = 0, len= 0;
-		    for (n=len=0;rtrn.sym[n]!=XK_VoidSymbol;n++) {
-			if ( nbytes-len > 0 ) {
-			    len+= _XTranslateKeySym(event->display,rtrn.sym[n],
-							event->state,
-							buffer+len,nbytes-len);
-			}
-		    }
-		    if ( keysym!=NULL ) {
-			if ( n==1 )	*keysym = rtrn.sym[0];
-			else		*keysym = NoSymbol;
-		    }
-		    return len;
-		}
-		case XIM_COMP_SUCCEED:
-		{
-		    int len,n = 0;
-
-		    symbol = rtrn.matchSym;
-		    if ( keysym!=NULL )	*keysym = symbol;
-		    if ( rtrn.str[0]!='\0' ) {
-			strncpy(buffer,rtrn.str,nbytes-1);
-			buffer[nbytes-1]= '\0';
-			len = strlen(buffer);
-		    }
-		    else {
-			len = _XTranslateKeySym(event->display,symbol,
-							event->state,
-							buffer,nbytes);
-		    }
-		    for (n=0;rtrn.sym[n]!=XK_VoidSymbol;n++) {
-			if ( nbytes-len > 0 ) {
-			    len+= _XTranslateKeySym(event->display,rtrn.sym[n],
-							event->state,
-							buffer+len,nbytes-len);
-			}
-		    }
-		    return len;
-		}
-	    }
-	}
-    }
-#endif
-
     if (keysym)
 	*keysym = symbol;
     /* arguable whether to use (event->state & ~modifiers) here */
diff --git a/src/xkb/XKBBind.c b/src/xkb/XKBBind.c
index 29870b5..24d37e3 100644
--- a/src/xkb/XKBBind.c
+++ b/src/xkb/XKBBind.c
@@ -41,11 +41,6 @@ from The Open Group.
 #include <X11/extensions/XKBproto.h>
 #include "XKBlibint.h"
 
-#ifdef USE_OWN_COMPOSE
-#define COMPOSE_NO_CONST_MEMBERS
-#include "imComp.h"
-#endif
-
 #define AllMods (ShiftMask|LockMask|ControlMask| \
                  Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)
 
@@ -725,103 +720,6 @@ XLookupString(register XKeyEvent *event,
         }
     }
 
-#ifdef USE_OWN_COMPOSE
-    if (status) {
-        static int been_here = 0;
-
-        if (!been_here) {
-            XimCompInitTables();
-            been_here = 1;
-        }
-        if (!XimCompLegalStatus(status)) {
-            status->compose_ptr = NULL;
-            status->chars_matched = 0;
-        }
-        if (((status->chars_matched > 0) && (status->compose_ptr != NULL)) ||
-            XimCompIsComposeKey(*keysym, event->keycode, status)) {
-            XimCompRtrn rtrn;
-
-            switch (XimCompProcessSym(status, *keysym, &rtrn)) {
-            case XIM_COMP_IGNORE:
-                break;
-            case XIM_COMP_IN_PROGRESS:
-                if (keysym != NULL)
-                    *keysym = NoSymbol;
-#ifndef NO_COMPOSE_LED
-                if (dpy->xkb_info->xlib_ctrls & XkbLC_ComposeLED) {
-                    XkbSetNamedIndicator(dpy, dpy->xkb_info->composeLED,
-                                         True, True, False, NULL);
-                }
-#endif
-                return 0;
-            case XIM_COMP_FAIL:
-            {
-                static Atom _ComposeFail = None;
-                int n = 0, len = 0;
-
-#ifndef NO_COMPOSE_LED
-                if (dpy->xkb_info->xlib_ctrls & XkbLC_ComposeLED) {
-                    XkbSetNamedIndicator(dpy, dpy->xkb_info->composeLED,
-                                         True, False, False, NULL);
-                }
-#endif
-#ifndef NO_BELL_ON_COMPOSE_FAIL
-                if (dpy->xkb_info->xlib_ctrls & XkbLC_BeepOnComposeFail) {
-                    if (_ComposeFail == None)
-                        _ComposeFail = XInternAtom(dpy, "ComposeFail", 0);
-                    XkbBell(dpy, event->window, 0, _ComposeFail);
-                }
-#endif
-                for (n = len = 0; rtrn.sym[n] != XK_VoidSymbol; n++) {
-                    if (nbytes - len > 0) {
-                        len += XkbTranslateKeySym(dpy, &rtrn.sym[n], new_mods,
-                                                  buffer + len, nbytes - len,
-                                                  NULL);
-                    }
-                }
-                if (keysym != NULL) {
-                    if (n == 1)
-                        *keysym = rtrn.sym[0];
-                    else
-                        *keysym = NoSymbol;
-                }
-                return len;
-            }
-            case XIM_COMP_SUCCEED:
-            {
-                int len, n = 0;
-
-#ifndef NO_COMPOSE_LED
-                if (dpy->xkb_info->xlib_ctrls & XkbLC_ComposeLED) {
-                    XkbSetNamedIndicator(dpy, dpy->xkb_info->composeLED,
-                                         True, False, False, NULL);
-                }
-#endif
-                *keysym = rtrn.matchSym;
-                if (rtrn.str[0] != '\0') {
-                    strncpy(buffer, rtrn.str, nbytes - 1);
-                    buffer[nbytes - 1] = '\0';
-                    len = (int) strlen(buffer);
-                }
-                else {
-                    len = XkbTranslateKeySym(dpy, keysym, new_mods,
-                                             buffer, nbytes, NULL);
-                }
-                for (n = 0; rtrn.sym[n] != XK_VoidSymbol; n++) {
-                    if (nbytes - len > 0) {
-                        len += XkbTranslateKeySym(dpy, &rtrn.sym[n],
-                                                  event->state,
-                                                  buffer + len, nbytes - len,
-                                                  NULL);
-                    }
-                }
-                return len;
-            }
-            }
-        }
-    }
-#endif
-
     /* We *should* use the new_mods (which does not contain any modifiers */
     /* that were used to compute the symbol here, but pre-XKB XLookupString */
     /* did not and we have to remain compatible.  Sigh. */
-- 
1.8.5.4



More information about the xorg-devel mailing list