-#include "gdk.h"
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gdkkeys.h"
+#include "gdktypes.h"
+
/* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode
* mapping functions, from the xterm sources.
* is smallish. It would save about ~1000 bytes total.
*/
-static struct {
+static const struct {
unsigned short keysym;
unsigned short ucs;
} gdk_keysym_to_unicode_tab[] = {
{ 0x06aa, 0x045a }, /* Cyrillic_nje њ CYRILLIC SMALL LETTER NJE */
{ 0x06ab, 0x045b }, /* Serbian_tshe ћ CYRILLIC SMALL LETTER TSHE */
{ 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */
+ { 0x06ad, 0x0491 }, /* Ukrainian_ghe_with_upturn ґ CYRILLIC SMALL LETTER GHE WITH UPTURN */
{ 0x06ae, 0x045e }, /* Byelorussian_shortu ў CYRILLIC SMALL LETTER SHORT U */
{ 0x06af, 0x045f }, /* Cyrillic_dzhe џ CYRILLIC SMALL LETTER DZHE */
{ 0x06b0, 0x2116 }, /* numerosign № NUMERO SIGN */
{ 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */
{ 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */
{ 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */
+ { 0x06bd, 0x0490 }, /* Ukrainian_GHE_WITH_UPTURN Ґ CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
{ 0x06be, 0x040e }, /* Byelorussian_SHORTU Ў CYRILLIC CAPITAL LETTER SHORT U */
{ 0x06bf, 0x040f }, /* Cyrillic_DZHE Џ CYRILLIC CAPITAL LETTER DZHE */
{ 0x06c0, 0x044e }, /* Cyrillic_yu ю CYRILLIC SMALL LETTER YU */
{ 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */
{ 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */
{ 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */
- { 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
+ { 0x07a5, 0x03aa }, /* Greek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
{ 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */
{ 0x07a8, 0x038e }, /* Greek_UPSILONaccent Ύ GREEK CAPITAL LETTER UPSILON WITH TONOS */
{ 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
{ 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */
{ 0x20ab, 0x20ab }, /* DongSign ₫ DONG SIGN */
{ 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */
+
+
+ /* Following items added to GTK, not in the xterm table */
+
+ /* A few ASCII control characters */
+#ifndef GDK_WINDOWING_WIN32
+ { 0xFF08 /* Backspace */, '\b' },
+ { 0xFF09 /* Tab */, '\t' },
+#endif
+
+ { 0xFF0A /* Linefeed */, '\n' },
+ { 0xFF0B /* Vert. Tab */, '\v' },
+
+#ifndef GDK_WINDOWING_WIN32
+ { 0xFF0D /* Return */, '\r' },
+ { 0xFF1B /* Escape */, '\033' },
+#endif
+
+ /* Numeric keypad */
+
+ { 0xFF80 /* Space */, ' ' },
+ { 0xFFAA /* Multiply */, '*' },
+ { 0xFFAB /* Add */, '+' },
+ { 0xFFAC /* Separator */, ',' },
+ { 0xFFAD /* Subtract */, '-' },
+ { 0xFFAE /* Decimal */, '.' },
+ { 0xFFAF /* Divide */, '/' },
+ { 0xFFB0 /* 0 */, '0' },
+ { 0xFFB1 /* 1 */, '1' },
+ { 0xFFB2 /* 2 */, '2' },
+ { 0xFFB3 /* 3 */, '3' },
+ { 0xFFB4 /* 4 */, '4' },
+ { 0xFFB5 /* 5 */, '5' },
+ { 0xFFB6 /* 6 */, '6' },
+ { 0xFFB7 /* 7 */, '7' },
+ { 0xFFB8 /* 8 */, '8' },
+ { 0xFFB9 /* 9 */, '9' },
+ { 0xFFBD /* Equal */, '=' },
+
+ /* End numeric keypad */
+
+#ifndef GDK_WINDOWING_WIN32
+ { 0xFFFF /* Delete */, '\177' }
+#endif
};
/**
* gdk_keyval_to_unicode:
- * @keysym: a GDK key symbol
+ * @keyval: a GDK key symbol
*
* Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
* character.
* is no corresponding character.
**/
guint32
-gdk_keyval_to_unicode (guint keysym)
+gdk_keyval_to_unicode (guint keyval)
{
int min = 0;
int max = G_N_ELEMENTS (gdk_keysym_to_unicode_tab) - 1;
int mid;
/* First check for Latin-1 characters (1:1 mapping) */
- if ((keysym >= 0x0020 && keysym <= 0x007e) ||
- (keysym >= 0x00a0 && keysym <= 0x00ff))
- return keysym;
+ if ((keyval >= 0x0020 && keyval <= 0x007e) ||
+ (keyval >= 0x00a0 && keyval <= 0x00ff))
+ return keyval;
/* Also check for directly encoded 24-bit UCS characters:
*/
- if ((keysym & 0xff000000) == 0x01000000)
- return keysym & 0x00ffffff;
+ if ((keyval & 0xff000000) == 0x01000000)
+ return keyval & 0x00ffffff;
/* binary search in table */
while (max >= min) {
mid = (min + max) / 2;
- if (gdk_keysym_to_unicode_tab[mid].keysym < keysym)
+ if (gdk_keysym_to_unicode_tab[mid].keysym < keyval)
min = mid + 1;
- else if (gdk_keysym_to_unicode_tab[mid].keysym > keysym)
+ else if (gdk_keysym_to_unicode_tab[mid].keysym > keyval)
max = mid - 1;
else {
/* found it */
return 0;
}
-static struct {
+static const struct {
unsigned short keysym;
unsigned short ucs;
} gdk_unicode_to_keysym_tab[] = {
{ 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */
{ 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */
{ 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */
- { 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
+ { 0x07a5, 0x03aa }, /* Greek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
{ 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
{ 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */
{ 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */