diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-04-22 15:09:06 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-04-22 15:09:06 +0200 |
commit | 83380a7805f69b18f432895fc17c53cf0354bf4d (patch) | |
tree | b38d271cb6a768b6c2f9d3bee37d0d88e0472cb4 /vcl/unx/generic/app/keysymnames.cxx | |
parent | d5bbd70673a2d5c6f8937428b97111e9c13fd21f (diff) | |
parent | 9e84958536c737f8fdcff4d28664d0c13b9cdc8c (diff) |
Merge commit 'ooo/DEV300_m106' into libreoffice-3-4
Conflicts:
cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
l10ntools/scripts/localize.pl
l10ntools/source/directory.cxx
l10ntools/source/srciter.cxx
padmin/Executable_spadmin.bin.mk
padmin/Library_spa.mk
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/grfmgr.hxx
svtools/source/filter/filter.cxx
svtools/source/filter/filter2.cxx
svtools/source/filter/wmf/emfwr.cxx
svtools/source/filter/wmf/enhwmf.cxx
svtools/source/filter/wmf/winmtf.cxx
svtools/source/filter/wmf/winmtf.hxx
svtools/source/filter/wmf/winwmf.cxx
svtools/source/filter/wmf/wmfwr.cxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/grfmgr2.cxx
toolkit/source/controls/controlmodelcontainerbase.cxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/helper/formpdfexport.cxx
toolkit/source/helper/unowrapper.cxx
vcl/Package_osx.mk
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/app/salsys.cxx
vcl/aqua/source/dtrans/aqua_service.cxx
vcl/aqua/source/dtrans/test_aquacb.cxx
vcl/aqua/source/res/makefile.mk
vcl/aqua/source/window/salframe.cxx
vcl/aqua/source/window/salframeview.mm
vcl/inc/aqua/salgdi.h
vcl/inc/aqua/salinst.h
vcl/inc/graphite_adaptors.hxx
vcl/inc/graphite_cache.hxx
vcl/inc/graphite_serverfont.hxx
vcl/inc/impprn.hxx
vcl/inc/svdata.hxx
vcl/inc/unx/i18n_status.hxx
vcl/inc/unx/saldata.hxx
vcl/inc/unx/salfont.h
vcl/inc/unx/salinst.h
vcl/inc/unx/salprn.h
vcl/inc/unx/salsys.h
vcl/inc/unx/sm.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/graph.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/polyscan.hxx
vcl/inc/vcl/svcompat.hxx
vcl/inc/vcl/svgread.hxx
vcl/inc/vcl/unobrok.hxx
vcl/inc/win/salgdi.h
vcl/inc/win/wincomp.hxx
vcl/prj/d.lst
vcl/source/app/dbggui.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/makefile.mk
vcl/source/app/settings.cxx
vcl/source/app/sound.cxx
vcl/source/app/stdtext.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/timer.cxx
vcl/source/app/unohelp.cxx
vcl/source/components/dtranscomp.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/ctrl.cxx
vcl/source/control/edit.cxx
vcl/source/control/field2.cxx
vcl/source/control/ilstbox.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmapex.cxx
vcl/source/gdi/cvtgrf.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/imagerepository.cxx
vcl/source/gdi/impbmp.cxx
vcl/source/gdi/impgraph.cxx
vcl/source/gdi/impimagetree.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev2.cxx
vcl/source/gdi/outdev5.cxx
vcl/source/gdi/outdev6.cxx
vcl/source/gdi/outmap.cxx
vcl/source/gdi/polyscan.cxx
vcl/source/gdi/print.cxx
vcl/source/gdi/print2.cxx
vcl/source/gdi/region.cxx
vcl/source/gdi/salgdilayout.cxx
vcl/source/gdi/sallayout.cxx
vcl/source/gdi/svcompat.cxx
vcl/source/gdi/virdev.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_vdev.cxx
vcl/source/glyphs/gcach_vdev.hxx
vcl/source/glyphs/graphite_adaptors.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_serverfont.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/glyphs/makefile.mk
vcl/source/src/makefile.mk
vcl/source/window/accel.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dialog.cxx
vcl/source/window/dndevdis.cxx
vcl/source/window/dockmgr.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/floatwin.cxx
vcl/source/window/introwin.cxx
vcl/source/window/keycod.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/scrwnd.cxx
vcl/source/window/split.cxx
vcl/source/window/splitwin.cxx
vcl/source/window/status.cxx
vcl/source/window/syswin.cxx
vcl/source/window/tabpage.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/winproc.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/generic/app/i18n_cb.cxx
vcl/unx/generic/app/i18n_ic.cxx
vcl/unx/generic/app/saldata.cxx
vcl/unx/generic/app/saldisp.cxx
vcl/unx/generic/app/salinst.cxx
vcl/unx/generic/app/wmadaptor.cxx
vcl/unx/generic/fontmanager/afm_hash.cpp
vcl/unx/generic/gdi/salbmp.cxx
vcl/unx/generic/gdi/salgdi3.cxx
vcl/unx/generic/gdi/xrender_peer.cxx
vcl/unx/generic/window/salframe.cxx
vcl/unx/generic/window/salobj.cxx
vcl/unx/gtk/a11y/makefile.mk
vcl/unx/gtk/app/gtksys.cxx
vcl/unx/gtk/app/makefile.mk
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde/salnativewidgets-kde.cxx
vcl/unx/kde4/KDESalDisplay.hxx
vcl/unx/kde4/KDEXLib.cxx
vcl/unx/kde4/KDEXLib.hxx
vcl/unx/kde4/VCLKDEApplication.cxx
vcl/unx/kde4/makefile.mk
vcl/unx/source/app/makefile.mk
vcl/unx/source/fontmanager/makefile.mk
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/inc/salcursors.h
vcl/util/linksvp/makefile.mk
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/app/salshl.cxx
vcl/win/source/gdi/makefile.mk
vcl/win/source/gdi/salbmp.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi2.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salgdi_gdiplus.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/salvd.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salmenu.cxx
vcl/win/source/window/salobj.cxx
Diffstat (limited to 'vcl/unx/generic/app/keysymnames.cxx')
-rw-r--r-- | vcl/unx/generic/app/keysymnames.cxx | 692 |
1 files changed, 692 insertions, 0 deletions
diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx new file mode 100644 index 000000000000..0615a2d44450 --- /dev/null +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -0,0 +1,692 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#if !defined(SOLARIS) && !defined(AIX) +#include <tools/prex.h> +#include <X11/XKBlib.h> +#include <tools/postx.h> +#endif + +#include <unx/saldisp.hxx> +#include <X11/keysym.h> +#include <sal/macros.h> + +#if !defined (SunXK_Undo) +#define SunXK_Undo 0x0000FF65 // XK_Undo +#define SunXK_Again 0x0000FF66 // XK_Redo +#define SunXK_Find 0x0000FF68 // XK_Find +#define SunXK_Stop 0x0000FF69 // XK_Cancel +#define SunXK_Props 0x1005FF70 +#define SunXK_Front 0x1005FF71 +#define SunXK_Copy 0x1005FF72 +#define SunXK_Open 0x1005FF73 +#define SunXK_Paste 0x1005FF74 +#define SunXK_Cut 0x1005FF75 +#endif + +#ifdef SOLARIS +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/kbio.h> +#include <sys/kbd.h> +#include <stdio.h> +#include <fcntl.h> +#include <deflt.h> +#include <unistd.h> +#include <stdlib.h> +#endif + +#include <string.h> + +namespace vcl_sal { + + struct KeysymNameReplacement + { + KeySym aSymbol; + const char* pName; + }; + + struct KeyboardReplacements + { + const char* pKeyboardName; + const KeysymNameReplacement* pReplacements; + int nReplacements; + }; + + // ==================================================================== + // + // CAUTION CAUTION CAUTION + // every string value in the replacements tables must be in UTF8 + // be careful with your editor ! + // + // ==================================================================== + + static const struct KeysymNameReplacement aImplReplacements_English[] = + { + { XK_Control_L, "Ctrl" }, + { XK_Control_R, "Ctrl" }, + { XK_Escape, "Esc" }, + { XK_space, "Space" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Turkish[] = + { + { XK_Control_L, "Ctrl" }, + { XK_Control_R, "Ctrl" }, + { XK_Right, "Sağ" }, + { XK_Left, "Sol" }, + { XK_Up, "Yukarı" }, + { XK_Down, "Aşağı" }, + { XK_space, "Boşluk" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Russian[] = + { + { XK_Right, "Вправо" }, + { XK_Left, "Влево" }, + { XK_Up, "Вверх" }, + { XK_Down, "Вниз" }, + { XK_space, "Пробел" } + }; + + static const struct KeysymNameReplacement aImplReplacements_German[] = + { + { XK_Control_L, "Strg" }, + { XK_Control_R, "Strg" }, + { XK_Shift_L, "Umschalt" }, + { XK_Shift_R, "Umschalt" }, + { XK_Alt_L, "Alt" }, + { XK_Alt_R, "Alt Gr" }, + { XK_Page_Up, "Bild auf" }, + { XK_Page_Down, "Bild ab" }, + { XK_End, "Ende" }, + { XK_Home, "Pos 1" }, + { XK_Insert, "Einfg" }, + { XK_Delete, "Entf" }, + { XK_Escape, "Esc" }, + { XK_Right, "Rechts" }, + { XK_Left, "Links" }, + { XK_Up, "Oben" }, + { XK_Down, "Unten" }, + { XK_BackSpace, "Rückschritt" }, + { XK_Return, "Eingabe" }, + { XK_slash, "Schrägstrich" }, + { XK_space, "Leertaste" }, + { SunXK_Stop, "Stop" }, + { SunXK_Again, "Wiederholen" }, + { SunXK_Props, "Eigenschaften" }, + { SunXK_Undo, "Zurücknehmen" }, + { SunXK_Front, "Vordergrund" }, + { SunXK_Copy, "Kopieren" }, + { SunXK_Open, "Öffnen" }, + { SunXK_Paste, "Einsetzen" }, + { SunXK_Find, "Suchen" }, + { SunXK_Cut, "Ausschneiden" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_French[] = + { + { XK_Shift_L, "Maj" }, + { XK_Shift_R, "Maj" }, + { XK_Page_Up, "Pg. Préc" }, + { XK_Page_Down, "Pg. Suiv" }, + { XK_End, "Fin" }, + { XK_Home, "Origine" }, + { XK_Insert, "Insérer" }, + { XK_Delete, "Suppr" }, + { XK_Escape, "Esc" }, + { XK_Right, "Droite" }, + { XK_Left, "Gauche" }, + { XK_Up, "Haut" }, + { XK_Down, "Bas" }, + { XK_BackSpace, "Ret. Arr" }, + { XK_Return, "Retour" }, + { XK_KP_Enter, "Entrée" }, + { SunXK_Stop, "Stop" }, + { SunXK_Again, "Encore" }, + { SunXK_Props, "Props" }, + { SunXK_Undo, "Annuler" }, + { SunXK_Front, "Devant" }, + { SunXK_Copy, "Copy" }, + { SunXK_Open, "Ouvrir" }, + { SunXK_Paste, "Coller" }, + { SunXK_Find, "Cher." }, + { SunXK_Cut, "Couper" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Italian[] = + { + { XK_Shift_L, "Maiusc" }, + { XK_Shift_R, "Maiusc" }, + { XK_Page_Up, "PgSu" }, + { XK_Page_Down, "PgGiu" }, + { XK_End, "Fine" }, + { XK_Insert, "Ins" }, + { XK_Delete, "Canc" }, + { XK_Escape, "Esc" }, + { XK_Right, "A destra" }, + { XK_Left, "A sinistra" }, + { XK_Up, "Sposta verso l'alto" }, + { XK_Down, "Sposta verso il basso" }, + { XK_BackSpace, "Backspace" }, + { XK_Return, "Invio" }, + { XK_space, "Spazio" }, + { SunXK_Stop, "Stop" }, + { SunXK_Again, "Ancora" }, + { SunXK_Props, "Proprietà" }, + { SunXK_Undo, "Annulla" }, + { SunXK_Front, "Davanti" }, + { SunXK_Copy, "Copia" }, + { SunXK_Open, "Apri" }, + { SunXK_Paste, "Incolla" }, + { SunXK_Find, "Trova" }, + { SunXK_Cut, "Taglia" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Dutch[] = + { + { XK_Page_Up, "PageUp" }, + { XK_Page_Down, "PageDown" }, + { XK_Escape, "Esc" }, + { XK_Right, "Rechts" }, + { XK_Left, "Links" }, + { XK_Up, "Boven" }, + { XK_Down, "Onder" }, + { XK_BackSpace, "Backspace" }, + { XK_Return, "Return" }, + { XK_space, "Spatiebalk" }, + { SunXK_Stop, "Stop" }, + { SunXK_Again, "Again" }, + { SunXK_Props, "Props" }, + { SunXK_Undo, "Undo" }, + { SunXK_Front, "Front" }, + { SunXK_Copy, "Copy" }, + { SunXK_Open, "Open" }, + { SunXK_Paste, "Paste" }, + { SunXK_Find, "Find" }, + { SunXK_Cut, "Cut" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Norwegian[] = + { + { XK_Shift_L, "Skift" }, + { XK_Shift_R, "Skift" }, + { XK_Page_Up, "PageUp" }, + { XK_Page_Down, "PageDown" }, + { XK_Escape, "Esc" }, + { XK_Right, "Hyre" }, + { XK_Left, "Venstre" }, + { XK_Up, "Opp" }, + { XK_Down, "Ned" }, + { XK_BackSpace, "Tilbake" }, + { XK_Return, "Enter" }, + { SunXK_Stop, "Avbryt" }, + { SunXK_Again, "Gjenta" }, + { SunXK_Props, "Egenskaper" }, + { SunXK_Undo, "Angre" }, + { SunXK_Front, "Front" }, + { SunXK_Copy, "Kopi" }, + { SunXK_Open, "Åpne" }, + { SunXK_Paste, "Lim" }, + { SunXK_Find, "Søk" }, + { SunXK_Cut, "Klipp" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Swedish[] = + { + { XK_Shift_L, "Skift" }, + { XK_Shift_R, "Skift" }, + { XK_Page_Up, "PageUp" }, + { XK_Page_Down, "PageDown" }, + { XK_Escape, "Esc" }, + { XK_Right, "Höger" }, + { XK_Left, "Vänster" }, + { XK_Up, "Up" }, + { XK_Down, "Ned" }, + { XK_BackSpace, "Backsteg" }, + { XK_Return, "Retur" }, + { XK_space, "Blank" }, + { SunXK_Stop, "Avbryt" }, + { SunXK_Again, "Upprepa" }, + { SunXK_Props, "Egenskaper" }, + { SunXK_Undo, "Ångra" }, + { SunXK_Front, "Fram" }, + { SunXK_Copy, "Kopiera" }, + { SunXK_Open, "Öppna" }, + { SunXK_Paste, "Klistra in" }, + { SunXK_Find, "Sök" }, + { SunXK_Cut, "Klipp ut" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Portuguese[] = + { + { XK_Page_Up, "PageUp" }, + { XK_Page_Down, "PageDown" }, + { XK_Escape, "Esc" }, + { XK_Right, "Direita" }, + { XK_Left, "Esquerda" }, + { XK_Up, "Acima" }, + { XK_Down, "Abaixo" }, + { XK_BackSpace, "Backspace" }, + { XK_Return, "Enter" }, + { XK_slash, "Barra" }, + { SunXK_Stop, "Stop" }, + { SunXK_Again, "Again" }, + { SunXK_Props, "Props" }, + { SunXK_Undo, "Undo" }, + { SunXK_Front, "Front" }, + { SunXK_Copy, "Copy" }, + { SunXK_Open, "Open" }, + { SunXK_Paste, "Paste" }, + { SunXK_Find, "Find" }, + { SunXK_Cut, "Cut" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeysymNameReplacement aImplReplacements_Spanish[] = + { + { XK_Shift_L, "Mayús" }, + { XK_Shift_R, "Mayús" }, + { XK_Page_Up, "RePág" }, + { XK_Page_Down, "AvPág" }, + { XK_End, "Fin" }, + { XK_Home, "Inicio" }, + { XK_Delete, "Supr" }, + { XK_Escape, "Esc" }, + { XK_Right, "Hacia la derecha" }, + { XK_Left, "Hacia la izquierda" }, + { XK_Up, "Hacia arriba" }, + { XK_Down, "Hacia abajo" }, + { XK_BackSpace, "Ret" }, + { XK_Return, "Entrada" }, + { XK_space, "Espacio" }, + { XK_KP_Enter, "Intro" }, + { SunXK_Stop, "Stop" }, + { SunXK_Again, "Repetir" }, + { SunXK_Props, "Props" }, + { SunXK_Undo, "Anular" }, + { SunXK_Front, "Delante" }, + { SunXK_Copy, "Copiar" }, + { SunXK_Open, "Abrir" }, + { SunXK_Paste, "Pegar" }, + { SunXK_Find, "Buscar" }, + { SunXK_Cut, "Cortar" }, + { XK_minus, "-" }, + { XK_plus, "+" } + }; + + static const struct KeyboardReplacements aKeyboards[] = + { +#ifdef SOLARIS + { "Germany5", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, + { "Germany4", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, + { "France5", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "France6", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "France_x86", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "Italy5", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy5-Hobo", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy4", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy6", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Italy_x86", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + { "Netherland4", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland5", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland5-Hobo", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland6", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Netherland_x86", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Norway5", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway5-Hobo", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway4", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway6", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Norway_x86", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + { "Portugal5", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal5-Hobo", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal4", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal6", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Portugal_x86", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Spain5", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain5-Hobo", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain4", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain6", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spain_x86", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Sweden5", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden5-Hobo", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden4", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden6", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Sweden_x86", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, +#endif + { "U.S. English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }, + { "United Kingdom", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }, + // Germany, German + { "German", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, + { "France", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + { "French", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, + // Italy, Italian + { "Ital", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, + // Norway, Norwegian + { "Norw", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, + // Portugal, Portuguese + { "Portu", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, + { "Spain", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + { "Spanish", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, + // Sweden, Swedish + { "Swed", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, + { "Netherland", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + { "Dutch", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, + // Turkish, Turkey + { "Turk", aImplReplacements_Turkish, SAL_N_ELEMENTS(aImplReplacements_Turkish) }, + // Russian, Russia + { "Russia", aImplReplacements_Russian, SAL_N_ELEMENTS(aImplReplacements_Russian) }, + { "English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) } + }; + + String getKeysymReplacementName( const char* pKeyboard, KeySym nSymbol ) + { + for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ ) + { + if( ! strncasecmp( pKeyboard, aKeyboards[n].pKeyboardName, strlen( aKeyboards[n].pKeyboardName ) ) ) + { + const struct KeysymNameReplacement* pRepl = aKeyboards[n].pReplacements; + for( int m = aKeyboards[n].nReplacements ; m ; ) + { + if( nSymbol == pRepl[--m].aSymbol ) + return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 ); + } + } + } + // try english fallbacks + const struct KeysymNameReplacement* pRepl = aImplReplacements_English; + for( int m = SAL_N_ELEMENTS(aImplReplacements_English); m ; ) + { + if( nSymbol == pRepl[--m].aSymbol ) + return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 ); + } + return String(); + } + +} + +#ifdef SOLARIS +typedef struct { + int n_layout; + const char* p_description; +} keyboard_layout; + +static const keyboard_layout type0_layout[] = +{ + { 0, "US4" }, + { -1, NULL } +}; + +static const keyboard_layout type3_layout[] = +{ + { 0, "US3" }, + { -1, NULL } +}; + +static const keyboard_layout type4_layout[] = +{ + { 0, "US4" }, + { 1, "US4" }, + { 2, "FranceBelg4" }, + { 3, "Canada4" }, + { 4, "Denmark4" }, + { 5, "Germany4" }, + { 6, "Italy4" }, + { 7, "Netherland4" }, + { 8, "Norway4" }, + { 9, "Portugal4" }, + { 10, "SpainLatAm4" }, + { 11, "SwedenFin4" }, + { 12, "Switzer_Fr4" }, + { 13, "Switzer_Ge4" }, + { 14, "UK4" }, + { 16, "Korea4" }, + { 17, "Taiwan4" }, + { 19, "US101A_PC" }, + { 19, "US101A_Sun" }, + { 32, "Japan4" }, + { 33, "US5" }, + { 34, "US_UNIX5" }, + { 35, "France5" }, + { 36, "Denmark5" }, + { 37, "Germany5" }, + { 38, "Italy5" }, + { 39, "Netherland5" }, + { 40, "Norway5" }, + { 41, "Portugal5" }, + { 42, "Spain5" }, + { 43, "Sweden5" }, + { 44, "Switzer_Fr5" }, + { 45, "Switzer_Ge5" }, + { 46, "UK5" }, + { 47, "Korea5" }, + { 48, "Taiwan5" }, + { 49, "Japan5" }, + { 50, "Canada_Fr5" }, + { 51, "Hungary5" }, + { 52, "Poland5" }, + { 53, "Czech5" }, + { 54, "Russia5" }, + { 55, "Latvia5" }, + { 56, "Turkey5" }, + { 57, "Greece5" }, + { 58, "Estonia5" }, + { 59, "Lithuania5" }, + { 63, "Canada_Fr5_TBITS5" }, + { 80, "US5_Hobo" }, + { 81, "US_UNIX5_Hobo" }, + { 82, "France5_Hobo" }, + { 83, "Denmark5_Hobo" }, + { 84, "Germany5_Hobo" }, + { 85, "Italy5_Hobo" }, + { 86, "Netherland5_Hobo" }, + { 87, "Norway5_Hobo" }, + { 88, "Portugal5_Hobo" }, + { 89, "Spain5_Hobo" }, + { 90, "Sweden5_Hobo" }, + { 91, "Switzer_Fr5_Hobo" }, + { 92, "Switzer_Ge5_Hobo" }, + { 93, "UK5_Hobo" }, + { 94, "Korea5_Hobo" }, + { 95, "Taiwan5_Hobo" }, + { 96, "Japan5_Hobo" }, + { 97, "Canada_Fr5_Hobo" }, + { -1, NULL } +}; + +static const keyboard_layout type101_layout[] = +{ + { 0, "US101A_x86" }, + { 1, "US101A_x86" }, + { 34, "J3100_x86" }, + { 35, "France_x86" }, + { 36, "Denmark_x86" }, + { 37, "Germany_x86" }, + { 38, "Italy_x86" }, + { 39, "Netherland_x86" }, + { 40, "Norway_x86" }, + { 41, "Portugal_x86" }, + { 42, "Spain_x86" }, + { 43, "Sweden_x86" }, + { 44, "Switzer_Fr_x86" }, + { 45, "Switzer_Ge_x86" }, + { 46, "UK_x86" }, + { 47, "Korea_x86" }, + { 48, "Taiwan_x86" }, + { 49, "Japan_x86" }, + { 50, "Canada_Fr2_x86" }, + { 51, "Hungary_x86" }, + { 52, "Poland_x86" }, + { 53, "Czech_x86" }, + { 54, "Russia_x86" }, + { 55, "Latvia_x86" }, + { 56, "Turkey_x86" }, + { 57, "Greece_x86" }, + { 59, "Lithuania_x86" }, + { 1001, "MS_US101A_x86" }, + { -1, NULL } +}; + +static const keyboard_layout type6_layout[] = +{ + { 0, "US6" }, + { 6, "Denmark6" }, + { 7, "Finnish6" }, + { 8, "France6" }, + { 9, "Germany6" }, + { 14, "Italy6" }, + { 15, "Japan6" }, + { 16, "Korea6" }, + { 18, "Netherland6" }, + { 19, "Norway6" }, + { 22, "Portugal6" }, + { 25, "Spain6" }, + { 26, "Sweden6" }, + { 27, "Switzer_Fr6" }, + { 28, "Switzer_Ge6" }, + { 30, "Taiwan6" }, + { 32, "UK6" }, + { 33, "US6" }, + { -1, NULL } +}; +#endif + + +#if OSL_DEBUG_LEVEL > 1 +#include <stdio.h> +#endif + +const char* SalDisplay::GetKeyboardName( bool bRefresh ) +{ + if( bRefresh || ! m_aKeyboardName.Len() ) + { +#if defined(SOLARIS) + if( IsLocal() ) + { + int kbd = open( "/dev/kbd", O_RDONLY ); + if( kbd >= 0 ) + { + int kbd_type = 0; + if( ! ioctl( kbd, KIOCTYPE, &kbd_type ) ) + { + int kbd_layout = 0; + if( ! ioctl( kbd, KIOCLAYOUT, &kbd_layout ) ) + { + const keyboard_layout *p_layout = NULL; + switch( kbd_type ) + { + case KB_KLUNK: p_layout = type0_layout; break; + case KB_SUN3: p_layout = type3_layout; break; + case KB_SUN4: p_layout = type4_layout; break; + case KB_USB: p_layout = type6_layout; break; + case KB_PC: p_layout = type101_layout; break; + } + + if( p_layout ) + { + while( p_layout->n_layout != -1 ) + { + if ( p_layout->n_layout == kbd_layout ) + { + m_aKeyboardName = p_layout->p_description; + break; + } + p_layout++; + } + } + } + } + close(kbd); + } + } +#elif !defined(AIX) + int opcode, event, error; + int major = XkbMajorVersion, minor = XkbMinorVersion; + if( XkbQueryExtension( GetDisplay(), &opcode, &event,&error, &major, &minor ) ) + { + XkbDescPtr pXkbDesc = NULL; + // try X keyboard extension + if( (pXkbDesc = XkbGetKeyboard( GetDisplay(), XkbAllComponentsMask, XkbUseCoreKbd )) ) + { + const char* pAtom = NULL; + if( pXkbDesc->names->groups[0] ) + { + pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->groups[0] ); + m_aKeyboardName = pAtom; + XFree( (void*)pAtom ); + } + else + m_aKeyboardName = "<unknown keyboard>"; +#if OSL_DEBUG_LEVEL > 1 +#define PRINT_ATOM( x ) { if( pXkbDesc->names->x ) { pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->x ); fprintf( stderr, "%s: %s\n", #x, pAtom ); XFree( (void*)pAtom ); } else fprintf( stderr, "%s: <nil>\n", #x ); } + + PRINT_ATOM( keycodes ); + PRINT_ATOM( geometry ); + PRINT_ATOM( symbols ); + PRINT_ATOM( types ); + PRINT_ATOM( compat ); + PRINT_ATOM( phys_symbols ); + +#define PRINT_ATOM_2( x ) { if( pXkbDesc->names->x[i] ) { pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->x[i] ); fprintf( stderr, "%s[%d]: %s\n", #x, i, pAtom ); XFree( (void*)pAtom ); } else fprintf( stderr, "%s[%d]: <nil>\n", #x, i ); } + int i; + for( i = 0; i < XkbNumVirtualMods; i++ ) + PRINT_ATOM_2( vmods ); + for( i = 0; i < XkbNumIndicators; i++ ) + PRINT_ATOM_2( indicators ); + for( i = 0; i < XkbNumKbdGroups; i++ ) + PRINT_ATOM_2( groups ); +#endif + XkbFreeKeyboard( pXkbDesc, XkbAllComponentsMask, True ); + } + } +#endif + if( ! m_aKeyboardName.Len() ) + m_aKeyboardName = "<unknown keyboard>"; + } + return m_aKeyboardName.GetBuffer(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |