]> Pileus Git - ~andy/gtk/blobdiff - gdk/gdkkeyuni.c
Use G_DEFINE_TYPE.
[~andy/gtk] / gdk / gdkkeyuni.c
index fed2d41ce2d4eae3df5953647f1eed8986ae61e8..010a2414964b104f714949275db32080aaa39218 100644 (file)
@@ -1,7 +1,32 @@
-#include <locale.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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * 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 "gdk.h"
-#include "gdkkeysyms.h"
+#include "gdkalias.h"
 
 /* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode
  * mapping functions, from the xterm sources.
@@ -11,7 +36,7 @@
  * 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[] = {
@@ -253,6 +278,7 @@ static struct {
   { 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 */
@@ -268,6 +294,7 @@ static struct {
   { 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 */
@@ -338,7 +365,7 @@ static struct {
   { 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 */
@@ -808,6 +835,7 @@ static struct {
   { 0xFF80 /* Space */, ' ' },
   { 0xFFAA /* Multiply */, '*' },
   { 0xFFAB /* Add */, '+' },
+  { 0xFFAC /* Separator */, ',' },
   { 0xFFAD /* Subtract */, '-' },
   { 0xFFAE /* Decimal */, '.' },
   { 0xFFAF /* Divide */, '/' },
@@ -826,25 +854,6 @@ static struct {
   /* End numeric keypad */
 };
 
-static gunichar
-get_decimal_char (void)
-{
-  struct lconv *locale_data;
-  gunichar result = '.';
-  gchar *utf8;
-
-  locale_data = localeconv ();
-  utf8 = g_locale_to_utf8 (locale_data->decimal_point, -1, NULL, NULL, NULL);
-  if (utf8)
-    {
-      if (g_utf8_strlen (utf8, -1) == 1)
-       result = g_utf8_get_char (utf8);
-      g_free (utf8);
-    }
-
-  return result;
-}
-
 /**
  * gdk_keyval_to_unicode:
  * @keyval: a GDK key symbol 
@@ -872,11 +881,6 @@ gdk_keyval_to_unicode (guint keyval)
   if ((keyval & 0xff000000) == 0x01000000)
     return keyval & 0x00ffffff;
 
-  /* Translation of KP_Decimal depends on locale.
-   */
-  if (keyval == GDK_KP_Decimal)
-    return get_decimal_char ();
-
   /* binary search in table */
   while (max >= min) {
     mid = (min + max) / 2;
@@ -894,7 +898,7 @@ gdk_keyval_to_unicode (guint keyval)
   return 0;
 }
 
-static struct {
+static const struct {
   unsigned short keysym;
   unsigned short ucs;
 } gdk_unicode_to_keysym_tab[] = {
@@ -1054,7 +1058,7 @@ static struct {
   { 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 */
@@ -1691,3 +1695,6 @@ gdk_unicode_to_keyval (guint32 wc)
    */
   return wc | 0x01000000;
 }
+
+#define __GDK_KEYUNI_C__
+#include "gdkaliasdef.c"