341N/A###############################################################################
1619N/A# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
341N/A#
341N/A# Permission is hereby granted, free of charge, to any person obtaining a
919N/A# copy of this software and associated documentation files (the "Software"),
919N/A# to deal in the Software without restriction, including without limitation
919N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A# and/or sell copies of the Software, and to permit persons to whom the
919N/A# Software is furnished to do so, subject to the following conditions:
919N/A#
919N/A# The above copyright notice and this permission notice (including the next
919N/A# paragraph) shall be included in all copies or substantial portions of the
919N/A# Software.
919N/A#
919N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A# DEALINGS IN THE SOFTWARE.
341N/A#
341N/A
1619N/Adiff --git a/src/KeyBind.c b/src/KeyBind.c
1619N/Aindex d7c78b3..3457759 100644
1619N/A--- a/src/KeyBind.c
1619N/A+++ b/src/KeyBind.c
1619N/A@@ -840,6 +840,17 @@ _XTranslateKeySym(
341N/A hiBytes = symbol >> 8;
341N/A if (!(nbytes &&
341N/A ((hiBytes == 0) ||
341N/A+#ifdef SUNSOFT_KBD
341N/A+/*
341N/A+ * The following hard-coded line is to support the euro sign for legacy apps
341N/A+ * and single byte codeset locale apps with the euro sign at 0xa4.
341N/A+ * For any other codeset locales with properly internationalized apps,
341N/A+ * one must have an entry in the Compose file of the locale that will map
341N/A+ * the XK_EuroSign keysym to the correct character code value of the locale's
341N/A+ * codeset.
341N/A+ */
341N/A+ (symbol == XK_EuroSign) ||
341N/A+#endif /* SUNSOFT_KBD */
341N/A ((hiBytes == 0xFF) &&
341N/A (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) ||
341N/A (symbol == XK_Return) ||
1619N/A@@ -857,10 +868,20 @@ _XTranslateKeySym(
341N/A c = XK_space & 0x7F; /* patch encoding botch */
341N/A else if (hiBytes == 0xFF)
341N/A c = symbol & 0x7F;
341N/A+#ifdef SUNSOFT_KBD
341N/A+ else if (symbol == XK_EuroSign)
1549N/A+ c = (unsigned char)0xa4; /* Latin-9 euro symbol code for legacy apps. */
341N/A+#endif /* SUNSOFT_KBD */
341N/A else
341N/A c = symbol & 0xFF;
341N/A /* only apply Control key if it makes sense, else ignore it */
341N/A if (modifiers & ControlMask) {
341N/A+#ifdef SUNSOFT_KBD
341N/A+ /* Sun: map control characters with high bit set */
341N/A+ if ((c >= (unsigned char)'\300' && c <= (unsigned char)'\377')) c &= 0x9F;
341N/A+#endif /* SUNSOFT_KBD */
341N/A+
341N/A+ /* MIT "standard" control character handling */
341N/A if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
341N/A else if (c == '2') c = '\000';
341N/A else if (c >= '3' && c <= '7') c -= ('3' - '\033');
1619N/Adiff --git a/src/imConv.c b/src/imConv.c
1619N/Aindex c3c1974..bfb01b2 100644
1619N/A--- a/src/imConv.c
1619N/A+++ b/src/imConv.c
1619N/A@@ -213,7 +213,9 @@ _XimLookupMBText(
1294N/A args, 1 ) != 0) {
1294N/A count = 0;
1294N/A } else {
1294N/A- count = nbytes - to_len;
1408N/A+ if (count != 0){
1294N/A+ count = nbytes - to_len;
1294N/A+ }
1294N/A }
1294N/A }
1294N/A }
1619N/A@@ -283,7 +285,9 @@ _XimLookupWCText(
1294N/A args, 1 ) != 0) {
1294N/A count = 0;
1294N/A } else {
1294N/A- count = nbytes - to_len;
1408N/A+ if (count != 0){
1294N/A+ count = nbytes - to_len;
1294N/A+ }
1294N/A }
1294N/A }
1294N/A } else
1619N/A@@ -344,7 +348,9 @@ _XimLookupUTF8Text(
1294N/A NULL, 0) != 0) {
1294N/A count = 0;
1294N/A } else {
1294N/A- count = nbytes - to_len;
1549N/A+ if (count != 0){
1549N/A+ count = nbytes - to_len;
1549N/A+ }
1294N/A }
1294N/A }
1294N/A /* FIXME: