open-src/lib/libX11/solaris-kbd.patch
changeset 1408 17c15e2662ba
parent 1301 371a43cad701
child 1515 e2b80dc10eaa
equal deleted inserted replaced
1407:72726c775cc9 1408:17c15e2662ba
     1 ###############################################################################
     1 ###############################################################################
     2 # Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
     3 #
     3 #
     4 # Permission is hereby granted, free of charge, to any person obtaining a
     4 # Permission is hereby granted, free of charge, to any person obtaining a
     5 # copy of this software and associated documentation files (the "Software"),
     5 # copy of this software and associated documentation files (the "Software"),
     6 # to deal in the Software without restriction, including without limitation
     6 # to deal in the Software without restriction, including without limitation
     7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
     7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
    21 # DEALINGS IN THE SOFTWARE.
    21 # DEALINGS IN THE SOFTWARE.
    22 #
    22 #
    23 
    23 
    24 
    24 
    25 diff --git a/src/KeyBind.c b/src/KeyBind.c
    25 diff --git a/src/KeyBind.c b/src/KeyBind.c
    26 index 221cedd..732c0cf 100644
    26 index a49de3d..86bd3b6 100644
    27 --- a/src/KeyBind.c
    27 --- a/src/KeyBind.c
    28 +++ b/src/KeyBind.c
    28 +++ b/src/KeyBind.c
    29 @@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
    29 @@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
    30  #define XK_VIETNAMESE
    30  #define XK_VIETNAMESE
    31  #define XK_XKB_KEYS
    31  #define XK_XKB_KEYS
   278  			     buffer, nbytes);
   278  			     buffer, nbytes);
   279 +#endif /* SUNSOFT_KBD */
   279 +#endif /* SUNSOFT_KBD */
   280  }
   280  }
   281  
   281  
   282  static void
   282  static void
   283 @@ -1076,3 +1214,290 @@ ComputeMaskFromKeytrans(
   283 @@ -1074,3 +1212,290 @@ ComputeMaskFromKeytrans(
   284      }
   284      }
   285      p->state &= AllMods;
   285      p->state &= AllMods;
   286  }
   286  }
   287 +
   287 +
   288 +#ifdef SUNSOFT_KBD
   288 +#ifdef SUNSOFT_KBD
   536 + * DoCompose - put result in keysym
   536 + * DoCompose - put result in keysym
   537 + */
   537 + */
   538 +static int
   538 +static int
   539 +DoCompose(KeySym first_keysym, KeySym second_keysym, KeySym *result_keysym)
   539 +DoCompose(KeySym first_keysym, KeySym second_keysym, KeySym *result_keysym)
   540 +{
   540 +{
   541 +    ComposeTableEntry *ptr;
   541 +    const ComposeTableEntry *ptr;
   542 +
   542 +
   543 +        /* Note:  this code presumes first_keysym rangecheck has
   543 +        /* Note:  this code presumes first_keysym rangecheck has
   544 +         * been done in invoking routine.
   544 +         * been done in invoking routine.
   545 +         */
   545 +         */
   546 +    ptr = &compose_table[compose_map[first_keysym]];
   546 +    ptr = &compose_table[compose_map[first_keysym]];
   570 +	XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control);
   570 +	XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control);
   571 +    }
   571 +    }
   572 +}
   572 +}
   573 +#endif /* SUNSOFT_KBD */
   573 +#endif /* SUNSOFT_KBD */
   574 diff --git a/src/imConv.c b/src/imConv.c
   574 diff --git a/src/imConv.c b/src/imConv.c
   575 index c3c1974..40f5328 100644
   575 index c3c1974..ec8493f 100644
   576 --- a/src/imConv.c
   576 --- a/src/imConv.c
   577 +++ b/src/imConv.c
   577 +++ b/src/imConv.c
   578 @@ -213,7 +213,9 @@ _XimLookupMBText(
   578 @@ -213,7 +213,9 @@ _XimLookupMBText(
   579  			    args, 1 ) != 0) {
   579  			    args, 1 ) != 0) {
   580  		count = 0;
   580  		count = 0;
   581  	    } else {
   581  	    } else {
   582 -                count = nbytes - to_len;
   582 -                count = nbytes - to_len;
   583 +                if(count != 0){
   583 +                if (count != 0){
   584 +                    count = nbytes - to_len;
   584 +                    count = nbytes - to_len;
   585 +                }
   585 +                }
   586  	    }
   586  	    }
   587  	}
   587  	}
   588      }
   588      }
   589 @@ -283,7 +285,9 @@ _XimLookupWCText(
   589 @@ -283,7 +285,9 @@ _XimLookupWCText(
   590  			    args, 1 ) != 0) {
   590  			    args, 1 ) != 0) {
   591  		count = 0;
   591  		count = 0;
   592  	    } else {
   592  	    } else {
   593 -                count = nbytes - to_len;
   593 -                count = nbytes - to_len;
   594 +                if(count != 0){
   594 +                if (count != 0){
   595 +                    count = nbytes - to_len;
   595 +                    count = nbytes - to_len;
   596 +                }
   596 +                }
   597  	    }
   597  	    }
   598  	}
   598  	}
   599      } else
   599      } else
   600 @@ -344,7 +348,9 @@ _XimLookupUTF8Text(
   600 @@ -344,7 +348,9 @@ _XimLookupUTF8Text(
   601                          NULL, 0) != 0) {
   601                          NULL, 0) != 0) {
   602  	    count = 0;
   602  	    count = 0;
   603  	} else {
   603  	} else {
   604 -            count = nbytes - to_len;
   604 -            count = nbytes - to_len;
   605 +            if(count != 0){
   605 +            if (count != 0){
   606 +                count = nbytes - to_len;
   606 +                count = nbytes - to_len;
   607 +            }
   607 +            }
   608  	}
   608  	}
   609      }
   609      }
   610      /* FIXME:
   610      /* FIXME:
   611 diff --git a/src/xkb/XKBBind.c b/src/xkb/XKBBind.c
   611 diff --git a/src/xkb/XKBBind.c b/src/xkb/XKBBind.c
   612 index 1c16adc..3370896 100644
   612 index 29870b5..9e95c02 100644
   613 --- a/src/xkb/XKBBind.c
   613 --- a/src/xkb/XKBBind.c
   614 +++ b/src/xkb/XKBBind.c
   614 +++ b/src/xkb/XKBBind.c
   615 @@ -53,6 +53,12 @@ static int _XkbLoadDpy(
   615 @@ -51,6 +51,12 @@ from The Open Group.
   616      Display *dpy
   616  
   617  );
   617  static int _XkbLoadDpy(Display *dpy);
   618  
   618  
   619 +static int XkbTranslateKeySymExt(
   619 +static int XkbTranslateKeySymExt(
   620 +    register Display * dpy, register KeySym *sym_rtrn, unsigned int mods,
   620 +    register Display * dpy, register KeySym *sym_rtrn, unsigned int mods,
   621 +    char *buffer, int nbytes, int *extra_rtrn, XKeyEvent *event,
   621 +    char *buffer, int nbytes, int *extra_rtrn, XKeyEvent *event,
   622 +    XComposeStatus *status
   622 +    XComposeStatus *status
   623 +);
   623 +);
   624 +
   624 +
   625  struct _XKeytrans {
   625  struct _XKeytrans {
   626  	struct _XKeytrans *next;/* next on list */
   626      struct _XKeytrans *next;    /* next on list */
   627  	char *string;		/* string to return when the time comes */
   627      char *string;               /* string to return when the time comes */
   628 @@ -577,6 +583,20 @@ XkbTranslateKeySym(	register Display *	dpy,
   628 @@ -599,6 +605,20 @@ XkbTranslateKeySym(register Display *dpy,
   629  			int 			nbytes,
   629                     int nbytes,
   630  			int *			extra_rtrn)
   630                     int *extra_rtrn)
   631  {
   631  {
   632 +	/* Call the new extended function but put in NULL for the extra params */
   632 +       /* Call the new extended function but put in NULL for the extra params */
   633 +	return XkbTranslateKeySymExt(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn, NULL, NULL);
   633 +       return XkbTranslateKeySymExt(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn, NULL, NULL);
   634 +}
   634 +}
   635 +
   635 +
   636 +static int
   636 +static int
   637 +XkbTranslateKeySymExt(	register Display *	dpy,
   637 +XkbTranslateKeySymExt(register Display *dpy,
   638 +			register KeySym *	sym_rtrn,
   638 +                      register KeySym *sym_rtrn,
   639 +			unsigned int 		mods,
   639 +                      unsigned int mods,
   640 +			char *			buffer,
   640 +                      char *buffer,
   641 +			int 			nbytes,
   641 +                      int nbytes,
   642 +			int *			extra_rtrn,
   642 +                      int *extra_rtrn,
   643 +			XKeyEvent *		event,
   643 +                      XKeyEvent *event,
   644 +			XComposeStatus *	status)
   644 +                      XComposeStatus *status)
   645 +{
   645 +{
   646      register XkbInfoPtr	xkb;
   646      register XkbInfoPtr xkb;
   647      XkbKSToMBFunc cvtr;
   647      XkbKSToMBFunc cvtr;
   648      XPointer priv;
   648      XPointer priv;
   649 @@ -618,6 +638,17 @@ XkbTranslateKeySym(	register Display *	dpy,
   649 @@ -641,6 +661,17 @@ XkbTranslateKeySym(register Display *dpy,
   650  
   650  
   651      n = (*cvtr)(priv,*sym_rtrn,buffer,nbytes,extra_rtrn);
   651      n = (*cvtr) (priv, *sym_rtrn, buffer, nbytes, extra_rtrn);
   652  
   652  
   653 +    /* Add Suns specific compose key handler here. Be sure the special
   653 +    /* Add Suns specific compose key handler here. Be sure the special
   654 +     * globals are set before calling this function.
   654 +     * globals are set before calling this function.
   655 +     */
   655 +     */
   656 +    {
   656 +    {
   657 +	int return_val;
   657 +       int return_val;
   658 +
   658 +
   659 +	if (event && HandleComposeSequence(*sym_rtrn, buffer, sym_rtrn,
   659 +       if (event && HandleComposeSequence(*sym_rtrn, buffer, sym_rtrn,
   660 +					  status, &return_val, event))
   660 +                                         status, &return_val, event))
   661 +	    return return_val;
   661 +           return return_val;
   662 +    }
   662 +    }
   663 +
   663 +
   664      if ((!xkb->cvt.KSToUpper)&&( mods&LockMask )) {
   664      if ((!xkb->cvt.KSToUpper) && (mods & LockMask)) {
   665  	register int i;
   665          register int i;
   666  	int change;
   666          int change;
   667 @@ -744,9 +775,9 @@ XLookupString (	register XKeyEvent *	event,
   667 @@ -774,9 +805,9 @@ XLookupString(register XKeyEvent *event,
   668  #endif
   668  #endif
   669  		    for (n=len=0;rtrn.sym[n]!=XK_VoidSymbol;n++) {
   669                  for (n = len = 0; rtrn.sym[n] != XK_VoidSymbol; n++) {
   670  			if ( nbytes-len > 0 ) {
   670                      if (nbytes - len > 0) {
   671 -			    len+= XkbTranslateKeySym(dpy,&rtrn.sym[n],new_mods,
   671 -                        len += XkbTranslateKeySym(dpy, &rtrn.sym[n], new_mods,
   672 +			    len+= XkbTranslateKeySymExt(dpy,&rtrn.sym[n],new_mods,
   672 +                        len += XkbTranslateKeySymExt(dpy, &rtrn.sym[n], new_mods,
   673  							buffer+len,nbytes-len,
   673                                                    buffer + len, nbytes - len,
   674 -							NULL);
   674 -                                                  NULL);
   675 +							NULL, event, status);
   675 +                                                  NULL, event, status);
   676  			}
   676                      }
   677  		    }
   677                  }
   678  		    if ( keysym!=NULL ) {
   678                  if (keysym != NULL) {
   679 @@ -772,16 +803,16 @@ XLookupString (	register XKeyEvent *	event,
   679 @@ -804,15 +835,16 @@ XLookupString(register XKeyEvent *event,
   680  			len = (int)strlen(buffer);
   680                      len = (int) strlen(buffer);
   681  		    }
   681                  }
   682  		    else {
   682                  else {
   683 -			len = XkbTranslateKeySym(dpy,keysym,new_mods,
   683 -                    len = XkbTranslateKeySym(dpy, keysym, new_mods,
   684 +			len = XkbTranslateKeySymExt(dpy,keysym,new_mods,
   684 -                                             buffer, nbytes, NULL);
   685  							buffer,nbytes,
   685 +                    len = XkbTranslateKeySymExt(dpy, keysym, new_mods,
   686 -							NULL);
   686 +                                                buffer, nbytes, NULL,
   687 +							NULL, event, status);
   687 +                                                event, status);
   688  		    }
   688                  }
   689  		    for (n=0;rtrn.sym[n]!=XK_VoidSymbol;n++) {
   689                  for (n = 0; rtrn.sym[n] != XK_VoidSymbol; n++) {
   690  			if ( nbytes-len > 0 ) {
   690                      if (nbytes - len > 0) {
   691 -			    len+= XkbTranslateKeySym(dpy,&rtrn.sym[n],
   691 -                        len += XkbTranslateKeySym(dpy, &rtrn.sym[n],
   692 +			    len+= XkbTranslateKeySymExt(dpy,&rtrn.sym[n],
   692 +                        len += XkbTranslateKeySymExt(dpy, &rtrn.sym[n],
   693  							event->state,
   693                                                    event->state,
   694  							buffer+len,nbytes-len,
   694                                                    buffer + len, nbytes - len,
   695 -							NULL);
   695 -                                                  NULL);
   696 +							NULL, event, status);
   696 +                                                  NULL, event, status);
   697  			}
   697                      }
   698  		    }
   698                  }
   699  		    return len;
   699                  return len;
   700 @@ -802,7 +833,8 @@ XLookupString (	register XKeyEvent *	event,
   700 @@ -833,7 +865,8 @@ XLookupString(register XKeyEvent *event,
   701      if (rtrnLen>0)
   701      if (rtrnLen > 0)
   702  	return rtrnLen;
   702          return rtrnLen;
   703  
   703  
   704 -    return XkbTranslateKeySym(dpy,keysym,new_mods,buffer,nbytes,NULL);
   704 -    return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL);
   705 +    return XkbTranslateKeySymExt(dpy,keysym,new_mods,buffer,nbytes,NULL,
   705 +    return XkbTranslateKeySymExt(dpy ,keysym, new_mods, buffer, nbytes, NULL,
   706 +				 event,status);
   706 +                                 event, status);
   707  }
   707  }
   708  
   708  
   709  
   709  
   710 diff --git a/src/xkb/XKBlibint.h b/src/xkb/XKBlibint.h
   710 diff --git a/src/xkb/XKBlibint.h b/src/xkb/XKBlibint.h
   711 index ce14527..9945321 100644
   711 index ca7dc0b..70e2475 100644
   712 --- a/src/xkb/XKBlibint.h
   712 --- a/src/xkb/XKBlibint.h
   713 +++ b/src/xkb/XKBlibint.h
   713 +++ b/src/xkb/XKBlibint.h
   714 @@ -175,10 +175,19 @@ extern int _XTranslateKey(
   714 @@ -169,10 +169,19 @@ extern int _XTranslateKey(
   715  
   715  
   716  extern int	_XTranslateKeySym(
   716  extern int      _XTranslateKeySym(
   717      Display *		/* dpy */,
   717      Display *           /* dpy */,
   718 +#ifdef SUNSOFT_KBD
   718 +#ifdef SUNSOFT_KBD
   719 +    register KeySym *	/* symbol */,
   719 +    register KeySym *   /* symbol */,
   720 +#else
   720 +#else
   721      register KeySym 	/* symbol */,
   721      register KeySym     /* symbol */,
   722 +#endif
   722 +#endif
   723      unsigned int 	/* modifiers */,
   723      unsigned int        /* modifiers */,
   724      char *		/* buffer */,
   724      char *              /* buffer */,
   725      int 		/* nbytes */
   725      int                 /* nbytes */
   726 +#ifdef SUNSOFT_KBD
   726 +#ifdef SUNSOFT_KBD
   727 +	,
   727 +       ,
   728 +     XKeyEvent *	/* event */,
   728 +    XKeyEvent *         /* event */,
   729 +     XComposeStatus *	/* status */
   729 +    XComposeStatus *    /* status */
   730 +#endif
   730 +#endif
   731  );
   731  );
   732  
   732  
   733  extern	int _XLookupString(
   733  extern  int _XLookupString(
   734 @@ -338,6 +347,17 @@ extern	Status	_XkbReadGetGeometryReply(
   734 @@ -332,6 +341,17 @@ extern  Status  _XkbReadGetGeometryReply(
   735  
   735  
   736  #endif
   736  #endif
   737  
   737  
   738 +#ifdef SUNSOFT_KBD
   738 +#ifdef SUNSOFT_KBD
   739 +extern int HandleComposeSequence(
   739 +extern int HandleComposeSequence(
   740 +	KeySym		 symbol,
   740 +       KeySym           symbol,
   741 +	char		*buffer,
   741 +       char            *buffer,
   742 +	KeySym		*keysym,
   742 +       KeySym          *keysym,
   743 +	XComposeStatus	*status,
   743 +       XComposeStatus  *status,
   744 +	int		*return_val,
   744 +       int             *return_val,
   745 +	XKeyEvent	*event);
   745 +       XKeyEvent       *event);
   746 +#endif /* SUNSOFT_KBD */
   746 +#endif /* SUNSOFT_KBD */
   747 +
   747 +
   748 +
   748 +
   749  _XFUNCPROTOEND
   749  _XFUNCPROTOEND
   750  
   750  
   751  #endif /* _XKBLIBINT_H_ */
   751  #endif /* _XKBLIBINT_H_ */
   752 diff --git a/src/xlibi18n/ICWrap.c b/src/xlibi18n/ICWrap.c
   752 diff --git a/src/xlibi18n/ICWrap.c b/src/xlibi18n/ICWrap.c
   753 index 1eacfa5..72f6b9d 100644
   753 index 2a1d0d6..8b445ef 100644
   754 --- a/src/xlibi18n/ICWrap.c
   754 --- a/src/xlibi18n/ICWrap.c
   755 +++ b/src/xlibi18n/ICWrap.c
   755 +++ b/src/xlibi18n/ICWrap.c
   756 @@ -67,6 +67,12 @@ from The Open Group.
   756 @@ -67,6 +67,12 @@ from The Open Group.
   757  #include "Xlibint.h"
   757  #include "Xlibint.h"
   758  #include "Xlcint.h"
   758  #include "Xlcint.h"