├── po ├── LINGUAS ├── .cvsignore ├── POTFILES.in └── ChangeLog ├── TODO ├── tables ├── .cvsignore ├── Makefile.am ├── candidate │ ├── README │ ├── CREDITS │ ├── ChangeLog │ ├── hanja-to-c.py │ ├── hanja-merge.py │ ├── hanja-sanity.pl │ ├── hanja-gettext.py │ └── hanjatable.py ├── compose │ └── default └── keyboard │ ├── 2qwerty │ ├── 32qwerty │ ├── 3sqwerty │ ├── 3fqwerty │ ├── 3yqwerty │ └── 39qwerty ├── themes ├── .cvsignore ├── Mac │ ├── .cvsignore │ ├── README │ ├── none.png │ ├── hangul.png │ └── english.png ├── Onion │ ├── .cvsignore │ ├── README │ ├── none.png │ ├── english.png │ └── hangul.png ├── KingSejong │ ├── .cvsignore │ ├── README │ ├── none.png │ ├── english.png │ └── hangul.png ├── MSWindows │ ├── .cvsignore │ ├── none.png │ ├── english.png │ └── hangul.png ├── SimplyRed │ ├── .cvsignore │ ├── none.png │ ├── english.png │ └── hangul.png ├── keyboard │ ├── .cvsignore │ ├── none.png │ ├── hangul.png │ ├── english.png │ └── README ├── malys │ ├── README │ ├── none.png │ ├── english.png │ └── hangul.png ├── Jini │ ├── README │ ├── none.png │ ├── english.png │ └── hangul.png ├── Tux │ ├── none.png │ ├── hangul.png │ ├── README │ └── english.png ├── ubuntu-mono-dark │ ├── README │ ├── hangul.png │ ├── none.png │ └── english.png ├── KingSejong2 │ ├── hangul.png │ ├── none.png │ ├── english.png │ └── README ├── MSWindowsXP │ ├── hangul.png │ ├── none.png │ └── english.png ├── ubuntu-mono-light │ ├── README │ ├── none.png │ ├── english.png │ └── hangul.png └── Makefile.am ├── AUTHORS ├── IMdkit ├── .cvsignore ├── doc │ ├── Xi18n_sample │ │ ├── README │ │ ├── sampleIM.c │ │ ├── Imakefile │ │ └── IC.h │ ├── CHANGELOG │ └── README ├── Makefile.am ├── Xi18nX.h ├── IMMethod.c ├── XimFunc.h ├── IMValues.c ├── IMdkit.h ├── IMConn.c ├── FrameMgr.h ├── i18nAttr.c └── XimProto.h ├── nabi.png ├── src ├── .cvsignore ├── Makefile.am ├── util.h ├── preference.h ├── session.h ├── debug.h ├── keycapturedialog.h ├── fontset.h ├── keyboard-layout.h ├── ustring.h ├── debug.c ├── util.c ├── handlebox.h ├── nabi.h ├── conf.h ├── keyboard-layout.c ├── ustring.c ├── candidate.h ├── eggtrayicon.h ├── gettext.h ├── main.c ├── xim_protocol.h ├── keycapturedialog.c ├── fontset.c ├── handlebox.c ├── ic.h ├── session.c └── server.h ├── nabi-about.png ├── autogen.sh ├── .cvsignore ├── .gitignore ├── test ├── qt4.cpp ├── qt.cpp ├── gtk1.c ├── gtk.c ├── Makefile └── xim_filter.c ├── Makefile.am ├── README ├── configure.ac └── NEWS /po/LINGUAS: -------------------------------------------------------------------------------- 1 | de 2 | ko 3 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ----- 3 | * 1.0 내기 4 | -------------------------------------------------------------------------------- /tables/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/Mac/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/Onion/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Choe Hwanjin 2 | -------------------------------------------------------------------------------- /IMdkit/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | -------------------------------------------------------------------------------- /themes/KingSejong/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/MSWindows/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/SimplyRed/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/keyboard/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /themes/Mac/README: -------------------------------------------------------------------------------- 1 | 만든사람: Kim Seok-Jin 2 | -------------------------------------------------------------------------------- /nabi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/nabi.png -------------------------------------------------------------------------------- /themes/malys/README: -------------------------------------------------------------------------------- 1 | Author: peter yoo 2 | -------------------------------------------------------------------------------- /src/.cvsignore: -------------------------------------------------------------------------------- 1 | .deps 2 | Makefile 3 | Makefile.in 4 | nabi 5 | *.o 6 | -------------------------------------------------------------------------------- /nabi-about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/nabi-about.png -------------------------------------------------------------------------------- /themes/KingSejong/README: -------------------------------------------------------------------------------- 1 | 이 테마는 성현 신 님이 보내주신 것입니다. 2 | -------------------------------------------------------------------------------- /themes/Jini/README: -------------------------------------------------------------------------------- 1 | Kitae Kim 2 | 3 | http://jini.kldp.net/ 4 | -------------------------------------------------------------------------------- /themes/Mac/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Mac/none.png -------------------------------------------------------------------------------- /themes/Onion/README: -------------------------------------------------------------------------------- 1 | 2 | theme by onion from ROK 3 | -------------------------------------------------------------------------------- /themes/Tux/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Tux/none.png -------------------------------------------------------------------------------- /themes/Jini/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Jini/none.png -------------------------------------------------------------------------------- /themes/Mac/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Mac/hangul.png -------------------------------------------------------------------------------- /themes/Onion/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Onion/none.png -------------------------------------------------------------------------------- /themes/Tux/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Tux/hangul.png -------------------------------------------------------------------------------- /themes/malys/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/malys/none.png -------------------------------------------------------------------------------- /po/.cvsignore: -------------------------------------------------------------------------------- 1 | *.pot 2 | *.gmo 3 | *.mo 4 | Makefile 5 | Makefile.in 6 | POTFILES 7 | stamp-po 8 | -------------------------------------------------------------------------------- /themes/Jini/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Jini/english.png -------------------------------------------------------------------------------- /themes/Jini/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Jini/hangul.png -------------------------------------------------------------------------------- /themes/Mac/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Mac/english.png -------------------------------------------------------------------------------- /themes/Onion/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Onion/english.png -------------------------------------------------------------------------------- /themes/Onion/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Onion/hangul.png -------------------------------------------------------------------------------- /themes/Tux/README: -------------------------------------------------------------------------------- 1 | Tux Theme 2 | 3 | Aug 30 2004 4 | Joon-Cheol Park, 5 | -------------------------------------------------------------------------------- /themes/Tux/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/Tux/english.png -------------------------------------------------------------------------------- /themes/keyboard/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/keyboard/none.png -------------------------------------------------------------------------------- /themes/malys/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/malys/english.png -------------------------------------------------------------------------------- /themes/malys/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/malys/hangul.png -------------------------------------------------------------------------------- /themes/KingSejong/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/KingSejong/none.png -------------------------------------------------------------------------------- /themes/MSWindows/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/MSWindows/none.png -------------------------------------------------------------------------------- /themes/SimplyRed/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/SimplyRed/none.png -------------------------------------------------------------------------------- /themes/keyboard/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/keyboard/hangul.png -------------------------------------------------------------------------------- /themes/ubuntu-mono-dark/README: -------------------------------------------------------------------------------- 1 | Lee June Hee 2 | 3 | http://opensea.egloos.com 4 | -------------------------------------------------------------------------------- /themes/KingSejong/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/KingSejong/english.png -------------------------------------------------------------------------------- /themes/KingSejong/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/KingSejong/hangul.png -------------------------------------------------------------------------------- /themes/KingSejong2/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/KingSejong2/hangul.png -------------------------------------------------------------------------------- /themes/KingSejong2/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/KingSejong2/none.png -------------------------------------------------------------------------------- /themes/MSWindows/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/MSWindows/english.png -------------------------------------------------------------------------------- /themes/MSWindows/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/MSWindows/hangul.png -------------------------------------------------------------------------------- /themes/MSWindowsXP/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/MSWindowsXP/hangul.png -------------------------------------------------------------------------------- /themes/MSWindowsXP/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/MSWindowsXP/none.png -------------------------------------------------------------------------------- /themes/SimplyRed/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/SimplyRed/english.png -------------------------------------------------------------------------------- /themes/SimplyRed/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/SimplyRed/hangul.png -------------------------------------------------------------------------------- /themes/keyboard/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/keyboard/english.png -------------------------------------------------------------------------------- /themes/ubuntu-mono-light/README: -------------------------------------------------------------------------------- 1 | Lee June Hee 2 | 3 | http://opensea.egloos.com 4 | -------------------------------------------------------------------------------- /IMdkit/doc/Xi18n_sample/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/IMdkit/doc/Xi18n_sample/README -------------------------------------------------------------------------------- /themes/KingSejong2/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/KingSejong2/english.png -------------------------------------------------------------------------------- /themes/MSWindowsXP/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/MSWindowsXP/english.png -------------------------------------------------------------------------------- /IMdkit/doc/Xi18n_sample/sampleIM.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/IMdkit/doc/Xi18n_sample/sampleIM.c -------------------------------------------------------------------------------- /themes/ubuntu-mono-dark/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/ubuntu-mono-dark/hangul.png -------------------------------------------------------------------------------- /themes/ubuntu-mono-dark/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/ubuntu-mono-dark/none.png -------------------------------------------------------------------------------- /themes/ubuntu-mono-light/none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/ubuntu-mono-light/none.png -------------------------------------------------------------------------------- /themes/keyboard/README: -------------------------------------------------------------------------------- 1 | 이 아이콘은 Kim Seok-Jin 님이 만들어 보내주신 것입니다. 2 | jimmac홈의 키맵아이콘을 수정하여 만들었다고 합니다. 3 | -------------------------------------------------------------------------------- /themes/ubuntu-mono-dark/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/ubuntu-mono-dark/english.png -------------------------------------------------------------------------------- /themes/ubuntu-mono-light/english.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/ubuntu-mono-light/english.png -------------------------------------------------------------------------------- /themes/ubuntu-mono-light/hangul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libhangul/nabi/HEAD/themes/ubuntu-mono-light/hangul.png -------------------------------------------------------------------------------- /themes/KingSejong2/README: -------------------------------------------------------------------------------- 1 | 이 테마는 크래머 스테판 님이 만든 테마입니다. 2 | 3 | 한글: 세종대왕 (世宗大王) 4 | 로마자: Gaius Iulius Caesar 5 | 6 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | src/candidate.c 2 | src/eggtrayicon.c 3 | src/fontset.c 4 | src/handler.c 5 | src/ic.c 6 | src/main.c 7 | src/server.c 8 | src/session.c 9 | src/ui.c 10 | src/preference.c 11 | -------------------------------------------------------------------------------- /tables/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | keyboarddir = @NABI_DATA_DIR@ 3 | keyboard_DATA = keyboard_layouts 4 | 5 | symboltabledir = @NABI_DATA_DIR@ 6 | symboltable_DATA = symbol.txt 7 | 8 | EXTRA_DIST = $(keyboard_DATA) $(symboltable_DATA) 9 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | touch ChangeLog 4 | glib-gettextize --copy --force 5 | aclocal 6 | autoheader 7 | automake --add-missing --copy 8 | autoconf 9 | 10 | echo "Now you should run ./configure script with some argument" 11 | -------------------------------------------------------------------------------- /.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | aclocal.m4 4 | config.cache 5 | config.h 6 | config.h.in 7 | config.log 8 | config.status 9 | configure 10 | intl 11 | stamp-h 12 | stamp-h1 13 | stamp-h.in 14 | autom4te.cache 15 | nabi-*.tar.gz 16 | -------------------------------------------------------------------------------- /IMdkit/doc/Xi18n_sample/Imakefile: -------------------------------------------------------------------------------- 1 | IMDLIB = -L../IMdkit -lXimd 2 | DEPLIBS = $(DEPXONLYLIB) 3 | INCLUDES = -I../IMdkit 4 | LOCAL_LIBRARIES = $(IMDLIB) $(XONLYLIB) 5 | SRCS = sampleIM.c IC.c 6 | OBJS = sampleIM.o IC.o 7 | #CDEBUGFLAGS = -g -DX_LOCALE 8 | CDEBUGFLAGS = -g 9 | PROGRAM = sampleIM 10 | 11 | ComplexProgramTarget(sampleIM) 12 | -------------------------------------------------------------------------------- /tables/candidate/README: -------------------------------------------------------------------------------- 1 | 한자 정보 파일 2 | 3 | hanjatable.py는 python 스크립트로 Unihan.txt 파일을 읽어서 한국어음을 가지고 4 | 있는 한자를 골라서 나비, 새나루 같은 한글 입력기에서 사용 가능한 포맷의 5 | 파일을 생성한다. 6 | 7 | 사용법: 8 | $ hanjatable.py Unihan.txt > nabi-hanja.txt 9 | 10 | 에러나 다른 정보는 stderr로 출력되므로 확인할 수 있다. 11 | 12 | 출력되는 파일 형식은 13 | 14 | [글자] 15 | 한자=설명 16 | 17 | 이다. 18 | 19 | 여기서 출력된 한자 데이터 파일과 심벌 데이터 파일을 아래와 같이 합쳐 20 | 데이터 파일을 만든다. 21 | $ cat nabi-symbol.txt nabi-hanja.txt > nabi.txt 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ChangeLog 2 | INSTALL 3 | Makefile 4 | Makefile.in 5 | aclocal.m4 6 | autom4te.cache 7 | compile 8 | configure 9 | config.h 10 | config.h.in 11 | config.log 12 | config.status 13 | depcomp 14 | install-sh 15 | missing 16 | mkinstalldirs 17 | stamp-h1 18 | po/Makefile.in.in 19 | po/POTFILES 20 | po/*.gmo 21 | po/*.pot 22 | src/nabi 23 | test/gtk 24 | test/xlib 25 | *.tar.gz 26 | */Makefile 27 | */Makefile.in 28 | */.deps 29 | */*.a 30 | */*.o 31 | -------------------------------------------------------------------------------- /tables/candidate/CREDITS: -------------------------------------------------------------------------------- 1 | Chloe Lewis 2 | Choe Hwanjin 3 | Jeon Byeong Sik 4 | Kibum Han 5 | Kim Seok-Jin 6 | Like Macgyver 7 | Young-Ho Cha 8 | Yun-young Lee 9 | kheled 10 | myunggoni 11 | 김 정수 12 | 김민우 13 | 김선달 14 | -------------------------------------------------------------------------------- /IMdkit/doc/CHANGELOG: -------------------------------------------------------------------------------- 1 | By Tung-Han Hsieh, 2000/02/07 2 | Fix many possible memory leaks. 3 | Fix several incorrect protocols. 4 | Change the Makefiles to be integrated to xcin-2.5. 5 | These changes are according to ami-1.0.1. 6 | 7 | This version by Steve Underwood, 1999/05/08 8 | The first stage of a clean up and bug fix for IMdkit. 9 | This version removes the obsolete and buggy XIMP support. 10 | It fixes a number of memory leaks in Xi18n support. 11 | It has been tidied up somewhat. 12 | The clean up is far from complete 13 | There are still memory leaks. 14 | -------------------------------------------------------------------------------- /test/qt4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication app(argc, argv); 9 | 10 | QWidget widget; 11 | widget.resize(300, 200); 12 | 13 | QBoxLayout *layout = new QVBoxLayout(&widget); 14 | 15 | QLineEdit *lineedit = new QLineEdit(&widget); 16 | layout->addWidget(lineedit); 17 | 18 | QTextEdit *textedit = new QTextEdit(&widget); 19 | layout->addWidget(textedit); 20 | 21 | widget.show(); 22 | 23 | return app.exec(); 24 | } 25 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2004-02-18 Choe Hwanjin 2 | * update from GNU gettext to glib gettext 3 | 4 | 2003-07-28 gettextize 5 | 6 | * Makefile.in.in: New file, from gettext-0.12.1. 7 | * Rules-quot: New file, from gettext-0.12.1. 8 | * boldquot.sed: New file, from gettext-0.12.1. 9 | * en@boldquot.header: New file, from gettext-0.12.1. 10 | * en@quot.header: New file, from gettext-0.12.1. 11 | * insert-header.sin: New file, from gettext-0.12.1. 12 | * quot.sed: New file, from gettext-0.12.1. 13 | * remove-potcdate.sin: New file, from gettext-0.12.1. 14 | 15 | -------------------------------------------------------------------------------- /tables/candidate/ChangeLog: -------------------------------------------------------------------------------- 1 | 2004-08-18 Choe Hwanjin 2 | * hanja-to-c.py 스크립트 추가 3 | 4 | 2004-05-26 Chloe Lewis 5 | * hanja-sanity.pl: 기본 동작으로 두음법칙을 고려하여 출력하고, 6 | 옵션으로 -v 를 사용하면 모든 잘못되었음직한 항목을 보이도록 수정 7 | 8 | 2004-05-21 Chloe Lewis 9 | * nabi-hanja.txt: Unihan-4.0.1.txt 로 이전 10 | 11 | 2004-05-16 Choe Hwanjin 12 | * nabi-symbol.txt, nabi.txt: http://micsland.com/phps/key.php 여기에 13 | 있는 표대로 심벌 문자 배치를 변경 14 | 15 | 2004-05-07 Choe Hwanjin 16 | * start ChangeLog for hanja dictionary file 17 | * add hanja-merge.py, hanja-gettext.py script 18 | -------------------------------------------------------------------------------- /test/qt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication app(argc, argv); 9 | 10 | QWidget widget; 11 | widget.resize(300, 200); 12 | 13 | QBoxLayout *layout = new QVBoxLayout(&widget); 14 | 15 | QLineEdit *lineedit = new QLineEdit(&widget, 0); 16 | layout->addWidget(lineedit); 17 | 18 | QTextEdit *textedit = new QTextEdit(&widget, 0); 19 | layout->addWidget(textedit); 20 | 21 | app.setMainWidget(&widget); 22 | widget.show(); 23 | 24 | return app.exec(); 25 | } 26 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = IMdkit src tables themes po 2 | 3 | nabilogodir = @NABI_DATA_DIR@ 4 | nabilogo_DATA = nabi.png nabi.svg nabi-about.png 5 | 6 | testclients = \ 7 | test/Makefile \ 8 | test/xlib.cpp \ 9 | test/gtk.c \ 10 | test/gtk1.c \ 11 | test/qt.cpp 12 | 13 | EXTRA_DIST = config.rpath $(nabilogo_DATA) $(testclients) ChangeLog.0 14 | 15 | .PHONY: log 16 | log: 17 | unset LC_ALL; \ 18 | export LANG=C ; \ 19 | export LC_CTYPE=ko_KR.UTF-8 ; \ 20 | git log --name-status --date=iso > ChangeLog 21 | 22 | dist-hook: 23 | if test -d .git; then \ 24 | unset LC_ALL; \ 25 | export LANG=C ; \ 26 | export LC_CTYPE=ko_KR.UTF-8 ; \ 27 | git log --name-status --date=iso > $(distdir)/ChangeLog ; \ 28 | fi 29 | -------------------------------------------------------------------------------- /IMdkit/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | noinst_LIBRARIES = libXimd.a 3 | 4 | libXimd_a_CFLAGS = $(X_CFLAGS) 5 | 6 | libXimd_a_SOURCES = \ 7 | FrameMgr.c \ 8 | FrameMgr.h \ 9 | IMConn.c \ 10 | IMMethod.c \ 11 | IMValues.c \ 12 | IMdkit.h \ 13 | Xi18n.h \ 14 | Xi18nX.h \ 15 | XimFunc.h \ 16 | XimProto.h \ 17 | i18nAttr.c \ 18 | i18nClbk.c \ 19 | i18nIMProto.c \ 20 | i18nIc.c \ 21 | i18nMethod.c \ 22 | i18nPtHdr.c \ 23 | i18nUtil.c \ 24 | i18nX.c 25 | 26 | EXTRA_DIST = \ 27 | doc/Xi18n_sample/Imakefile \ 28 | doc/Xi18n_sample/IC.c \ 29 | doc/Xi18n_sample/IC.h \ 30 | doc/Xi18n_sample/Makefile.pu \ 31 | doc/Xi18n_sample/README \ 32 | doc/Xi18n_sample/sampleIM.c \ 33 | doc/API.text \ 34 | doc/CHANGELOG \ 35 | doc/README 36 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | bin_PROGRAMS = nabi 3 | nabi_CFLAGS = \ 4 | $(X_CFLAGS) \ 5 | $(GTK_CFLAGS) \ 6 | $(LIBHANGUL_CFLAGS) \ 7 | -DLOCALEDIR=\"$(localedir)\" \ 8 | -DNABI_DATA_DIR=\"$(NABI_DATA_DIR)\" \ 9 | -DNABI_THEMES_DIR=\"$(NABI_THEMES_DIR)\" 10 | 11 | nabi_SOURCES = \ 12 | nabi.h \ 13 | gettext.h \ 14 | xim_protocol.h \ 15 | default-icons.h \ 16 | debug.h debug.c \ 17 | server.h server.c \ 18 | ic.h ic.c \ 19 | fontset.h fontset.c \ 20 | eggtrayicon.h eggtrayicon.c \ 21 | session.h session.c \ 22 | candidate.h candidate.c \ 23 | keycapturedialog.h keycapturedialog.c \ 24 | conf.h conf.c \ 25 | handler.c \ 26 | ui.c \ 27 | preference.h preference.c \ 28 | handlebox.h handlebox.c \ 29 | sctc.h util.h util.c \ 30 | ustring.h ustring.c \ 31 | keyboard-layout.h keyboard-layout.c \ 32 | main.c 33 | 34 | nabi_LDADD = \ 35 | ../IMdkit/libXimd.a \ 36 | $(GTK_LIBS) \ 37 | $(X_LIBS) \ 38 | $(X_PRE_LIBS) \ 39 | -lX11 \ 40 | $(LIBHANGUL_LIBS) 41 | -------------------------------------------------------------------------------- /src/util.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2007-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef nabi_util_h 20 | #define nabi_util_h 21 | 22 | char* nabi_traditional_to_simplified(const char* str); 23 | 24 | #endif // nabi_util_h 25 | -------------------------------------------------------------------------------- /src/preference.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef nabi_preference_h 20 | #define nabi_preference_h 21 | 22 | GtkWidget* preference_window_create(void); 23 | 24 | #endif // nabi_preference_h 25 | -------------------------------------------------------------------------------- /test/gtk1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void on_destroy(GtkWidget *widget, gpointer data) 5 | { 6 | gtk_main_quit(); 7 | } 8 | 9 | int 10 | main(int argc, char *argv[]) 11 | { 12 | GtkWidget *window; 13 | GtkWidget *vbox; 14 | GtkWidget *entry; 15 | GtkWidget *text; 16 | 17 | gtk_set_locale(); 18 | gtk_init(&argc, &argv); 19 | 20 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 21 | gtk_signal_connect(GTK_OBJECT(window), "destroy", 22 | GTK_SIGNAL_FUNC(on_destroy), NULL); 23 | gtk_widget_set_usize(window, 300, 200); 24 | 25 | vbox = gtk_vbox_new(FALSE, 0); 26 | gtk_container_add(GTK_CONTAINER(window), vbox); 27 | 28 | entry = gtk_entry_new(); 29 | gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, TRUE, 0); 30 | 31 | text = gtk_text_new(NULL, NULL); 32 | gtk_text_set_editable(GTK_TEXT(text), TRUE); 33 | gtk_box_pack_start(GTK_BOX(vbox), text, TRUE, TRUE, 0); 34 | 35 | gtk_widget_show_all(window); 36 | 37 | gtk_main(); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /src/session.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef _NABI_SESSION_H 20 | #define _NABI_SESSION_H 21 | 22 | void nabi_session_open(char *previos_id); 23 | void nabi_session_close(void); 24 | 25 | #endif /* _NABI_SESSION_H */ 26 | -------------------------------------------------------------------------------- /src/debug.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2007-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef nabi_debug_h 20 | #define nabi_debug_h 21 | 22 | int nabi_log_get_level(void); 23 | void nabi_log_set_level(int level); 24 | void nabi_log_set_device(const char* device); 25 | void nabi_log(int level, const char* format, ...); 26 | 27 | #endif /* nabi_debug_h */ 28 | -------------------------------------------------------------------------------- /test/gtk.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void on_destroy(GtkWidget *widget, gpointer data) 4 | { 5 | gtk_main_quit(); 6 | } 7 | 8 | int 9 | main(int argc, char *argv[]) 10 | { 11 | GtkWidget *window; 12 | GtkWidget *vbox; 13 | GtkWidget *entry; 14 | GtkWidget *textview; 15 | GtkWidget *scrolled; 16 | 17 | gtk_init(&argc, &argv); 18 | 19 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 20 | g_signal_connect(G_OBJECT(window), "destroy", 21 | G_CALLBACK(on_destroy), NULL); 22 | gtk_window_set_default_size(GTK_WINDOW(window), 300, 200); 23 | 24 | vbox = gtk_vbox_new(FALSE, 0); 25 | gtk_container_add(GTK_CONTAINER(window), vbox); 26 | 27 | entry = gtk_entry_new(); 28 | gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, TRUE, 0); 29 | 30 | textview = gtk_text_view_new(); 31 | 32 | scrolled = gtk_scrolled_window_new(NULL, NULL); 33 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), 34 | GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 35 | gtk_container_add(GTK_CONTAINER(scrolled), textview); 36 | 37 | gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); 38 | 39 | gtk_widget_show_all(window); 40 | 41 | gtk_main(); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /src/keycapturedialog.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef __KEYCAPTUREDIALOG_H_ 20 | #define __KEYCAPTUREDIALOG_H_ 21 | 22 | #include 23 | 24 | GtkWidget* key_capture_dialog_new(const gchar *title, 25 | GtkWindow *parent, 26 | const gchar *key_text, 27 | const gchar *message_format, ...); 28 | G_CONST_RETURN gchar * key_capture_dialog_get_key_text(GtkWidget *dialog); 29 | 30 | #endif /* __KEYCAPTUREDIALOG_H_ */ 31 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | CFLAGS = -I/usr/X11R6/include -Wall -g 4 | CXXFLAGS = -I/usr/X11R6/include -Wall -g 5 | LIBS = -L/usr/X11R6/lib -lX11 6 | 7 | QT3_CXXFLAGS = -I$(QTDIR)/include 8 | QT3_LIBS = -L$(QTDIR)/lib -lqt-mt 9 | 10 | QT4_CXXFLAGS = $(shell pkg-config --cflags QtGui) 11 | QT4_LIBS = $(shell pkg-config --libs QtGui) 12 | 13 | GTK1_CFLAGS = $(shell gtk--config --cflags) 14 | GTK1_LIBS = $(shell gtk--config --libs) 15 | 16 | GTK2_CFLAGS = $(shell pkg-config --cflags gtk+-2.0) 17 | GTK2_LIBS = $(shell pkg-config --libs gtk+-2.0) 18 | 19 | GTK3_CFLAGS = $(shell pkg-config --cflags gtk+-3.0) 20 | GTK3_LIBS = $(shell pkg-config --libs gtk+-3.0) 21 | 22 | all: xlib gtk2 gtk3 qt4 xim_filter.so 23 | 24 | clean: 25 | rm -f xlib gtk1 gtk2 gtk3 qt3 qt4 26 | 27 | xlib: xlib.cpp 28 | g++ $(CXXFLAGS) xlib.cpp -o xlib $(LIBS) 29 | 30 | gtk1: gtk1.c 31 | gcc -Wall -g `gtk-config --cflags --libs` gtk1.c -o gtk1 32 | 33 | gtk2: gtk.c 34 | gcc -Wall -g $(GTK2_CFLAGS) $< -o $@ $(GTK2_LIBS) 35 | 36 | gtk3: gtk.c 37 | gcc -Wall -g $(GTK3_CFLAGS) $< -o $@ $(GTK3_LIBS) 38 | 39 | qt3: qt.cpp 40 | g++ -Wall -g $(QT3_CXXFLAGS) $< -o $@ $(QT3_LIBS) 41 | 42 | xim_filter.so: xim_filter.c 43 | gcc -Wall -g -shared -fPIC xim_filter.c -o xim_filter.so -ldl 44 | 45 | qt4: qt4.cpp 46 | g++ -Wall -g -O0 $(QT4_CXXFLAGS) $< -o $@ $(QT4_LIBS) 47 | -------------------------------------------------------------------------------- /src/fontset.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef _FONTSET_H 20 | #define _FONTSET_H 21 | 22 | struct _NabiFontSet { 23 | XFontSet xfontset; 24 | char *name; 25 | int ascent; 26 | int descent; 27 | int ref; 28 | }; 29 | 30 | typedef struct _NabiFontSet NabiFontSet; 31 | 32 | NabiFontSet* nabi_fontset_create (Display *display, const char *fontset_name); 33 | void nabi_fontset_free (Display *display, XFontSet xfontset); 34 | void nabi_fontset_free_all (Display *display); 35 | 36 | #endif /* _FONTSET_H */ 37 | -------------------------------------------------------------------------------- /src/keyboard-layout.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2011 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef nabi_keyboard_layout_h 20 | #define nabi_keyboard_layout_h 21 | 22 | #include 23 | #include 24 | 25 | typedef struct _NabiKeyboardLayout NabiKeyboardLayout; 26 | 27 | struct _NabiKeyboardLayout { 28 | char* name; 29 | GArray* table; 30 | }; 31 | 32 | NabiKeyboardLayout* nabi_keyboard_layout_new(const char* name); 33 | void nabi_keyboard_layout_free(gpointer data, gpointer user_data); 34 | 35 | void nabi_keyboard_layout_append(NabiKeyboardLayout* layout, 36 | KeySym key, KeySym value); 37 | KeySym nabi_keyboard_layout_get_key(NabiKeyboardLayout* layout, KeySym keysym); 38 | 39 | #endif /* nabi_keyboard_layout_h */ 40 | -------------------------------------------------------------------------------- /tables/compose/default: -------------------------------------------------------------------------------- 1 | # test compose map file for Nabi 2 | [default] 3 | 1100 1100 1101 # choseong kiyeok + kiyeok = ssangkiyeok 4 | 1103 1103 1104 # choseong tikeut + tikeut = ssangtikeut 5 | 1107 1107 1108 # choseong pieup + pieup = ssangpieup 6 | 1109 1109 110a # choseong sios + sios = ssangsios 7 | 110c 110c 110d # choseong cieuc + cieuc = ssangcieuc 8 | 1169 1161 116a # jungseong o + a = wa 9 | 1169 1162 116b # jungseong o + ae = wae 10 | 1169 1175 116c # jungseong o + i = oe 11 | 116e 1165 116f # jungseong u + eo = weo 12 | 116e 1166 1170 # jungseong u + e = we 13 | 116e 1175 1171 # jungseong u + i = wi 14 | 1173 1175 1174 # jungseong eu + i = yi 15 | 11a8 11a8 11a9 # jongseong kiyeok + kiyeok = ssangekiyeok 16 | 11a8 11ba 11aa # jongseong kiyeok + sios = kiyeok-sois 17 | 11ab 11bd 11ac # jongseong nieun + cieuc = nieun-cieuc 18 | 11ab 11c2 11ad # jongseong nieun + hieuh = nieun-hieuh 19 | 11af 11a8 11b0 # jongseong rieul + kiyeok = rieul-kiyeok 20 | 11af 11b7 11b1 # jongseong rieul + mieum = rieul-mieum 21 | 11af 11b8 11b2 # jongseong rieul + pieup = rieul-pieup 22 | 11af 11ba 11b3 # jongseong rieul + sios = rieul-sios 23 | 11af 11c0 11b4 # jongseong rieul + thieuth = rieul-thieuth 24 | 11af 11c1 11b5 # jongseong rieul + phieuph = rieul-phieuph 25 | 11af 11c2 11b6 # jongseong rieul + hieuh = rieul-hieuh 26 | 11b8 11ba 11b9 # jongseong pieup + sios = pieup-sios 27 | 11ba 11ba 11bb # jongseong sios + sios = ssangsios 28 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Nabi 나비 2 | ========= 3 | 4 | nabi는 System Tray(Notification Area)를 지원하는 GTK+로 개발된 X Window의 5 | 한글 입력기(XIM)입니다. 6 | 7 | 프로젝트 사이트: 8 | https://github.com/libhangul/nabi/wiki 9 | 10 | 기능과 특징 11 | * 두벌식, 세벌식최종, 세벌식390 자판 지원 12 | * libhangul을 이용하여 한자의 뜻까지 보여줌 13 | * Notification Area에 embed됨 14 | * imhangul의 한영 상태로 같이 나타냄 15 | 16 | 소스 17 | nabi의 소스는 여기에서 관리하지 않고 GitHub에서 관리하고 있습니다. 18 | 다음 명령으로 소스를 받으실 수 있습니다. 19 | 20 | $ git clone https://github.com/libhangul/nabi.git nabi 21 | 22 | 또는 https://github.com/libhangul/nabi 여기서 웹으로 브라우징해 볼 수 있습니다. 23 | 24 | 빌드 25 | 빌드 방법은 보통의 GNU build system을 사용한 오픈 소스 패키지와 동일합니다. 26 | 27 | (github 에서 소스를 다운 받은 경우 ./autogen.sh를 실행하여 configure를 생성합니다.) 28 | $ ./autogen.sh 29 | 30 | $ ./configure --prefix=$PREFIX 31 | $ make 32 | # make install 33 | 34 | XIM으로 사용하기 위해서는 XMODIFIERS 환경 변수가 필요합니다. 35 | 아래와 같이 설정하면 사용할 수 있습니다. 36 | 37 | export XMODIFIERS="@im=nabi" 38 | 39 | 그러나 이런 환경 변수 설정을 유효하게 하는 것은 일반 사용자에게는 상당히 40 | 까다로운 일로 배포판에서 제공하는 설정방법을 사용하시길 추천합니다. 41 | 42 | 최근의 많은 배포판들은 im-switch를 가지고 있으므로 im-switch를 이용하여 43 | 설정하는 것이 편리합니다. 44 | 45 | $ im-switch -s nabi 46 | 47 | 이 명령을 실행하여 설정하면 됩니다. 48 | 49 | ------------------------ 50 | For non-korean users. 51 | 52 | You should set XMODIFIERS environment variable before launching any XIM-aware 53 | application. 54 | 55 | export XMODIFIERS="@im=nabi" 56 | 57 | Put the line above in xinit script file, ie, ~/.xsession. 58 | See xinit man page. 59 | 60 | If you use debian, it is easy to use im-switcher. 61 | Install im-switch, and run it like below: 62 | 63 | $ im-switch -s nabi 64 | -------------------------------------------------------------------------------- /src/ustring.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef nabi_ustring_h 20 | #define nabi_ustring_h 21 | 22 | #include 23 | #include 24 | 25 | typedef GArray UString; 26 | 27 | UString* ustring_new(); 28 | void ustring_delete(UString* str); 29 | 30 | void ustring_clear(UString* str); 31 | UString* ustring_erase(UString* str, guint pos, guint len); 32 | 33 | ucschar* ustring_begin(UString* str); 34 | ucschar* ustring_end(UString* str); 35 | guint ustring_length(const UString* str); 36 | 37 | UString* ustring_append(UString* str, const UString* s); 38 | UString* ustring_append_ucs4(UString* str, const ucschar* s, gint len); 39 | UString* ustring_append_utf8(UString* str, const char* utf8); 40 | 41 | gchar* ustring_to_utf8(const UString* str, guint len); 42 | 43 | #endif // nabi_ustring_h 44 | -------------------------------------------------------------------------------- /src/debug.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2007-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "debug.h" 24 | 25 | static FILE* output_device = NULL; 26 | static int log_level = 0; 27 | 28 | void 29 | nabi_log_set_level(int level) 30 | { 31 | log_level = level; 32 | } 33 | 34 | int 35 | nabi_log_get_level(void) 36 | { 37 | return log_level; 38 | } 39 | 40 | void 41 | nabi_log_set_device(const char* device) 42 | { 43 | if (strcmp(device, "stdout") == 0) { 44 | output_device = stdout; 45 | } else if (strcmp(device, "stderr") == 0) { 46 | output_device = stderr; 47 | } 48 | } 49 | 50 | void 51 | nabi_log(int level, const char* format, ...) 52 | { 53 | if (output_device == NULL) 54 | return; 55 | 56 | if (level <= log_level) { 57 | va_list ap; 58 | 59 | fprintf(output_device, "Nabi(%d): ", level); 60 | 61 | va_start(ap, format); 62 | vfprintf(output_device, format, ap); 63 | va_end(ap); 64 | 65 | fflush(output_device); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tables/candidate/hanja-to-c.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | # A tool for merging commented hanja dictionary file with new hanja template 5 | # file 6 | 7 | import sys, string 8 | 9 | if len(sys.argv) == 1: 10 | print 'Usage: hanja-merge [commented files]...' 11 | sys.exit(1) 12 | 13 | table = { } 14 | for file_name in sys.argv[1:]: 15 | try: 16 | file = open(file_name, 'r') 17 | except: 18 | sys.stderr.write("Cant open file: %s\n" % file_name) 19 | sys.exit(1) 20 | 21 | # load the table 22 | category = '' 23 | for line in file.readlines(): 24 | line = line.strip() 25 | 26 | if len(line) == 0: 27 | continue 28 | 29 | if line[0] == '[': 30 | category = line[1:].split(']')[0] 31 | table[category] = {} 32 | table[category]['keylist'] = [] 33 | else: 34 | if category == '': 35 | continue 36 | 37 | list = line.strip().split('=') 38 | key = list[0] 39 | value = list[1] 40 | table[category][key] = value 41 | table[category]['keylist'].append(key) 42 | file.close() 43 | 44 | # print the table 45 | categories = table.keys() 46 | categories.sort() 47 | for category in categories: 48 | print 'static const CandidateItem item_%04x[] = {' % ord(category.decode('utf-8')) 49 | print ' { 0x%04x, \"%s\" },' % (ord(category.decode('utf-8')), category) 50 | keys = table[category]['keylist'] 51 | for key in keys: 52 | print ' { 0x%04x, /*%s*/ \"%s\" },' % (ord(key.decode('utf-8')), key, table[category][key]) 53 | continue 54 | print ' { 0x0, \"\" }' 55 | print '};' 56 | print '' 57 | 58 | print 'static const CandidateItem *candidate_table[] = {' 59 | sys.stdout.write(' ') 60 | i = 1 61 | for category in categories[:-1]: 62 | sys.stdout.write('item_%04x, ' % ord(category.decode('utf-8'))) 63 | if i % 4 == 0: 64 | sys.stdout.write('\n ') 65 | i = i + 1 66 | 67 | sys.stdout.write('item_%04x\n' % ord(categories[-1].decode('utf-8'))) 68 | print '};' 69 | -------------------------------------------------------------------------------- /src/util.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2007-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | #include "debug.h" 23 | 24 | typedef struct _NabiUnicharPair NabiUnicharPair; 25 | struct _NabiUnicharPair { 26 | gunichar first; 27 | gunichar second; 28 | }; 29 | 30 | #include 31 | 32 | static 33 | int pair_compare(const void* x, const void* y) 34 | { 35 | const NabiUnicharPair* a = x; 36 | const NabiUnicharPair* b = y; 37 | return a->first - b->first; 38 | } 39 | 40 | char* 41 | nabi_traditional_to_simplified(const char* str) 42 | { 43 | GString* ret; 44 | 45 | if (str == NULL) 46 | return NULL; 47 | 48 | ret = g_string_new(NULL); 49 | 50 | while (*str != '\0') { 51 | gunichar c = g_utf8_get_char(str); 52 | NabiUnicharPair key = { c, 0 }; 53 | NabiUnicharPair* res; 54 | res = bsearch(&key, 55 | nabi_tc_to_sc_table, 56 | G_N_ELEMENTS(nabi_tc_to_sc_table), 57 | sizeof(NabiUnicharPair), pair_compare); 58 | if (res == NULL) { 59 | g_string_append_unichar(ret, c); 60 | } else { 61 | nabi_log(3, "tc -> sc: %x -> %x\n", res->first, res->second); 62 | g_string_append_unichar(ret, res->second); 63 | } 64 | 65 | str = g_utf8_next_char(str); 66 | } 67 | 68 | return g_string_free(ret, FALSE); 69 | } 70 | -------------------------------------------------------------------------------- /tables/keyboard/2qwerty: -------------------------------------------------------------------------------- 1 | # this file is test keyboard map file for Nabi 2 | Name: 2 set 3 | Type2 4 | 5 | U0041 U1106 # XK_A: choseong mieum 6 | U0042 U1172 # XK_B: jungseong yu 7 | U0043 U110e # XK_C: choseong chieuch 8 | U0044 U110b # XK_D: choseong ieung 9 | U0045 U1104 # XK_E: choseong ssangtikeut 10 | U0046 U1105 # XK_F: choseong rieul 11 | U0047 U1112 # XK_G: choseong hieuh 12 | U0048 U1169 # XK_H: jungseong o 13 | U0049 U1163 # XK_I: jungseong ya 14 | U004a U1165 # XK_J: jungseong eo 15 | U004b U1161 # XK_K: jungseong a 16 | U004c U1175 # XK_L: jungseong i 17 | U004d U1173 # XK_M: jungseong eu 18 | U004e U116e # XK_N: jungseong u 19 | U004f U1164 # XK_O: jungseong yae 20 | U0050 U1168 # XK_P: jungseong ye 21 | U0051 U1108 # XK_Q: choseong ssangpieup 22 | U0052 U1101 # XK_R: choseong ssangkiyeok 23 | U0053 U1102 # XK_S: choseong nieun 24 | U0054 U110a # XK_T: choseong ssangsios 25 | U0055 U1167 # XK_U: jungseong yeo 26 | U0056 U1111 # XK_V: choseong phieuph 27 | U0057 U110d # XK_W: choseong ssangcieuc 28 | U0058 U1110 # XK_X: choseong thieuth 29 | U0059 U116d # XK_Y: jungseong yo 30 | U005a U110f # XK_Z: choseong khieukh 31 | 32 | U0061 U1106 # XK_a: choseong mieum 33 | U0062 U1172 # XK_b: jungseong yu 34 | U0063 U110e # XK_c: choseong chieuch 35 | U0064 U110b # XK_d: choseong ieung 36 | U0065 U1103 # XK_e: choseong tikeut 37 | U0066 U1105 # XK_f: choseong rieul 38 | U0067 U1112 # XK_g: choseong hieuh 39 | U0068 U1169 # XK_h: jungseong o 40 | U0069 U1163 # XK_i: jungseong ya 41 | U006a U1165 # XK_j: jungseong eo 42 | U006b U1161 # XK_k: jungseong a 43 | U006c U1175 # XK_l: jungseong i 44 | U006d U1173 # XK_m: jungseong eu 45 | U006e U116e # XK_n: jungseong u 46 | U006f U1162 # XK_o: jungseong ae 47 | U0070 U1166 # XK_p: jungseong e 48 | U0071 U1107 # XK_q: choseong pieup 49 | U0072 U1100 # XK_r: choseong kiyeok 50 | U0073 U1102 # XK_s: choseong nieun 51 | U0074 U1109 # XK_t: choseong sios 52 | U0075 U1167 # XK_u: jungseong yeo 53 | U0076 U1111 # XK_v: choseong phieuph 54 | U0077 U110c # XK_w: choseong cieuc 55 | U0078 U1110 # XK_x: choseong thieuth 56 | U0079 U116d # XK_y: jungseong yo 57 | U007a U110f # XK_z: choseong khieukh 58 | -------------------------------------------------------------------------------- /src/handlebox.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef __NABI_HANDLE_BOX_H__ 20 | #define __NABI_HANDLE_BOX_H__ 21 | 22 | 23 | #include 24 | 25 | 26 | G_BEGIN_DECLS 27 | 28 | #define NABI_TYPE_HANDLE_BOX (nabi_handle_box_get_type ()) 29 | #define NABI_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NABI_TYPE_HANDLE_BOX, NabiHandleBox)) 30 | #define NABI_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NABI_TYPE_HANDLE_BOX, NabiHandleBoxClass)) 31 | #define NABI_IS_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NABI_TYPE_HANDLE_BOX)) 32 | #define NABI_IS_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NABI_TYPE_HANDLE_BOX)) 33 | #define NABI_HANDLE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NABI_TYPE_HANDLE_BOX, NabiHandleBoxClass)) 34 | 35 | 36 | typedef struct _NabiHandleBox NabiHandleBox; 37 | typedef struct _NabiHandleBoxClass NabiHandleBoxClass; 38 | 39 | struct _NabiHandleBox { 40 | GtkWindow parent; 41 | }; 42 | 43 | struct _NabiHandleBoxClass { 44 | GtkWindowClass parent_class; 45 | }; 46 | 47 | 48 | GType nabi_handle_box_get_type (void) G_GNUC_CONST; 49 | GtkWidget* nabi_handle_box_new (void); 50 | 51 | G_END_DECLS 52 | 53 | #endif /* __NABI_HANDLE_BOX_H__ */ 54 | -------------------------------------------------------------------------------- /IMdkit/Xi18nX.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #ifndef _Xi18nTrX_h 33 | #define _Xi18nTrX_h 34 | 35 | #define _XIM_PROTOCOL "_XIM_PROTOCOL" 36 | #define _XIM_XCONNECT "_XIM_XCONNECT" 37 | 38 | #define XCM_DATA_LIMIT 20 39 | 40 | typedef struct _XClient 41 | { 42 | Window client_win; /* client window */ 43 | Window accept_win; /* accept window */ 44 | } XClient; 45 | 46 | typedef struct 47 | { 48 | Atom xim_request; 49 | Atom connect_request; 50 | } XSpecRec; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /tables/candidate/hanja-merge.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | # A tool for merging commented hanja dictionary file with new hanja template 5 | # file 6 | 7 | import sys, string 8 | 9 | if len(sys.argv) == 3: 10 | old_file_name = sys.argv[1] 11 | new_file_name = sys.argv[2] 12 | else: 13 | print 'Usage: hanja-merge [commented file] [new template]' 14 | sys.exit(1) 15 | 16 | try: 17 | old_file = open(old_file_name, 'r') 18 | except: 19 | sys.stderr.write("Cant open file: %s\n" % old_file_name) 20 | sys.exit(1) 21 | try: 22 | new_file = open(new_file_name, 'r') 23 | except: 24 | sys.stderr.write("Cant open file: %s\n" % new_file_name) 25 | sys.exit(1) 26 | 27 | old_table = { } 28 | new_table = { } 29 | 30 | category = '' 31 | for line in old_file.readlines(): 32 | line = line.strip() 33 | 34 | if len(line) == 0: 35 | continue 36 | 37 | if line[0] == '[': 38 | category = line[1:].split(']')[0] 39 | old_table[category] = {} 40 | else: 41 | if category == '': 42 | continue 43 | 44 | list = line.strip().split('=') 45 | key = list[0] 46 | value = list[1] 47 | old_table[category][key] = value 48 | 49 | category = '' 50 | for line in new_file.readlines(): 51 | line = line.strip() 52 | 53 | if len(line) == 0: 54 | continue 55 | 56 | if line[0] == '[': 57 | category = line[1:].split(']')[0] 58 | new_table[category] = {} 59 | else: 60 | if category == '': 61 | continue 62 | 63 | key = line.strip().split('=')[0] 64 | if old_table.has_key(category) and old_table[category].has_key(key): 65 | value = old_table[category].pop(key) 66 | else: 67 | value = '' 68 | new_table[category][key] = value 69 | 70 | list = new_table.keys() 71 | list.sort() 72 | 73 | # print merged result 74 | for category in list: 75 | print '[' + category + ']' 76 | keys = new_table[category].keys() 77 | keys.sort() 78 | for key in keys: 79 | print key + '=' + new_table[category][key] 80 | 81 | # print rest 82 | for category in old_table.keys(): 83 | if len(old_table[category]) == 0: 84 | continue 85 | 86 | sys.stderr.write('[' + category + ']\n') 87 | keys = old_table[category].keys() 88 | for key in keys: 89 | sys.stderr.write(key + '=' + old_table[category][key] + '\n') 90 | 91 | -------------------------------------------------------------------------------- /src/nabi.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2009 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef __NABI_H_ 20 | #define __NABI_H_ 21 | 22 | #include 23 | #include 24 | 25 | #include "conf.h" 26 | 27 | typedef struct _NabiApplication NabiApplication; 28 | 29 | struct _NabiApplication { 30 | gchar* xim_name; 31 | 32 | GtkWidget* palette; 33 | GtkWidget* keyboard_button; 34 | GtkWidget* tray_icon; 35 | gboolean status_only; 36 | gchar* session_id; 37 | 38 | int icon_size; 39 | 40 | /* hangul status data */ 41 | GdkWindow *root_window; 42 | GdkAtom mode_info_atom; 43 | GdkAtom mode_info_type; 44 | Atom mode_info_xatom; 45 | 46 | /* config data */ 47 | NabiConfig* config; 48 | }; 49 | 50 | extern NabiApplication* nabi; 51 | 52 | void nabi_app_new(void); 53 | void nabi_app_init(int *argc, char ***argv); 54 | void nabi_app_setup_server(void); 55 | void nabi_app_quit(void); 56 | void nabi_app_free(void); 57 | void nabi_app_save_config(void); 58 | void nabi_app_set_theme(const char *name); 59 | void nabi_app_use_tray_icon(gboolean use); 60 | void nabi_app_show_palette(gboolean state); 61 | void nabi_app_set_hanja_mode(gboolean state); 62 | void nabi_app_set_hangul_keyboard(const char *id); 63 | 64 | GtkWidget* nabi_app_create_palette(void); 65 | 66 | #endif /* __NABI_H_ */ 67 | /* vim: set ts=8 sw=4 : */ 68 | -------------------------------------------------------------------------------- /themes/Makefile.am: -------------------------------------------------------------------------------- 1 | simplyreddir= ${NABI_THEMES_DIR}/SimplyRed 2 | simplyred_DATA = \ 3 | SimplyRed/english.png \ 4 | SimplyRed/hangul.png \ 5 | SimplyRed/none.png 6 | 7 | oniondir= ${NABI_THEMES_DIR}/Onion 8 | onion_DATA = \ 9 | Onion/README \ 10 | Onion/english.png \ 11 | Onion/hangul.png \ 12 | Onion/none.png 13 | 14 | keyboarddir= ${NABI_THEMES_DIR}/keyboard 15 | keyboard_DATA = \ 16 | keyboard/README \ 17 | keyboard/english.png \ 18 | keyboard/hangul.png \ 19 | keyboard/none.png 20 | 21 | kingsejongdir= ${NABI_THEMES_DIR}/KingSejong 22 | kingsejong_DATA = \ 23 | KingSejong/README \ 24 | KingSejong/english.png \ 25 | KingSejong/hangul.png \ 26 | KingSejong/none.png 27 | 28 | kingsejong2dir= ${NABI_THEMES_DIR}/KingSejong2 29 | kingsejong2_DATA = \ 30 | KingSejong2/README \ 31 | KingSejong2/english.png \ 32 | KingSejong2/hangul.png \ 33 | KingSejong2/none.png 34 | 35 | tuxdir= ${NABI_THEMES_DIR}/Tux 36 | tux_DATA = \ 37 | Tux/README \ 38 | Tux/english.png \ 39 | Tux/hangul.png \ 40 | Tux/none.png 41 | 42 | jinidir= ${NABI_THEMES_DIR}/Jini 43 | jini_DATA = \ 44 | Jini/README \ 45 | Jini/english.png \ 46 | Jini/hangul.png \ 47 | Jini/none.png \ 48 | Jini/english.svg \ 49 | Jini/hangul.svg \ 50 | Jini/none.svg 51 | 52 | ubuntu_mono_darkdir = ${NABI_THEMES_DIR}/ubuntu-mono-dark 53 | ubuntu_mono_dark_DATA = \ 54 | ubuntu-mono-dark/README \ 55 | ubuntu-mono-dark/english.png \ 56 | ubuntu-mono-dark/hangul.png \ 57 | ubuntu-mono-dark/none.png 58 | 59 | ubuntu_mono_lightdir = ${NABI_THEMES_DIR}/ubuntu-mono-light 60 | ubuntu_mono_light_DATA = \ 61 | ubuntu-mono-light/README \ 62 | ubuntu-mono-light/english.png \ 63 | ubuntu-mono-light/hangul.png \ 64 | ubuntu-mono-light/none.png 65 | 66 | malysdir = $(NABI_THEMES_DIR)/malys 67 | malys_DATA = \ 68 | malys/README \ 69 | malys/english.png \ 70 | malys/hangul.png \ 71 | malys/none.png \ 72 | $(NULL) 73 | 74 | EXTRA_DIST = \ 75 | $(simplyred_DATA) \ 76 | $(onion_DATA) \ 77 | $(keyboard_DATA) \ 78 | $(kingsejong_DATA) \ 79 | $(kingsejong2_DATA) \ 80 | $(tux_DATA) \ 81 | $(jini_DATA) \ 82 | $(ubuntu_mono_dark_DATA) \ 83 | $(ubuntu_mono_light_DATA) \ 84 | $(malys_DATA) \ 85 | $(NULL) 86 | -------------------------------------------------------------------------------- /src/conf.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2007-2009 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef nabi_conf_h 20 | #define nabi_conf_h 21 | 22 | #include 23 | 24 | typedef struct _NabiConfig NabiConfig; 25 | 26 | struct _NabiConfig { 27 | gint x; 28 | gint y; 29 | 30 | GString* theme; 31 | gint palette_height; 32 | gboolean show_palette; 33 | gboolean use_tray_icon; 34 | 35 | GString* trigger_keys; 36 | GString* off_keys; 37 | GString* candidate_keys; 38 | 39 | /* keyboard option */ 40 | GString* hangul_keyboard; 41 | GString* latin_keyboard; 42 | GString* keyboard_layouts_file; 43 | 44 | /* xim server option */ 45 | GString* xim_name; 46 | GString* output_mode; 47 | GString* default_input_mode; 48 | GString* input_mode_scope; 49 | gboolean use_dynamic_event_flow; 50 | gboolean commit_by_word; 51 | gboolean auto_reorder; 52 | gboolean use_simplified_chinese; 53 | gboolean hanja_mode; 54 | gboolean ignore_app_fontset; 55 | gboolean use_system_keymap; 56 | 57 | /* candidate options */ 58 | GString* candidate_font; 59 | GString* candidate_format; 60 | 61 | /* preedit attribute */ 62 | GString* preedit_font; 63 | GString* preedit_fg; 64 | GString* preedit_bg; 65 | }; 66 | 67 | NabiConfig* nabi_config_new(); 68 | void nabi_config_delete(NabiConfig* config); 69 | void nabi_config_load(NabiConfig* config); 70 | void nabi_config_save(NabiConfig* config); 71 | 72 | #endif /* nabi_config_h */ 73 | -------------------------------------------------------------------------------- /src/keyboard-layout.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2011 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #include 24 | 25 | #include "keyboard-layout.h" 26 | 27 | struct KeySymPair { 28 | KeySym key; 29 | KeySym value; 30 | }; 31 | 32 | NabiKeyboardLayout* 33 | nabi_keyboard_layout_new(const char* name) 34 | { 35 | NabiKeyboardLayout* layout = g_new(NabiKeyboardLayout, 1); 36 | layout->name = g_strdup(name); 37 | layout->table = NULL; 38 | return layout; 39 | } 40 | 41 | static int 42 | nabi_keyboard_layout_cmp(const void* a, const void* b) 43 | { 44 | const struct KeySymPair* pair1 = a; 45 | const struct KeySymPair* pair2 = b; 46 | return pair1->key - pair2->key; 47 | } 48 | 49 | void 50 | nabi_keyboard_layout_append(NabiKeyboardLayout* layout, 51 | KeySym key, KeySym value) 52 | { 53 | struct KeySymPair item = { key, value }; 54 | if (layout->table == NULL) 55 | layout->table = g_array_new(FALSE, FALSE, sizeof(struct KeySymPair)); 56 | g_array_append_vals(layout->table, &item, 1); 57 | } 58 | 59 | KeySym 60 | nabi_keyboard_layout_get_key(NabiKeyboardLayout* layout, KeySym keysym) 61 | { 62 | if (layout->table != NULL) { 63 | struct KeySymPair key = { keysym, 0 }; 64 | struct KeySymPair* ret; 65 | ret = bsearch(&key, layout->table->data, layout->table->len, 66 | sizeof(key), nabi_keyboard_layout_cmp); 67 | if (ret) { 68 | return ret->value; 69 | } 70 | } 71 | 72 | return keysym; 73 | } 74 | 75 | void 76 | nabi_keyboard_layout_free(gpointer data, gpointer user_data) 77 | { 78 | NabiKeyboardLayout *layout = data; 79 | g_free(layout->name); 80 | if (layout->table != NULL) 81 | g_array_free(layout->table, TRUE); 82 | g_free(layout); 83 | } 84 | -------------------------------------------------------------------------------- /IMdkit/IMMethod.c: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #include 33 | #include "IMdkit.h" 34 | 35 | /* Public Function */ 36 | void IMForwardEvent (XIMS ims, XPointer call_data) 37 | { 38 | (ims->methods->forwardEvent) (ims, call_data); 39 | } 40 | 41 | void IMCommitString (XIMS ims, XPointer call_data) 42 | { 43 | (ims->methods->commitString) (ims, call_data); 44 | } 45 | 46 | int IMCallCallback (XIMS ims, XPointer call_data) 47 | { 48 | return (ims->methods->callCallback) (ims, call_data); 49 | } 50 | 51 | int IMPreeditStart (XIMS ims, XPointer call_data) 52 | { 53 | return (ims->methods->preeditStart) (ims, call_data); 54 | } 55 | 56 | int IMPreeditEnd (XIMS ims, XPointer call_data) 57 | { 58 | return (ims->methods->preeditEnd) (ims, call_data); 59 | } 60 | 61 | int IMSyncXlib(XIMS ims, XPointer call_data) 62 | { 63 | ims->sync = True; 64 | return (ims->methods->syncXlib) (ims, call_data); 65 | } 66 | -------------------------------------------------------------------------------- /src/ustring.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #include "ustring.h" 20 | 21 | UString* 22 | ustring_new() 23 | { 24 | return g_array_new(TRUE, TRUE, sizeof(ucschar)); 25 | } 26 | 27 | void 28 | ustring_delete(UString* str) 29 | { 30 | g_array_free(str, TRUE); 31 | } 32 | 33 | void 34 | ustring_clear(UString* str) 35 | { 36 | if (str->len > 0) 37 | g_array_remove_range(str, 0, str->len); 38 | } 39 | 40 | UString* 41 | ustring_erase(UString* str, guint pos, guint len) 42 | { 43 | return g_array_remove_range(str, pos, len); 44 | } 45 | 46 | ucschar* 47 | ustring_begin(UString* str) 48 | { 49 | return (ucschar*)str->data; 50 | } 51 | 52 | ucschar* 53 | ustring_end(UString* str) 54 | { 55 | return &g_array_index(str, ucschar, str->len); 56 | } 57 | 58 | guint 59 | ustring_length(const UString* str) 60 | { 61 | return str->len; 62 | } 63 | 64 | UString* 65 | ustring_append(UString* str, const UString* s) 66 | { 67 | return g_array_append_vals(str, s->data, s->len); 68 | } 69 | 70 | UString* 71 | ustring_append_ucs4(UString* str, const ucschar* s, gint len) 72 | { 73 | if (len < 0) { 74 | const ucschar*p = s; 75 | while (*p != 0) 76 | p++; 77 | len = p - s; 78 | } 79 | 80 | return g_array_append_vals(str, s, len); 81 | } 82 | 83 | UString* 84 | ustring_append_utf8(UString* str, const char* utf8) 85 | { 86 | while (*utf8 != '\0') { 87 | ucschar c = g_utf8_get_char(utf8); 88 | g_array_append_vals(str, &c, 1); 89 | utf8 = g_utf8_next_char(utf8); 90 | } 91 | return str; 92 | } 93 | 94 | gchar* 95 | ustring_to_utf8(const UString* str, guint len) 96 | { 97 | if (len < 0) 98 | len = str->len; 99 | return g_ucs4_to_utf8((const gunichar*)str->data, len, NULL, NULL, NULL); 100 | } 101 | -------------------------------------------------------------------------------- /src/candidate.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2009 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef _NABICANDIDATE_H_ 20 | #define _NABICANDIDATE_H_ 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | typedef struct _NabiCandidate NabiCandidate; 28 | typedef void (*NabiCandidateCommitFunc)(NabiCandidate*, const Hanja*, gpointer); 29 | 30 | struct _NabiCandidate { 31 | GtkWidget *window; 32 | Window parent; 33 | GtkLabel *label; 34 | GtkListStore *store; 35 | GtkWidget *treeview; 36 | const Hanja **data; 37 | NabiCandidateCommitFunc commit; 38 | gpointer commit_data; 39 | int first; 40 | int n; 41 | int n_per_page; 42 | int current; 43 | HanjaList *hanja_list; 44 | }; 45 | 46 | NabiCandidate* nabi_candidate_new(const char *label_str, 47 | int n_per_page, 48 | HanjaList* list, 49 | const Hanja** valid_list, 50 | int valid_list_length, 51 | Window parent, 52 | NabiCandidateCommitFunc commit, 53 | gpointer commit_data); 54 | void nabi_candidate_prev(NabiCandidate *candidate); 55 | void nabi_candidate_next(NabiCandidate *candidate); 56 | void nabi_candidate_prev_row(NabiCandidate *candidate); 57 | void nabi_candidate_next_row(NabiCandidate *candidate); 58 | void nabi_candidate_prev_page(NabiCandidate *candidate); 59 | void nabi_candidate_next_page(NabiCandidate *candidate); 60 | const Hanja* nabi_candidate_get_current(NabiCandidate *candidate); 61 | const Hanja* nabi_candidate_get_nth(NabiCandidate *candidate, int n); 62 | void nabi_candidate_delete(NabiCandidate *candidate); 63 | void nabi_candidate_set_hanja_list(NabiCandidate *candidate, 64 | HanjaList* list, 65 | const Hanja** valid_list, 66 | int valid_list_length); 67 | 68 | #endif /* _NABICANDIDATE_H_ */ 69 | -------------------------------------------------------------------------------- /src/eggtrayicon.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | /* eggtrayicon.h 3 | * Copyright (C) 2002 Anders Carlsson 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the 17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | * Boston, MA 02111-1307, USA. 19 | */ 20 | 21 | #ifndef __EGG_TRAY_ICON_H__ 22 | #define __EGG_TRAY_ICON_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ()) 30 | #define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon)) 31 | #define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) 32 | #define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON)) 33 | #define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON)) 34 | #define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) 35 | 36 | typedef struct _EggTrayIcon EggTrayIcon; 37 | typedef struct _EggTrayIconClass EggTrayIconClass; 38 | 39 | struct _EggTrayIcon 40 | { 41 | GtkPlug parent_instance; 42 | 43 | guint stamp; 44 | 45 | Atom selection_atom; 46 | Atom manager_atom; 47 | Atom system_tray_opcode_atom; 48 | Atom orientation_atom; 49 | Window manager_window; 50 | 51 | GtkOrientation orientation; 52 | }; 53 | 54 | struct _EggTrayIconClass 55 | { 56 | GtkPlugClass parent_class; 57 | }; 58 | 59 | GType egg_tray_icon_get_type (void); 60 | 61 | EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen, 62 | const gchar *name); 63 | 64 | EggTrayIcon *egg_tray_icon_new (const gchar *name); 65 | 66 | guint egg_tray_icon_send_message (EggTrayIcon *icon, 67 | gint timeout, 68 | const char *message, 69 | gint len); 70 | void egg_tray_icon_cancel_message (EggTrayIcon *icon, 71 | guint id); 72 | 73 | GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon); 74 | 75 | G_END_DECLS 76 | 77 | #endif /* __EGG_TRAY_ICON_H__ */ 78 | -------------------------------------------------------------------------------- /IMdkit/doc/Xi18n_sample/IC.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | ******************************************************************/ 29 | typedef struct { 30 | XRectangle area; /* area */ 31 | XRectangle area_needed; /* area needed */ 32 | XPoint spot_location; /* spot location */ 33 | Colormap cmap; /* colormap */ 34 | CARD32 foreground; /* foreground */ 35 | CARD32 background; /* background */ 36 | Pixmap bg_pixmap; /* background pixmap */ 37 | char *base_font; /* base font of fontset */ 38 | CARD32 line_space; /* line spacing */ 39 | Cursor cursor; /* cursor */ 40 | } PreeditAttributes; 41 | 42 | typedef struct { 43 | XRectangle area; /* area */ 44 | XRectangle area_needed; /* area needed */ 45 | Colormap cmap; /* colormap */ 46 | CARD32 foreground; /* foreground */ 47 | CARD32 background; /* background */ 48 | Pixmap bg_pixmap; /* background pixmap */ 49 | char *base_font; /* base font of fontset */ 50 | CARD32 line_space; /* line spacing */ 51 | Cursor cursor; /* cursor */ 52 | } StatusAttributes; 53 | 54 | typedef struct _IC { 55 | CARD16 id; /* ic id */ 56 | INT32 input_style; /* input style */ 57 | Window client_win; /* client window */ 58 | Window focus_win; /* focus window */ 59 | char *resource_name; /* resource name */ 60 | char *resource_class; /* resource class */ 61 | PreeditAttributes pre_attr; /* preedit attributes */ 62 | StatusAttributes sts_attr; /* status attributes */ 63 | struct _IC *next; 64 | } IC; 65 | -------------------------------------------------------------------------------- /tables/keyboard/32qwerty: -------------------------------------------------------------------------------- 1 | Name: 3 set with 2 set layout 2 | 3 | U0041 U11B7 # GDK_A: jongseong mieum 4 | U0042 U1172 # GDK_B: jungseong yu 5 | U0043 U11BE # GDK_C: jongseong chieuch 6 | U0044 U11BC # GDK_D: jongseong ieung 7 | U0045 U11AE # GDK_E: jongseong tikeut 8 | U0046 U11AF # GDK_F: jongseong rieul 9 | U0047 U11C2 # GDK_G: jongseong hieuh 10 | U0048 U1169 # GDK_H: jungseong o 11 | U0049 U1163 # GDK_I: jungseong ya 12 | U004A U1165 # GDK_J: jungseong eo 13 | U004B U1161 # GDK_K: jungseong a 14 | U004C U1175 # GDK_L: jungseong i 15 | U004D U1173 # GDK_M: jungseong eu 16 | U004E U116E # GDK_N: jungseong u 17 | U004F U1164 # GDK_O: jungseong yae 18 | U0050 U1168 # GDK_P: jungseong ye 19 | U0051 U11B8 # GDK_Q: jongseong pieup 20 | U0052 U11A8 # GDK_R: jongseong kiyeok 21 | U0053 U11AB # GDK_S: jongseong nieun 22 | U0054 U11BA # GDK_T: jongseong sios 23 | U0055 U1167 # GDK_U: jungseong yeo 24 | U0056 U11C1 # GDK_V: jongseong phieuph 25 | U0057 U11BD # GDK_W: jongseong cieuc 26 | U0058 U11C0 # GDK_X: jongseong thieuth 27 | U0059 U116D # GDK_Y: jungseong yo 28 | U005A U11BF # GDK_Z: jongseong khieukh 29 | 30 | U0061 U1106 # GDK_a: choseong mieum 31 | U0062 U1172 # GDK_b: jungseong yu 32 | U0063 U110E # GDK_c: choseong chieuch 33 | U0064 U110B # GDK_d: choseong ieung 34 | U0065 U1103 # GDK_e: choseong tikeut 35 | U0066 U1105 # GDK_f: choseong rieul 36 | U0067 U1112 # GDK_g: choseong hieuh 37 | U0068 U1169 # GDK_h: jungseong o 38 | U0069 U1163 # GDK_i: jungseong ya 39 | U006A U1165 # GDK_j: jungseong eo 40 | U006B U1161 # GDK_k: jungseong a 41 | U006C U1175 # GDK_l: jungseong i 42 | U006D U1173 # GDK_m: jungseong eu 43 | U006E U116E # GDK_n: jungseong u 44 | U006F U1162 # GDK_o: jungseong ae 45 | U0070 U1166 # GDK_p: jungseong e 46 | U0071 U1107 # GDK_q: choseong pieup 47 | U0072 U1100 # GDK_r: choseong kiyeok 48 | U0073 U1102 # GDK_s: choseong nieun 49 | U0074 U1109 # GDK_t: choseong sios 50 | U0075 U1167 # GDK_u: jungseong yeo 51 | U0076 U1111 # GDK_v: choseong phieuph 52 | U0077 U110C # GDK_w: choseong cieuc 53 | U0078 U1110 # GDK_x: choseong thieuth 54 | U0079 U116D # GDK_y: jungseong yo 55 | U007A U110F # GDK_z: choseong khieukh 56 | -------------------------------------------------------------------------------- /tables/candidate/hanja-sanity.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Usage : ./hanja-sanity.pl [-v] [nabi-hanja.txt] 4 | # checks the sanity of nabi-hanja.txt and shows entries presumably wrong-commented. 5 | 6 | require 5.8.0; 7 | 8 | use strict; 9 | use Carp; 10 | use Getopt::Std; 11 | use Fcntl qw/:flock/; 12 | use encoding qw/utf8/; 13 | 14 | # options 15 | our $opt_v; 16 | getopts('v'); 17 | 18 | my $file = shift || "nabi-hanja.txt"; 19 | 20 | # open file 21 | open IN, "<:utf8",$file or croak "cannot open `$file'"; 22 | flock IN, LOCK_SH or croak "cannot shlock `$file'"; 23 | 24 | # loop 25 | my ($p,$flag) = (undef,0); 26 | foreach () 27 | { 28 | # check if new pronunciation found 29 | if (m/^\[(.)\]$/) { ($p,$flag) = ($1,0); next; } 30 | 31 | # check sanity 32 | next if m/^.=(?:[^,]+ $p, )*[^,]+ $p$/; # ordinary case 33 | next if m/^.=.\x{c758} (?:\x{7c21}\x{9ad4}|\x{53e4}|\x{7565}|\x{672c}|\x{4fd7}|\x{8a1b}|\x{8b4c}|\x{6b63}|\x{7c21}(?:\x{9ad4}|\x{4f53}))\x{5b57}$/; # misc 34 | next if m/^.=.\x{acfc} \x{540c}\x{5b57}$/ && (((ord $p)-hex"ac00")%28); # has jongseong 35 | next if m/^.=.\x{c640} \x{540c}\x{5b57}$/ && !(((ord $p)-hex"ac00")%28); # has no jongseong 36 | next if m/^(.)=$/ && (((ord $1)&0xf000)!=hex"f000"); # has no meaning and not a char for compatibility 37 | next if m/^$/; # possible blank lines 38 | 39 | # check an avoidance of liquid at the head phoneme unless verbose 40 | unless ($opt_v || (my @p=&_alternate_pronunciations($p))<2) 41 | { 42 | my $ap = "(?:".+(join"|",@p).")"; 43 | next if m/^.=(?:[^,]+ $ap, )*[^,]+ $ap$/; 44 | } 45 | 46 | # print 47 | print "[$p]\n" unless $flag++; 48 | print "U+".+(uc unpack "H4", pack "n", ord $1)." $_" if m/^(.)/; 49 | } 50 | 51 | # close file 52 | flock IN, LOCK_UN; 53 | close IN; 54 | 55 | # returns all possible pronunciations 56 | sub _alternate_pronunciations 57 | { 58 | my $p = shift; 59 | my %t = ( "\x{b140}" => "\x{c5ec}", # NEYO => YEO : Nasal#{{{ 60 | "\x{b1e8}" => "\x{c694}", # NYO => YO 61 | "\x{b274}" => "\x{c720}", # NYU => YU 62 | "\x{b2c8}" => "\x{c774}", # NI => I 63 | "\x{b7b4}" => "\x{c57c}", # RYA => YA : Liquid 64 | "\x{b824}" => "\x{c5ec}", # RYEO => YEO 65 | "\x{b840}" => "\x{c608}", # RYE => YE 66 | "\x{b8cc}" => "\x{c694}", # RYO => YO 67 | "\x{b958}" => "\x{c720}", # RYU => YU 68 | "\x{b9ac}" => "\x{c774}", # RI => I 69 | "\x{b82c}" => "\x{c5f4}", # RYEOL => YEOL 70 | "\x{b960}" => "\x{c728}", # RYUL => YUL 71 | "\x{b77c}" => "\x{b098}", # RA => NA 72 | "\x{b798}" => "\x{b0b4}", # RAE => NAE 73 | "\x{b85c}" => "\x{b178}", # RO => NO 74 | "\x{b8b0}" => "\x{b1cc}", # ROE => NOE 75 | "\x{b8e8}" => "\x{b204}", # RU => NU 76 | "\x{b974}" => "\x{b290}", # REU => NEU 77 | );#}}} 78 | my @p = ($p); 79 | my $jong = ((ord $p)-hex"ac00")%28; # JONGSEONG of $p 80 | $p = pack "U", ord($p)-$jong; 81 | map { push @p, pack "U", ord($_)+$jong if $t{$_} eq $p; } keys %t; 82 | return @p; 83 | } 84 | -------------------------------------------------------------------------------- /src/gettext.h: -------------------------------------------------------------------------------- 1 | /* Convenience header for conditional use of GNU . 2 | Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published 6 | by the Free Software Foundation; either version 2, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 17 | USA. */ 18 | 19 | #ifndef _LIBGETTEXT_H 20 | #define _LIBGETTEXT_H 1 21 | 22 | /* NLS can be disabled through the configure --disable-nls option. */ 23 | #if ENABLE_NLS 24 | 25 | /* Get declarations of GNU message catalog functions. */ 26 | # include 27 | 28 | # define _(x) gettext(x) 29 | # define N_(String) gettext_noop (String) 30 | 31 | #else 32 | 33 | /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which 34 | chokes if dcgettext is defined as a macro. So include it now, to make 35 | later inclusions of a NOP. We don't include 36 | as well because people using "gettext.h" will not include , 37 | and also including would fail on SunOS 4, whereas 38 | is OK. */ 39 | #if defined(__sun) 40 | # include 41 | #endif 42 | 43 | /* Disabled NLS. 44 | The casts to 'const char *' serve the purpose of producing warnings 45 | for invalid uses of the value returned from these functions. 46 | On pre-ANSI systems without 'const', the config.h file is supposed to 47 | contain "#define const". */ 48 | # define gettext(Msgid) ((const char *) (Msgid)) 49 | # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) 50 | # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) 51 | # define ngettext(Msgid1, Msgid2, N) \ 52 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) 53 | # define dngettext(Domainname, Msgid1, Msgid2, N) \ 54 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) 55 | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ 56 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) 57 | # define textdomain(Domainname) ((const char *) (Domainname)) 58 | # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) 59 | # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) 60 | 61 | # define N_(String) (String) 62 | # define _(x) (x) 63 | 64 | #endif 65 | 66 | /* A pseudo function call that serves as a marker for the automated 67 | extraction of messages, but does not call gettext(). The run-time 68 | translation is done at a different place in the code. 69 | The argument, String, should be a literal string. Concatenated strings 70 | and other string expressions won't work. 71 | The macro's expansion is not parenthesized, so that it is suitable as 72 | initializer for static 'char[]' or 'const char[]' variables. */ 73 | #define gettext_noop(String) String 74 | 75 | #endif /* _LIBGETTEXT_H */ 76 | -------------------------------------------------------------------------------- /tables/keyboard/3sqwerty: -------------------------------------------------------------------------------- 1 | Name: 3 set no-shift 2 | 3 | U0021 U0021 # exclam: exclamation mark 4 | U0022 U0022 # quotedbl: quotatioin mark 5 | U0023 U0023 # numbersign: number sign 6 | U0024 U0024 # dollar: dollar sign 7 | U0025 U0025 # percent: percent sign 8 | U0026 U0026 # ampersand: ampersand 9 | U0027 U1110 # apostrophe: choseong thieuth 10 | U0028 U0028 # parenleft: left parenthesis 11 | U0029 U0029 # parenright: right parenthesis 12 | U002A U002A # asterisk: asterisk 13 | U002B U002B # plus: plus sign 14 | U002C U002C # comma: comma 15 | U002D U11BD # minus: jongseong cieuc 16 | U002E U002E # period: period 17 | U002F U11AE # slash: jongseong tikeut 18 | U0030 U1164 # 0: choseong yae 19 | U0031 U11C2 # 1: jongseong hieuh 20 | U0032 U11BB # 2: jongseong ssangsios 21 | U0033 U11B8 # 3: jongseong pieup 22 | U0034 U116D # 4: jungseong yo 23 | U0035 U1172 # 5: jungseong yu 24 | U0036 U1163 # 6: jungseong ya 25 | U0037 U1168 # 7: jungseong ye 26 | U0038 U1174 # 8: jungseong yi 27 | U0039 U110F # 9: choseong khieukh 28 | U003A U003A # colon: colon 29 | U003B U1107 # semicolon: choseong pieup 30 | U003C U0032 # less: 2 31 | U003D U11BE # equal: jongseong chieuch 32 | U003E U0033 # greater: 3 33 | U003F U003F # question: question mark 34 | U0040 U0040 # at: commertial at 35 | U0041 U11BC # A: jongseong ieung 36 | U0042 U0021 # B: exclamation mark 37 | U0043 U005C # C: backslash 38 | U0044 U005D # D: right bracket 39 | U0045 U1167 # E: jungseong yeo 40 | U0046 U1161 # F: jungseong a 41 | U0047 U002F # G: slash 42 | U0048 U0027 # H: apostrophe 43 | U0049 U0038 # I: 8 44 | U004A U0034 # J: 4 45 | U004B U0035 # K: 5 46 | U004C U0036 # L: 6 47 | U004D U0031 # M: 1 48 | U004E U0030 # N: 0 49 | U004F U0039 # O: 9 50 | U0050 U003E # P: greater-than sign 51 | U0051 U11BA # Q: jongseong sios 52 | U0052 U1162 # R: jungseong ae 53 | U0053 U005B # S: left bracket 54 | U0054 U003B # T: semicolon 55 | U0055 U0037 # U: 7 56 | U0056 U1169 # V: jungseong o 57 | U0057 U11AF # W: jongseong rieul 58 | U0058 U003D # X: equals sign 59 | U0059 U003C # Y: less-than sign 60 | U005A U002D # Z: minus sign 61 | U005B U11C0 # bracketleft: jongseong thieuth 62 | U005C U11BF # backslash: jongseong khieukh 63 | U005D U11C1 # bracketright: jongseong phieuph 64 | U005E U005E # asciicircum: circumflex accent 65 | U005F U005F # underscore: underscore 66 | U0060 U0060 # quoteleft: grave accent 67 | U0061 U11BC # a: jongseong ieung 68 | U0062 U116E # b: jungseong u 69 | U0063 U1166 # c: jungseong e 70 | U0064 U1175 # d: jungseong i 71 | U0065 U1167 # e: jungseong yeo 72 | U0066 U1161 # f: jungseong a 73 | U0067 U1173 # g: jungseong eu 74 | U0068 U1102 # h: choseong nieun 75 | U0069 U1106 # i: choseong mieum 76 | U006A U110B # j: choseong ieung 77 | U006B U1100 # k: choseong kiyeok 78 | U006C U110C # l: choseong cieuc 79 | U006D U1112 # m: choseong hieuh 80 | U006E U1109 # n: choseong sios 81 | U006F U110E # o: choseong chieuch 82 | U0070 U1111 # p: choseong phieuph 83 | U0071 U11BA # q: jongseong sios 84 | U0072 U1162 # r: jungseong ae 85 | U0073 U11AB # s: jongseong nieun 86 | U0074 U1165 # t: jungseong eo 87 | U0075 U1103 # u: choseong tikeut 88 | U0076 U1169 # v: jungseong o 89 | U0077 U11AF # w: jongseong rieul 90 | U0078 U11A8 # x: jongseong kiyeok 91 | U0079 U1105 # y: choseong rieul 92 | U007A U11B7 # z: jongseong mieum 93 | U007B U007B # braceleft: left brace 94 | U007C U007C # bar: vertical line(bar) 95 | U007D U007D # braceright: right brace 96 | U007E U007E # asciitilde: tilde 97 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT(nabi, 1.0.1, https://github.com/libhangul/nabi) 2 | AM_INIT_AUTOMAKE([]) 3 | 4 | AM_SILENT_RULES([yes]) 5 | AM_CONFIG_HEADER(config.h) 6 | 7 | dnl Checks for programs 8 | AC_PROG_CC 9 | AM_PROG_CC_C_O 10 | AC_OBJEXT 11 | AC_PROG_RANLIB 12 | AC_PROG_INSTALL 13 | 14 | dnl Checks for header files. 15 | AC_PATH_X 16 | AC_HEADER_DIRENT 17 | AC_HEADER_STDC 18 | AC_CHECK_HEADERS([langinfo.h libintl.h locale.h stddef.h stdint.h stdlib.h string.h sys/param.h]) 19 | 20 | dnl Checks for typedefs, structures, and compiler characteristics. 21 | AC_C_CONST 22 | AC_C_INLINE 23 | 24 | AC_TYPE_SIZE_T 25 | AC_STRUCT_TM 26 | 27 | dnl Checks for library functions. 28 | AC_FUNC_CLOSEDIR_VOID 29 | AC_FUNC_MALLOC 30 | AC_FUNC_REALLOC 31 | AC_FUNC_VPRINTF 32 | AC_FUNC_STRFTIME 33 | AC_CHECK_FUNCS([gethostname memmove memset mkdir putenv setlocale strchr strdup strtol localtime_r]) 34 | 35 | dnl Checks for X window system 36 | AC_PATH_XTRA 37 | case $X_PRE_LIBS in 38 | *"-lSM"*) 39 | AC_DEFINE_UNQUOTED(HAVE_LIBSM, 1, Define to 1 if you have the libSM library.) 40 | esac 41 | 42 | dnl Checks for GTK+ libraries. 43 | AC_PATH_PROG(PKG_CONFIG, pkg-config, 44 | AC_MSG_ERROR([nabi needs pkg-config])) 45 | PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0,, 46 | AC_MSG_ERROR([nabi needs GTK+ 2.4.0 or higher])) 47 | 48 | # checks for libhangul 49 | PKG_CHECK_MODULES(LIBHANGUL, libhangul >= 0.1.0,, 50 | AC_MSG_ERROR([nabi needs libhangul 0.1.0 or higher])) 51 | 52 | dnl gettext stuff 53 | ALL_LINGUAS="ko de" 54 | AM_GLIB_GNU_GETTEXT 55 | 56 | GETTEXT_PACKAGE="$PACKAGE" 57 | AC_SUBST(GETTEXT_PACKAGE) 58 | AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", gettext package name) 59 | 60 | dnl data dir 61 | NABI_DATA_DIR="${datadir}/$PACKAGE" 62 | NABI_THEMES_DIR="${NABI_DATA_DIR}/themes" 63 | AC_SUBST(NABI_DATA_DIR) 64 | AC_SUBST(NABI_THEMES_DIR) 65 | 66 | # configure options 67 | AC_ARG_ENABLE(debug, 68 | [ --enable-debug include debug code], 69 | enable_debug=yes, enable_debug=no) 70 | 71 | dnl default keyboard 72 | AC_ARG_WITH(default-keyboard, [ --with-default-keyboard=2/39/3f default hangul keyboard]) 73 | case "$with_default_keyboard" in 74 | 2) 75 | AC_DEFINE_UNQUOTED(DEFAULT_KEYBOARD, "2", 76 | [Define default hangul keyboard]) 77 | ;; 78 | 39) 79 | AC_DEFINE_UNQUOTED(DEFAULT_KEYBOARD, "39", 80 | [Define default hangul keyboard]) 81 | ;; 82 | 3f) 83 | AC_DEFINE_UNQUOTED(DEFAULT_KEYBOARD, "3f", 84 | [Define default hangul keyboard]) 85 | ;; 86 | *) 87 | AC_DEFINE_UNQUOTED(DEFAULT_KEYBOARD, "2", 88 | [Define default hangul keyboard]) 89 | ;; 90 | esac 91 | 92 | # default theme 93 | AC_MSG_CHECKING([for default theme name]) 94 | AC_ARG_WITH(default-theme, [ --with-default-theme=[THEME] default icon theme]) 95 | if test -n "$with_default_theme"; then 96 | if test ! -d "themes/$with_default_theme"; then 97 | AC_MSG_NOTICE([there is no such theme directory: $with_default_theme, use default]) 98 | with_default_theme="Jini" 99 | fi 100 | else 101 | with_default_theme="Jini" 102 | fi 103 | 104 | AC_MSG_RESULT([$with_default_theme]) 105 | AC_DEFINE_UNQUOTED(DEFAULT_THEME, "$with_default_theme", [Define default icon theme]) 106 | 107 | if test "$enable_debug" = "yes"; then 108 | AC_DEFINE(NABI_DEBUG, 1, [Define to 1 if you want to use debug code]) 109 | CFLAGS="$CFLAGS -Wall -g" 110 | CXXFLAGS="$CXXFLAGS -Wall -g" 111 | fi 112 | 113 | AC_OUTPUT([ 114 | Makefile 115 | IMdkit/Makefile 116 | src/Makefile 117 | tables/Makefile 118 | themes/Makefile 119 | po/Makefile.in 120 | ]) 121 | -------------------------------------------------------------------------------- /IMdkit/XimFunc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #ifndef _XimFunc_h 33 | #define _XimFunc_h 34 | 35 | /* i18nAttr.c */ 36 | void _Xi18nInitAttrList (Xi18n i18n_core); 37 | void _Xi18nInitExtension(Xi18n i18n_core); 38 | 39 | /* i18nClbk.c */ 40 | int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data); 41 | int _Xi18nPreeditStartCallback (XIMS ims, IMProtocol *call_data); 42 | int _Xi18nPreeditDrawCallback (XIMS ims, IMProtocol *call_data); 43 | int _Xi18nPreeditCaretCallback (XIMS ims, IMProtocol *call_data); 44 | int _Xi18nPreeditDoneCallback (XIMS ims, IMProtocol *call_data); 45 | int _Xi18nStatusStartCallback (XIMS ims, IMProtocol *call_data); 46 | int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data); 47 | int _Xi18nStatusDoneCallback (XIMS ims, IMProtocol *call_data); 48 | int _Xi18nStringConversionCallback (XIMS ims, IMProtocol *call_data); 49 | 50 | /* i18nIc.c */ 51 | void _Xi18nChangeIC (XIMS ims, IMProtocol *call_data, unsigned char *p, 52 | int create_flag); 53 | void _Xi18nGetIC (XIMS ims, IMProtocol *call_data, unsigned char *p); 54 | 55 | /* i18nUtil.c */ 56 | int _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id); 57 | Xi18nClient *_Xi18nNewClient(Xi18n i18n_core); 58 | Xi18nClient *_Xi18nFindClient (Xi18n i18n_core, CARD16 connect_id); 59 | void _Xi18nDeleteClient (Xi18n i18n_core, CARD16 connect_id); 60 | void _Xi18nDeleteAllClients (Xi18n i18n_core); 61 | void _Xi18nDeleteFreeClients (Xi18n i18n_core); 62 | void _Xi18nSendMessage (XIMS ims, CARD16 connect_id, CARD8 major_opcode, 63 | CARD8 minor_opcode, unsigned char *data, long length); 64 | void _Xi18nSendTriggerKey (XIMS ims, CARD16 connect_id); 65 | void _Xi18nSetEventMask (XIMS ims, CARD16 connect_id, CARD16 im_id, 66 | CARD16 ic_id, CARD32 forward_mask, CARD32 sync_mask); 67 | 68 | /* Xlib internal */ 69 | void _XRegisterFilterByType(Display*, Window, int, int, 70 | Bool (*filter)(Display*, Window, XEvent*, XPointer), XPointer); 71 | void _XUnregisterFilter(Display*, Window, 72 | Bool (*filter)(Display*, Window, XEvent*, XPointer), XPointer); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include "gettext.h" 33 | #include "server.h" 34 | #include "session.h" 35 | #include "nabi.h" 36 | #include "debug.h" 37 | 38 | NabiApplication* nabi = NULL; 39 | NabiServer* nabi_server = NULL; 40 | 41 | static int 42 | nabi_x_error_handler(Display *display, XErrorEvent *error) 43 | { 44 | gchar buf[64]; 45 | 46 | XGetErrorText (display, error->error_code, buf, 63); 47 | fprintf(stderr, "Nabi: X error: %s\n", buf); 48 | 49 | return 0; 50 | } 51 | 52 | static int 53 | nabi_x_io_error_handler(Display* display) 54 | { 55 | nabi_log(1, "x io error: save config\n"); 56 | 57 | nabi_server_write_log(nabi_server); 58 | nabi_app_save_config(); 59 | 60 | exit(0); 61 | } 62 | 63 | int 64 | main(int argc, char *argv[]) 65 | { 66 | GtkWidget *widget; 67 | 68 | #ifdef ENABLE_NLS 69 | bindtextdomain(PACKAGE, LOCALEDIR); 70 | bind_textdomain_codeset(PACKAGE, "UTF-8"); 71 | textdomain(PACKAGE); 72 | #endif 73 | 74 | gtk_init(&argc, &argv); 75 | 76 | nabi_log_set_device("stdout"); 77 | 78 | nabi_app_new(); 79 | nabi_app_init(&argc, &argv); 80 | 81 | XSetErrorHandler(nabi_x_error_handler); 82 | XSetIOErrorHandler(nabi_x_io_error_handler); 83 | 84 | if (!nabi->status_only) { 85 | Display* display; 86 | int screen; 87 | char *xim_name; 88 | 89 | /* we prefer command line option as default xim name */ 90 | if (nabi->xim_name != NULL) 91 | xim_name = nabi->xim_name; 92 | else 93 | xim_name = nabi->config->xim_name->str; 94 | 95 | if (nabi_server_is_running(xim_name)) { 96 | nabi_log(1, "xim %s is already running\n", xim_name); 97 | goto quit; 98 | } 99 | 100 | display = gdk_x11_get_default_xdisplay(); 101 | screen = gdk_x11_get_default_screen(); 102 | 103 | nabi_server = nabi_server_new(display, screen, xim_name); 104 | nabi_app_setup_server(); 105 | } 106 | 107 | widget = nabi_app_create_palette(); 108 | gtk_widget_show(widget); 109 | 110 | if (nabi_server != NULL) { 111 | nabi_server_start(nabi_server); 112 | } 113 | 114 | if (nabi_log_get_level() == 0) 115 | nabi_session_open(nabi->session_id); 116 | 117 | gtk_main(); 118 | 119 | if (nabi_log_get_level() == 0) 120 | nabi_session_close(); 121 | 122 | if (nabi_server != NULL) { 123 | nabi_server_stop(nabi_server); 124 | nabi_server_write_log(nabi_server); 125 | nabi_server_destroy(nabi_server); 126 | nabi_server = NULL; 127 | } 128 | 129 | quit: 130 | nabi_app_free(); 131 | 132 | return 0; 133 | } 134 | 135 | /* vim: set ts=8 sts=4 sw=4 : */ 136 | -------------------------------------------------------------------------------- /IMdkit/IMValues.c: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #include 33 | #include 34 | #include "IMdkit.h" 35 | #include 36 | 37 | #define Va_start(a,b) va_start(a,b) 38 | 39 | static void _IMCountVaList (va_list var, int *total_count) 40 | { 41 | char *attr; 42 | 43 | *total_count = 0; 44 | 45 | for (attr = va_arg (var, char *); attr; attr = va_arg (var, char *)) 46 | { 47 | (void)va_arg (var, XIMArg *); 48 | ++(*total_count); 49 | } 50 | /*endfor*/ 51 | } 52 | 53 | static void _IMVaToNestedList (va_list var, int max_count, XIMArg **args_return) 54 | { 55 | XIMArg *args; 56 | char *attr; 57 | 58 | if (max_count <= 0) 59 | { 60 | *args_return = (XIMArg *) NULL; 61 | return; 62 | } 63 | /*endif*/ 64 | 65 | args = (XIMArg *) malloc ((unsigned) (max_count + 1)*sizeof (XIMArg)); 66 | *args_return = args; 67 | if (!args) 68 | return; 69 | /*endif*/ 70 | for (attr = va_arg (var, char *); attr; attr = va_arg (var, char *)) 71 | { 72 | args->name = attr; 73 | args->value = va_arg (var, XPointer); 74 | args++; 75 | } 76 | /*endfor*/ 77 | args->name = (char *) NULL; 78 | } 79 | 80 | char *IMGetIMValues (XIMS ims, ...) 81 | { 82 | va_list var; 83 | int total_count; 84 | XIMArg *args; 85 | char *ret; 86 | 87 | Va_start (var, ims); 88 | _IMCountVaList (var, &total_count); 89 | va_end (var); 90 | 91 | Va_start (var, ims); 92 | _IMVaToNestedList (var, total_count, &args); 93 | va_end (var); 94 | 95 | ret = (*ims->methods->getIMValues) (ims, args); 96 | 97 | if (args) 98 | XFree ((char *) args); 99 | /*endif*/ 100 | return ret; 101 | } 102 | 103 | char *IMSetIMValues (XIMS ims, ...) 104 | { 105 | va_list var; 106 | int total_count; 107 | XIMArg *args; 108 | char *ret; 109 | 110 | Va_start (var, ims); 111 | _IMCountVaList (var, &total_count); 112 | va_end (var); 113 | 114 | Va_start (var, ims); 115 | _IMVaToNestedList (var, total_count, &args); 116 | va_end (var); 117 | 118 | ret = (*ims->methods->setIMValues) (ims, args); 119 | 120 | if (args) 121 | XFree ((char *) args); 122 | /*endif*/ 123 | return ret; 124 | } 125 | -------------------------------------------------------------------------------- /tables/keyboard/3fqwerty: -------------------------------------------------------------------------------- 1 | Name: 3 set final 2 | 3 | U0021 U11A9 # GDK_exclam: jongseong ssangkiyeok 4 | U0022 U00B7 # GDK_quotedbl: middle dot 5 | U0023 U11BD # GDK_numbersign: jognseong cieuc 6 | U0024 U11B5 # GDK_dollar: jongseong rieul-phieuph 7 | U0025 U11B4 # GDK_percent: jongseong rieul-thieuth 8 | U0026 U201C # GDK_ampersand: left double quotation mark 9 | U0027 U1110 # GDK_apostrophe: choseong thieuth 10 | U0028 U0027 # GDK_parenleft: apostrophe 11 | U0029 U007E # GDK_parenright: Tilde 12 | U002A U201D # GDK_asterisk: right double quotation mark 13 | U002B U002B # GDK_plus: plus sign 14 | U002C U002C # GDK_comma: comma 15 | U002D U0029 # GDK_minus: right parenthesis 16 | U002E U002E # GDK_period: period 17 | U002F U1169 # GDK_slash: jungseong o 18 | U0030 U110F # GDK_0: choseong khieukh 19 | U0031 U11C2 # GDK_1: jongseong hieuh 20 | U0032 U11BB # GDK_2: jongseong ssangsios 21 | U0033 U11B8 # GDK_3: jongseong pieup 22 | U0034 U116D # GDK_4: jungseong yo 23 | U0035 U1172 # GDK_5: jungseong yu 24 | U0036 U1163 # GDK_6: jungseong ya 25 | U0037 U1168 # GDK_7: jungseong ye 26 | U0038 U1174 # GDK_8: jungseong yi 27 | U0039 U116E # GDK_9: jungseong u 28 | U003A U0034 # GDK_colon: 4 29 | U003B U1107 # GDK_semicolon: choseong pieup 30 | U003C U002C # GDK_less: comma 31 | U003D U003E # GDK_equal: greater-than sign 32 | U003E U002E # GDK_greater: period 33 | U003F U0021 # GDK_question: exclamation mark 34 | U0040 U11B0 # GDK_at: jongseong rieul-kiyeok 35 | U0041 U11AE # GDK_A: jongseong tikeut 36 | U0042 U003F # GDK_B: question mark 37 | U0043 U11BF # GDK_C: jongseong khieukh 38 | U0044 U11B2 # GDK_D: jongseong rieul-pieup 39 | U0045 U11AC # GDK_E: jongseong nieun-cieuc 40 | U0046 U11B1 # GDK_F: jongseong rieul-mieum 41 | U0047 U1164 # GDK_G: jungseong yae 42 | U0048 U0030 # GDK_H: 0 43 | U0049 U0037 # GDK_I: 7 44 | U004A U0031 # GDK_J: 1 45 | U004B U0032 # GDK_K: 2 46 | U004C U0033 # GDK_L: 3 47 | U004D U0022 # GDK_M: double quotation mark 48 | U004E U002D # GDK_N: minus sign 49 | U004F U0038 # GDK_O: 8 50 | U0050 U0039 # GDK_P: 9 51 | U0051 U11C1 # GDK_Q: jongseong phieuph 52 | U0052 U11B6 # GDK_R: jongseong rieul-hieuh 53 | U0053 U11AD # GDK_S: jongseong nieun-hieuh 54 | U0054 U11B3 # GDK_T: jongseong rieul-sios 55 | U0055 U0036 # GDK_U: 6 56 | U0056 U11AA # GDK_V: jongseong kiyeok-sios 57 | U0057 U11C0 # GDK_W: jongseong thikeuth 58 | U0058 U11B9 # GDK_X: jongseong pieup-sios 59 | U0059 U0035 # GDK_Y: 5 60 | U005A U11BE # GDK_Z: jongseong chieuch 61 | U005B U0028 # GDK_bracketleft: left parenthesis 62 | U005C U003A # GDK_backslash: colon 63 | U005D U003C # GDK_bracketright: less-than sign 64 | U005E U003D # GDK_asciicircum: equals sign 65 | U005F U003B # GDK_underscore: semicolon 66 | U0060 U002A # GDK_quoteleft: asterisk 67 | U0061 U11BC # GDK_a: jongseong ieung 68 | U0062 U116E # GDK_b: jungseong u 69 | U0063 U1166 # GDK_c: jungseong e 70 | U0064 U1175 # GDK_d: jungseong i 71 | U0065 U1167 # GDK_e: jungseong yeo 72 | U0066 U1161 # GDK_f: jungseong a 73 | U0067 U1173 # GDK_g: jungseong eu 74 | U0068 U1102 # GDK_h: choseong nieun 75 | U0069 U1106 # GDK_i: choseong mieum 76 | U006A U110B # GDK_j: choseong ieung 77 | U006B U1100 # GDK_k: choseong kiyeok 78 | U006C U110C # GDK_l: choseong cieuc 79 | U006D U1112 # GDK_m: choseong hieuh 80 | U006E U1109 # GDK_n: choseong sios 81 | U006F U110E # GDK_o: choseong chieuch 82 | U0070 U1111 # GDK_p: choseong phieuph 83 | U0071 U11BA # GDK_q: jongseong sios 84 | U0072 U1162 # GDK_r: jungseong ae 85 | U0073 U11AB # GDK_s: jongseong nieun 86 | U0074 U1165 # GDK_t: jungseong eo 87 | U0075 U1103 # GDK_u: choseong tikeut 88 | U0076 U1169 # GDK_v: jungseong o 89 | U0077 U11AF # GDK_w: jongseong rieul 90 | U0078 U11A8 # GDK_x: jongseong kiyeok 91 | U0079 U1105 # GDK_y: choseong rieul 92 | U007A U11B7 # GDK_z: jongseong mieum 93 | U007B U0025 # GDK_braceleft: percent sign 94 | U007C U005C # GDK_bar: backslash 95 | U007D U002F # GDK_braceright: slash 96 | U007E U203B # GDK_asciitilde: reference mark 97 | -------------------------------------------------------------------------------- /tables/keyboard/3yqwerty: -------------------------------------------------------------------------------- 1 | Name: 3 set yetguel 2 | Compose: full 3 | Output: jamo 4 | 5 | U0021 U11bd # GDK_exclam: jongseong cieuc 6 | U0022 U0022 # GDK_quotedbl: quotatioin mark 7 | U0023 U0023 # GDK_numbersign: number sign 8 | U0024 U0024 # GDK_dollar: dollar sign 9 | U0025 U0025 # GDK_percent: percent sign 10 | U0026 U0026 # GDK_ampersand: ampersand 11 | U0027 U1110 # GDK_apostrophe: choseong thieuth 12 | U0028 U0028 # GDK_parenleft: left parenthesis 13 | U0029 U0029 # GDK_parenright: right parenthesis 14 | U002A U002a # GDK_asterisk: asterisk 15 | U002B U002b # GDK_plus: plus sign 16 | U002C U002c # GDK_comma: comma 17 | U002D U002d # GDK_minus: minus sign 18 | U002E U002e # GDK_period: period 19 | U002F U1169 # GDK_slash: jungseong o 20 | U0030 U110f # GDK_0: choseong khieukh 21 | U0031 U11c2 # GDK_1: jongseong hieuh 22 | U0032 U11bb # GDK_2: jongseong ssangsios 23 | U0033 U11b8 # GDK_3: jongseong pieup 24 | U0034 U116d # GDK_4: jungseong yo 25 | U0035 U1172 # GDK_5: jungseong yu 26 | U0036 U1163 # GDK_6: jungseong ya 27 | U0037 U1168 # GDK_7: jungseong ye 28 | U0038 U1174 # GDK_8: jungseong yi 29 | U0039 U116e # GDK_9: jungseong u 30 | U003A U003a # GDK_colon: colon 31 | U003B U1107 # GDK_semicolon: choseong pieup 32 | U003C U113c # GDK_less: choseong chitueumsios 33 | U003D U003d # GDK_equal: euals sign 34 | U003E U113e # GDK_greater: choseong ceongchieumsios 35 | U003F U003f # GDK_question: question mark 36 | U0040 U11eb # GDK_at: jongseong pansios 37 | U0041 U11ae # GDK_A: jongseong tikeut 38 | U0042 U116e # GDK_B: jungseong u 39 | U0043 U11b1 # GDK_C: jongseong rieul-mieum 40 | U0044 U11b0 # GDK_D: jongseong rieul-kiyeok 41 | U0045 U11bf # GDK_E: jongseong khieukh 42 | U0046 U11a9 # GDK_F: jongseong ssangkiyeok 43 | U0047 U119e # GDK_G: jungseong araea 44 | U0048 U1102 # GDK_H: choseong nieun 45 | U0049 U1154 # GDK_I: choseong chitueumchieuch 46 | U004A U114c # GDK_J: choseong yesieung 47 | U004B U114e # GDK_K: choseong chitueumcieuc 48 | U004C U1150 # GDK_L: choseong ceongchieumcieuc 49 | U004D U1159 # GDK_M: choseong yeorinhieuh 50 | U004E U1140 # GDK_N: choseong pansios 51 | U004F U1155 # GDK_O: choseong ceongchieumchieuch 52 | U0050 U1111 # GDK_P: choseong phieuph 53 | U0051 U11c1 # GDK_Q: jongseong phieuph 54 | U0052 U1164 # GDK_R: jungseong yae 55 | U0053 U11ad # GDK_S: jongseong nieun-hieuh 56 | U0054 U1165 # GDK_T: jungseong eo 57 | U0055 U302e # GDK_U: single dot tone mark 58 | U0056 U11b6 # GDK_V: jongseong rieul-hieuh 59 | U0057 U11c0 # GDK_W: jongseong thikeuth 60 | U0058 U11b9 # GDK_X: jongseong pieup-sios 61 | U0059 U302f # GDK_Y: double dot tone mark 62 | U005A U11be # GDK_Z: jongseong chieuch 63 | U005B U005b # GDK_bracketleft: left bracket 64 | U005C U005c # GDK_backslash: backslash 65 | U005D U005d # GDK_bracketright: right bracket 66 | U005E U005e # GDK_asciicircum: circumflex accent 67 | U005F U005f # GDK_underscore: underscore 68 | U0060 U11f9 # GDK_quoteleft: jongseong yeorinhieuh 69 | U0061 U11bc # GDK_a: jongseong ieung 70 | U0062 U116e # GDK_b: jungseong u 71 | U0063 U1166 # GDK_c: jungseong e 72 | U0064 U1175 # GDK_d: jungseong i 73 | U0065 U1167 # GDK_e: jungseong yeo 74 | U0066 U1161 # GDK_f: jungseong a 75 | U0067 U1173 # GDK_g: jungseong eu 76 | U0068 U1102 # GDK_h: choseong nieun 77 | U0069 U1106 # GDK_i: choseong mieum 78 | U006A U110b # GDK_j: choseong ieung 79 | U006B U1100 # GDK_k: choseong kiyeok 80 | U006C U110c # GDK_l: choseong cieuc 81 | U006D U1112 # GDK_m: choseong hieuh 82 | U006E U1109 # GDK_n: choseong sios 83 | U006F U110e # GDK_o: choseong chieuch 84 | U0070 U1111 # GDK_p: choseong phieuph 85 | U0071 U11ba # GDK_q: jongseong sios 86 | U0072 U1162 # GDK_r: jungseong ae 87 | U0073 U11ab # GDK_s: jongseong nieun 88 | U0074 U1165 # GDK_t: jungseong eo 89 | U0075 U1103 # GDK_u: choseong tikeut 90 | U0076 U1169 # GDK_v: jungseong o 91 | U0077 U11af # GDK_w: jongseong rieul 92 | U0078 U11a8 # GDK_x: jongseong kiyeok 93 | U0079 U1105 # GDK_y: choseong rieul 94 | U007A U11b7 # GDK_z: jongseong mieum 95 | U007B U007b # GDK_braceleft: left brace 96 | U007C U007c # GDK_bar: vertical line(bar) 97 | U007D U007d # GDK_braceright: right brace 98 | U007E U11f0 # GDK_asciitilde: jongseong yesieung 99 | -------------------------------------------------------------------------------- /IMdkit/doc/README: -------------------------------------------------------------------------------- 1 | IM Server Developers Kit 2 | 3 | Release Notes 4 | 5 | Hidetoshi Tajima 6 | 7 | X11R6 Xi18n Implementation Group 8 | 9 | May 15, 1995 10 | 11 | Here is an introduction of IMserver Developers Kit, in short IMdkit, 12 | which is distributed with X11R6 contributions. 13 | 14 | 1. Scope of IMdkit 15 | 16 | IMdkit has the following six primary features. 17 | 18 | 1.1. Providing C language Interface 19 | 20 | IMdkit provides a low level interface to IMProtocol. It binds 21 | each IMProtocol operation to the interface for C language, so that you 22 | will take less efforts to make your IMservers communicable with XIM 23 | clients rather than handling IMProtocol directly. An XIM client is 24 | defined as an application program which is internationalized by using 25 | XIM API defined in X11R6. 26 | 27 | 1.2. Encapsulating actual IMProtocol operations 28 | 29 | IMdkit is designed to encapsulate the details of IMProtocol model. 30 | Using this kit, you don't have to deal with the actual byte-stream 31 | packets for yourselves, instead, you can use a set of data structures, 32 | each of which is corresponding to each actual IMProtocols, and you can 33 | deal with them in the same way as you deal with XEvent data structures. 34 | 35 | 1.3. Encapsulating Transport mechanism difference 36 | 37 | IMdkit is designed to encapsulate the transport mechanism, such as X 38 | Protocol, TCP/IP, Decnet, which are used in transmission of IMProtocol 39 | packets between Input Method library(IMlibrary, a part of Xlib) and 40 | IMserver. 41 | 42 | 1.4. Encapsulating Byte Order difference 43 | 44 | IMdkit is designed to encapsulate the difference in Byte Order 45 | between IMserver and clients, so IMservers using IMdkit can serve both 46 | little endian clients and Big endian clients at the same time, without 47 | taking care of the difference for themselves. 48 | 49 | 1.5. Encapsulating multiple IMProtocol models 50 | 51 | IMdkit is designed to be, to some extent, independent of IMProtocol 52 | model. At the current release, it deals with two different IMProtocol 53 | models, Ximp model, one of R5 sample IMProtocol models, and the R6 54 | standard IMProtocol model. 55 | 56 | 1.6. Modeled after XIM APIs 57 | 58 | IMdkit is to IMserver Developers what XIM is to I18N application 59 | Developers, so IMdkit is modeled after XIM APIs. For example: 60 | 61 | XIM has XOpenIM and XCloseIM, and IMdkit has IMOpenIM and 62 | IMCloseIM. 63 | 64 | XIM has a concept of IMValues and provides XSetIMValues and 65 | XGetIMValues to set and get them, and IMdkit also uses IMValues 66 | and provides IMSetIMValues and IMGetIMValues to set and get 67 | them. 68 | 69 | 2. Building 70 | 71 | There is one special build instruction. Please use xmkmf with -a 72 | option, and with the top directory(path to xc) and the path to 73 | the current directory from the top directory in order to make a 74 | Makefile, include all the necessary files and check dependency. 75 | Type: 76 | 77 | xmkmf -a path_to_top(xc)_directory \ 78 | path_from_top(xc)_to_current_directory 79 | 80 | This is because IMdkit refers to some files in xc/lib/xtrans 81 | directory to support X TransportServer mechinism. 82 | 83 | 3. Documents 84 | 85 | For any detailed information, please refer to the documentation in 86 | the doc/ subdirectory. 87 | 88 | 4. Testing 89 | 90 | The IMdkit has been built and tested with the current X11R6 release 91 | (patchlevel 1) on the following systems: 92 | 93 | FUJITSU DS 7742 UXP/DS V10L20 94 | IBM RS/6000 320H AIX 3.2.5 95 | Sony NWS-5000 NEWS-OS 6.0.2 96 | SPARCstation SunOS 4.1 97 | SPARCstation Solaris 2.3 98 | SPARCstation Solaris 2.4 99 | HP9000 S700 HP-UX9.01 100 | 101 | 5. Bug Reports 102 | 103 | If you find a reproducible bug in this software or the documentation, 104 | please send a bug report to the following destination address: 105 | 106 | tajima@Eng.Sun.Com 107 | 108 | 6. Acknowledgements 109 | 110 | I would like to thank all the members in xi18n sample implementation 111 | group for giving useful comments and suggestions and partcipating in 112 | tests of IMdkit: Takashi Fujiwara, Hideki Hiura, Yoshio Horiuchi, 113 | Makoto Inada, Hiromu Inukai, Hiroyuki Miyamoto, Makoto Wakamatsu, 114 | Masaki Wakao, Nobuyuki Tanaka, Shigeru Yamada and Katsuhisa Yano. And I 115 | would like to make special thanks to Hiromu Inukai, who is the principal 116 | author of the Ximp facilities, and special thanks to Makoto Inada and 117 | Hiroyuki Miyamoto for providing the Frame Manager Interfaces. 118 | -------------------------------------------------------------------------------- /src/xim_protocol.h: -------------------------------------------------------------------------------- 1 | static const char* xim_protocol_name[] = { 2 | "XIM_UNKNOWN", /* 0 */ 3 | "XIM_CONNECT", /* 1 */ 4 | "XIM_CONNECT_REPLY", /* 2 */ 5 | "XIM_DISCONNECT", /* 3 */ 6 | "XIM_DISCONNECT_REPLY", /* 4 */ 7 | "XIM_UNKNOWN", /* 5 */ 8 | "XIM_UNKNOWN", /* 6 */ 9 | "XIM_UNKNOWN", /* 7 */ 10 | "XIM_UNKNOWN", /* 8 */ 11 | "XIM_UNKNOWN", /* 9 */ 12 | "XIM_AUTH_REQUIRED", /* 10 */ 13 | "XIM_AUTH_REPLY", /* 11 */ 14 | "XIM_AUTH_NEXT", /* 12 */ 15 | "XIM_AUTH_SETUP", /* 13 */ 16 | "XIM_AUTH_NG", /* 14 */ 17 | "XIM_UNKNOWN", /* 15 */ 18 | "XIM_UNKNOWN", /* 16 */ 19 | "XIM_UNKNOWN", /* 17 */ 20 | "XIM_UNKNOWN", /* 18 */ 21 | "XIM_UNKNOWN", /* 19 */ 22 | "XIM_ERROR", /* 20 */ 23 | "XIM_UNKNOWN", /* 21 */ 24 | "XIM_UNKNOWN", /* 22 */ 25 | "XIM_UNKNOWN", /* 23 */ 26 | "XIM_UNKNOWN", /* 24 */ 27 | "XIM_UNKNOWN", /* 25 */ 28 | "XIM_UNKNOWN", /* 26 */ 29 | "XIM_UNKNOWN", /* 27 */ 30 | "XIM_UNKNOWN", /* 28 */ 31 | "XIM_UNKNOWN", /* 29 */ 32 | "XIM_OPEN", /* 30 */ 33 | "XIM_OPEN_REPLY", /* 31 */ 34 | "XIM_CLOSE", /* 32 */ 35 | "XIM_CLOSE_REPLY", /* 33 */ 36 | "XIM_REGISTER_TRIGGERKEYS", /* 34 */ 37 | "XIM_TRIGGER_NOTIFY", /* 35 */ 38 | "XIM_TRIGGER_NOTIFY_REPLY", /* 36 */ 39 | "XIM_SET_EVENT_MASK", /* 37 */ 40 | "XIM_ENCODING_NEGOTIATION", /* 38 */ 41 | "XIM_ENCODING_NEGOTIATION_REPLY", /* 39 */ 42 | "XIM_QUERY_EXTENSION", /* 40 */ 43 | "XIM_QUERY_EXTENSION_REPLY", /* 41 */ 44 | "XIM_SET_IM_VALUES", /* 42 */ 45 | "XIM_SET_IM_VALUES_REPLY", /* 43 */ 46 | "XIM_GET_IM_VALUES", /* 44 */ 47 | "XIM_GET_IM_VALUES_REPLY", /* 45 */ 48 | "XIM_UNKNOWN", /* 46 */ 49 | "XIM_UNKNOWN", /* 47 */ 50 | "XIM_UNKNOWN", /* 48 */ 51 | "XIM_UNKNOWN", /* 49 */ 52 | "XIM_CREATE_IC", /* 50 */ 53 | "XIM_CREATE_IC_REPLY", /* 51 */ 54 | "XIM_DESTROY_IC", /* 52 */ 55 | "XIM_DESTROY_IC_REPLY", /* 53 */ 56 | "XIM_SET_IC_VALUES", /* 54 */ 57 | "XIM_SET_IC_VALUES_REPLY", /* 55 */ 58 | "XIM_GET_IC_VALUES", /* 56 */ 59 | "XIM_GET_IC_VALUES_REPLY", /* 57 */ 60 | "XIM_SET_IC_FOCUS", /* 58 */ 61 | "XIM_UNSET_IC_FOCUS", /* 59 */ 62 | "XIM_FORWARD_EVENT", /* 60 */ 63 | "XIM_SYNC", /* 61 */ 64 | "XIM_SYNC_REPLY", /* 62 */ 65 | "XIM_COMMIT", /* 63 */ 66 | "XIM_RESET_IC", /* 64 */ 67 | "XIM_RESET_IC_REPLY", /* 65 */ 68 | "XIM_UNKNOWN", /* 66 */ 69 | "XIM_UNKNOWN", /* 67 */ 70 | "XIM_UNKNOWN", /* 68 */ 71 | "XIM_UNKNOWN", /* 69 */ 72 | "XIM_GEOMETRY", /* 70 */ 73 | "XIM_STR_CONVERSION", /* 71 */ 74 | "XIM_STR_CONVERSION_REPLY", /* 72 */ 75 | "XIM_PREEDIT_START", /* 73 */ 76 | "XIM_PREEDIT_START_REPLY", /* 74 */ 77 | "XIM_PREEDIT_DRAW", /* 75 */ 78 | "XIM_PREEDIT_CARET", /* 76 */ 79 | "XIM_PREEDIT_CARET_REPLY", /* 77 */ 80 | "XIM_PREEDIT_DONE", /* 78 */ 81 | "XIM_STATUS_START", /* 79 */ 82 | "XIM_STATUS_DRAW", /* 80 */ 83 | "XIM_STATUS_DONE", /* 81 */ 84 | }; 85 | -------------------------------------------------------------------------------- /IMdkit/IMdkit.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #ifndef _IMdkit_h 33 | #define _IMdkit_h 34 | 35 | #include 36 | 37 | /* IM Attributes Name */ 38 | #define IMModifiers "modifiers" 39 | #define IMServerWindow "serverWindow" 40 | #define IMServerName "serverName" 41 | #define IMServerTransport "serverTransport" 42 | #define IMLocale "locale" 43 | #define IMInputStyles "inputStyles" 44 | #define IMProtocolHandler "protocolHandler" 45 | #define IMOnKeysList "onKeysList" 46 | #define IMOffKeysList "offKeysList" 47 | #define IMEncodingList "encodingList" 48 | #define IMFilterEventMask "filterEventMask" 49 | #define IMProtocolDepend "protocolDepend" 50 | 51 | /* Masks for IM Attributes Name */ 52 | #define I18N_IMSERVER_WIN 0x0001 /* IMServerWindow */ 53 | #define I18N_IM_NAME 0x0002 /* IMServerName */ 54 | #define I18N_IM_LOCALE 0x0004 /* IMLocale */ 55 | #define I18N_IM_ADDRESS 0x0008 /* IMServerTransport */ 56 | #define I18N_INPUT_STYLES 0x0010 /* IMInputStyles */ 57 | #define I18N_ON_KEYS 0x0020 /* IMOnKeysList */ 58 | #define I18N_OFF_KEYS 0x0040 /* IMOffKeysList */ 59 | #define I18N_IM_HANDLER 0x0080 /* IMProtocolHander */ 60 | #define I18N_ENCODINGS 0x0100 /* IMEncodingList */ 61 | #define I18N_FILTERMASK 0x0200 /* IMFilterEventMask */ 62 | #define I18N_PROTO_DEPEND 0x0400 /* IMProtoDepend */ 63 | 64 | typedef struct 65 | { 66 | char *name; 67 | XPointer value; 68 | } XIMArg; 69 | 70 | typedef struct 71 | { 72 | CARD32 keysym; 73 | CARD32 modifier; 74 | CARD32 modifier_mask; 75 | } XIMTriggerKey; 76 | 77 | typedef struct 78 | { 79 | unsigned short count_keys; 80 | XIMTriggerKey *keylist; 81 | } XIMTriggerKeys; 82 | 83 | typedef char *XIMEncoding; 84 | 85 | typedef struct 86 | { 87 | unsigned short count_encodings; 88 | XIMEncoding *supported_encodings; 89 | } XIMEncodings; 90 | 91 | typedef struct _XIMS *XIMS; 92 | 93 | typedef struct 94 | { 95 | void* (*setup) (Display *, XIMArg *); 96 | Status (*openIM) (XIMS); 97 | Status (*closeIM) (XIMS); 98 | char* (*setIMValues) (XIMS, XIMArg *); 99 | char* (*getIMValues) (XIMS, XIMArg *); 100 | Status (*forwardEvent) (XIMS, XPointer); 101 | Status (*commitString) (XIMS, XPointer); 102 | int (*callCallback) (XIMS, XPointer); 103 | int (*preeditStart) (XIMS, XPointer); 104 | int (*preeditEnd) (XIMS, XPointer); 105 | int (*syncXlib) (XIMS, XPointer); 106 | } IMMethodsRec, *IMMethods; 107 | 108 | typedef struct 109 | { 110 | Display *display; 111 | int screen; 112 | } IMCoreRec, *IMCore; 113 | 114 | typedef struct _XIMS 115 | { 116 | IMMethods methods; 117 | IMCoreRec core; 118 | Bool sync; 119 | void *protocol; 120 | } XIMProtocolRec; 121 | 122 | /* 123 | * X function declarations. 124 | */ 125 | extern XIMS IMOpenIM (Display *, ...); 126 | extern Status IMCloseIM (XIMS); 127 | extern char *IMSetIMValues (XIMS, ...); 128 | extern char *IMGetIMValues (XIMS, ...); 129 | void IMForwardEvent (XIMS, XPointer); 130 | void IMCommitString (XIMS, XPointer); 131 | int IMCallCallback (XIMS, XPointer); 132 | int IMPreeditStart (XIMS, XPointer); 133 | int IMPreeditEnd (XIMS, XPointer); 134 | int IMSyncXlib (XIMS, XPointer); 135 | 136 | #endif /* IMdkit_h */ 137 | -------------------------------------------------------------------------------- /IMdkit/IMConn.c: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #include 33 | #include 34 | #include 35 | #include "IMdkit.h" 36 | #include 37 | 38 | #define Va_start(a,b) va_start(a,b) 39 | 40 | static void _IMCountVaList(va_list var, int *total_count) 41 | { 42 | char *attr; 43 | 44 | *total_count = 0; 45 | 46 | for (attr = va_arg (var, char*); attr; attr = va_arg (var, char*)) 47 | { 48 | (void)va_arg (var, XIMArg *); 49 | ++(*total_count); 50 | } 51 | /*endfor*/ 52 | } 53 | 54 | static void _IMVaToNestedList(va_list var, int max_count, XIMArg **args_return) 55 | { 56 | XIMArg *args; 57 | char *attr; 58 | 59 | if (max_count <= 0) 60 | { 61 | *args_return = (XIMArg *) NULL; 62 | return; 63 | } 64 | /*endif*/ 65 | 66 | args = (XIMArg *) malloc ((unsigned) (max_count + 1)*sizeof (XIMArg)); 67 | *args_return = args; 68 | if (!args) 69 | return; 70 | /*endif*/ 71 | 72 | for (attr = va_arg (var, char*); attr; attr = va_arg (var, char *)) 73 | { 74 | args->name = attr; 75 | args->value = va_arg (var, XPointer); 76 | args++; 77 | } 78 | /*endfor*/ 79 | args->name = (char*)NULL; 80 | } 81 | 82 | static char *_FindModifiers (XIMArg *args) 83 | { 84 | char *modifiers; 85 | 86 | while (args->name) 87 | { 88 | if (strcmp (args->name, IMModifiers) == 0) 89 | { 90 | modifiers = args->value; 91 | return modifiers; 92 | } 93 | else 94 | { 95 | args++; 96 | } 97 | /*endif*/ 98 | } 99 | /*endwhile*/ 100 | return NULL; 101 | } 102 | 103 | XIMS _GetIMS (char *modifiers) 104 | { 105 | XIMS ims; 106 | extern IMMethodsRec Xi18n_im_methods; 107 | 108 | if ((ims = (XIMS) malloc (sizeof (XIMProtocolRec))) == (XIMS) NULL) 109 | return ((XIMS) NULL); 110 | /*endif*/ 111 | memset ((void *) ims, 0, sizeof (XIMProtocolRec)); 112 | 113 | if (modifiers == NULL 114 | || 115 | modifiers[0] == '\0' 116 | || 117 | strcmp (modifiers, "Xi18n") == 0) 118 | { 119 | ims->methods = &Xi18n_im_methods; 120 | return ims; 121 | } 122 | /*endif*/ 123 | free (ims); 124 | return (XIMS) NULL; 125 | } 126 | 127 | XIMS IMOpenIM (Display *display, ...) 128 | { 129 | va_list var; 130 | int total_count; 131 | XIMArg *args; 132 | XIMS ims; 133 | char *modifiers; 134 | Status ret; 135 | 136 | Va_start (var, display); 137 | _IMCountVaList (var, &total_count); 138 | va_end (var); 139 | 140 | Va_start (var, display); 141 | _IMVaToNestedList (var, total_count, &args); 142 | va_end (var); 143 | 144 | modifiers = _FindModifiers (args); 145 | 146 | ims = _GetIMS (modifiers); 147 | if (ims == (XIMS) NULL) 148 | return (XIMS) NULL; 149 | /*endif*/ 150 | 151 | ims->core.display = display; 152 | 153 | ims->protocol = (*ims->methods->setup) (display, args); 154 | XFree (args); 155 | if (ims->protocol == (void *) NULL) 156 | { 157 | XFree (ims); 158 | return (XIMS) NULL; 159 | } 160 | /*endif*/ 161 | ret = (ims->methods->openIM) (ims); 162 | if (ret == False) 163 | { 164 | XFree (ims); 165 | return (XIMS) NULL; 166 | } 167 | /*endif*/ 168 | return (XIMS) ims; 169 | } 170 | 171 | Status IMCloseIM (XIMS ims) 172 | { 173 | (ims->methods->closeIM) (ims); 174 | XFree (ims); 175 | return True; 176 | } 177 | -------------------------------------------------------------------------------- /IMdkit/FrameMgr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts, 3 | 4 | All Rights Reserved 5 | 6 | Permission to use, copy, modify, and distribute this software and its 7 | documentation for any purpose and without fee is hereby granted, 8 | provided that the above copyright notice appear in all copies and that 9 | both that copyright notice and this permission notice appear in 10 | supporting documentation, and that the names of Digital or MIT not be 11 | used in advertising or publicity pertaining to distribution of the 12 | software without specific, written prior permission. 13 | 14 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 16 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 17 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 19 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20 | SOFTWARE. 21 | 22 | Author: Hiroyuki Miyamoto Digital Equipment Corporation 23 | miyamoto@jrd.dec.com 24 | 25 | This version tidied and debugged by Steve Underwood May 1999 26 | 27 | ******************************************************************/ 28 | 29 | #ifndef FRAMEMGR_H 30 | #define FRAMEMGR_H 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #if defined(VAXC) && !defined(__DECC) 37 | #define xim_externalref globalref 38 | #define xim_externaldef globaldef 39 | #else 40 | #define xim_externalref extern 41 | #define xim_externaldef 42 | #endif 43 | 44 | /* Definitions for FrameMgr */ 45 | 46 | #define COUNTER_MASK 0x10 47 | 48 | typedef enum 49 | { 50 | BIT8 = 0x1, /* {CARD8* | INT8*} */ 51 | BIT16 = 0x2, /* {CARD16* | INT16*} */ 52 | BIT32 = 0x3, /* {CARD32* | INT32*} */ 53 | BIT64 = 0x4, /* {CARD64* | INT64*} */ 54 | BARRAY = 0x5, /* int*, void* */ 55 | ITER = 0x6, /* int* */ 56 | POINTER = 0x7, /* specifies next item is a PTR_ITEM */ 57 | PTR_ITEM = 0x8, /* specifies the item has a pointer */ 58 | /* BOGUS - POINTER and PTR_ITEM 59 | * In the current implementation, PTR_ITEM should be lead by 60 | * POINTER. But actually, it's just redundant logically. Someone 61 | * may remove this redundancy and POINTER from the enum member but he 62 | * should also modify the logic in FrameMgr program. 63 | */ 64 | PADDING = 0x9, /* specifies that a padding is needed. 65 | * This requires extra data in data field. 66 | */ 67 | EOL = 0xA, /* specifies the end of list */ 68 | 69 | COUNTER_BIT8 = COUNTER_MASK | 0x1, 70 | COUNTER_BIT16 = COUNTER_MASK | 0x2, 71 | COUNTER_BIT32 = COUNTER_MASK | 0x3, 72 | COUNTER_BIT64 = COUNTER_MASK | 0x4 73 | } XimFrameType; 74 | 75 | /* Convenient macro */ 76 | #define _FRAME(a) {a, NULL} 77 | #define _PTR(p) {PTR_ITEM, (void *)p} 78 | /* PADDING's usage of data field 79 | * B15-B8 : Shows the number of effective items. 80 | * B7-B0 : Shows padding unit. ex) 04 shows 4 unit padding. 81 | */ 82 | #define _PAD2(n) {PADDING, (void*)((n)<<8|2)} 83 | #define _PAD4(n) {PADDING, (void*)((n)<<8|4)} 84 | 85 | #define FmCounterByte 0 86 | #define FmCounterNumber 1 87 | 88 | #define _BYTE_COUNTER(type, offset) \ 89 | {(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterByte)} 90 | 91 | #define _NUMBER_COUNTER(type, offset) \ 92 | {(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterNumber)} 93 | 94 | typedef struct _XimFrame 95 | { 96 | XimFrameType type; 97 | void* data; /* For PTR_ITEM and PADDING */ 98 | } XimFrameRec, *XimFrame; 99 | 100 | typedef enum 101 | { 102 | FmSuccess, 103 | FmEOD, 104 | FmInvalidCall, 105 | FmBufExist, 106 | FmCannotCalc, 107 | FmNoMoreData 108 | } FmStatus; 109 | 110 | typedef struct _FrameMgr *FrameMgr; 111 | 112 | FrameMgr FrameMgrInit(XimFrame frame, char* area, Bool byte_swap); 113 | void FrameMgrInitWithData(FrameMgr fm, XimFrame frame, void* area, 114 | Bool byte_swap); 115 | void FrameMgrFree(FrameMgr fm); 116 | FmStatus FrameMgrSetBuffer(FrameMgr, void*); 117 | FmStatus _FrameMgrPutToken(FrameMgr, void*, int); 118 | FmStatus _FrameMgrGetToken(FrameMgr, void*, int); 119 | FmStatus FrameMgrSetSize(FrameMgr, int); 120 | FmStatus FrameMgrSetIterCount(FrameMgr, int); 121 | FmStatus FrameMgrSetTotalSize(FrameMgr, int); 122 | int FrameMgrGetTotalSize(FrameMgr); 123 | int FrameMgrGetSize(FrameMgr); 124 | FmStatus FrameMgrSkipToken(FrameMgr, int); 125 | void FrameMgrReset(FrameMgr); 126 | Bool FrameMgrIsIterLoopEnd(FrameMgr, FmStatus*); 127 | 128 | #define FrameMgrPutToken(fm, obj) _FrameMgrPutToken((fm), &(obj), sizeof(obj)) 129 | #define FrameMgrGetToken(fm, obj) _FrameMgrGetToken((fm), &(obj), sizeof(obj)) 130 | 131 | #endif /* FRAMEMGR_H */ 132 | -------------------------------------------------------------------------------- /src/keycapturedialog.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #include "keycapturedialog.h" 24 | 25 | static char key_label_text[256] = { '\0', }; 26 | 27 | static gboolean 28 | on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) 29 | { 30 | gchar *keys; 31 | GString *str; 32 | GtkWidget *label; 33 | gchar markup_str[256]; 34 | 35 | gtk_dialog_set_response_sensitive(GTK_DIALOG(widget), 36 | GTK_RESPONSE_OK, TRUE); 37 | label = g_object_get_data(G_OBJECT(widget), "key-text-label"); 38 | 39 | str = g_string_new(""); 40 | if (event->state & GDK_CONTROL_MASK) { 41 | g_string_append(str, "Control+"); 42 | } 43 | if (event->state & GDK_SHIFT_MASK) { 44 | g_string_append(str, "Shift+"); 45 | } 46 | if (event->state & GDK_MOD1_MASK) { 47 | g_string_append(str, "Alt+"); 48 | } 49 | if (event->state & GDK_MOD4_MASK) { 50 | g_string_append(str, "Super+"); 51 | } 52 | 53 | keys = gdk_keyval_name(event->keyval); 54 | if (keys == NULL) 55 | keys = ""; 56 | str = g_string_append(str, keys); 57 | g_strlcpy(key_label_text, str->str, sizeof(key_label_text)); 58 | 59 | g_snprintf(markup_str, sizeof(markup_str), 60 | "%s", str->str); 61 | gtk_label_set_markup(GTK_LABEL(label), markup_str); 62 | 63 | gtk_window_present(GTK_WINDOW(widget)); 64 | 65 | return TRUE; 66 | } 67 | 68 | GtkWidget* 69 | key_capture_dialog_new(const gchar *title, 70 | GtkWindow *parent, 71 | const gchar *key_text, 72 | const gchar *message_format, ...) 73 | { 74 | GtkWidget *dialog; 75 | GtkWidget *image; 76 | GtkWidget *message_label; 77 | GtkWidget *key_label; 78 | GtkWidget *hbox; 79 | GtkWidget *vbox; 80 | gchar markup_str[256]; 81 | 82 | dialog = gtk_dialog_new_with_buttons(title, 83 | parent, 84 | GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR, 85 | GTK_STOCK_OK, GTK_RESPONSE_OK, 86 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 87 | NULL); 88 | 89 | gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE); 90 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 6); 91 | 92 | vbox = gtk_vbox_new(FALSE, 0); 93 | 94 | message_label = gtk_label_new (NULL); 95 | gtk_label_set_line_wrap (GTK_LABEL(message_label), TRUE); 96 | gtk_box_pack_start(GTK_BOX(vbox), message_label, FALSE, FALSE, 0); 97 | g_object_set_data(G_OBJECT(dialog), "message-label", message_label); 98 | if (message_format != NULL) { 99 | gchar *msg; 100 | va_list args; 101 | 102 | va_start(args, message_format); 103 | msg = g_strdup_vprintf(message_format, args); 104 | va_end(args); 105 | 106 | gtk_label_set_markup(GTK_LABEL(message_label), msg); 107 | g_free(msg); 108 | } 109 | 110 | key_label = gtk_label_new(""); 111 | gtk_label_set_line_wrap (GTK_LABEL(key_label), FALSE); 112 | gtk_label_set_use_markup(GTK_LABEL(key_label), TRUE); 113 | g_snprintf(markup_str, sizeof(markup_str), 114 | "%s", key_text); 115 | g_strlcpy(key_label_text, key_text, sizeof(key_label_text)); 116 | gtk_label_set_markup(GTK_LABEL(key_label), markup_str); 117 | gtk_widget_show(key_label); 118 | g_object_set_data(G_OBJECT(dialog), "key-text-label", key_label); 119 | 120 | image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, 121 | GTK_ICON_SIZE_DIALOG); 122 | gtk_misc_set_alignment (GTK_MISC(image), 0.5, 0.0); 123 | 124 | hbox = gtk_hbox_new (FALSE, 6); 125 | gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); 126 | gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 6); 127 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 6); 128 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), key_label, FALSE, FALSE, 0); 129 | 130 | gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 131 | GTK_RESPONSE_OK, FALSE); 132 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); 133 | gtk_widget_show_all (hbox); 134 | 135 | g_signal_connect(G_OBJECT(dialog), "key-press-event", 136 | G_CALLBACK(on_key_press), dialog); 137 | 138 | return dialog; 139 | } 140 | 141 | G_CONST_RETURN gchar * 142 | key_capture_dialog_get_key_text(GtkWidget *dialog) 143 | { 144 | return key_label_text; 145 | } 146 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 나비 1.0.0 2 | * 기호 입력 목록 업데이트 3 | * 아이콘 테마 추가: malys 4 | * 쿼티 자판을 사용하지 않는 경우의 문제 수정 5 | http://code.google.com/p/nabi/issues/detail?id=3 6 | * 한자 선택 창의 크기를 제한 7 | 8 | 나비 0.99.11 9 | * 드보락과 세벌식을 같이 쓸때 '/'가 'ㅁ'으로 입력되는 문제 수정 10 | * 영문 자판과 시스템 키맵 사용 옵션에 대한 UI 개선 11 | 12 | 나비 0.99.10 13 | * 오페라 브라우저에서 글자가 두번 입력되는 문제 (#316115) 14 | http://kldp.net/projects/nabi/issue/316115 15 | * gtk 2.16 이하에서 컴파일 안되는 문제 수정 (#316453) 16 | http://kldp.net/projects/nabi/issue/316453 17 | * 로마자 자판의 대소문자 처리 문제 수정 (libhangul 0.1.0 이상 필요) 18 | * 트레이 아이콘이 로딩되지 않으면 팔레트를 숨길수 없게 함 19 | 20 | 나비 0.99.9 21 | * 버그 수정: #315977 firefox4 에서 backspace로 글자가 안지워지는 문제 22 | * 버그 수정: #315744 wine 1.2에서 한글 상태에서 공백이 뒤에 입력 되는 문제 23 | * GtkStatusIcon 사용 24 | - 우분투 10.10에서 트레이 아이콘 배경이 희게 나오는 문제 수정 25 | 26 | 나비 0.99.8 27 | * Ubuntu 테마 추가 28 | * Colemak 관련 버그 수정 (#315056, #315058) 29 | * 동적 자판 목록 업데이트 (libhangul 0.0.12 이상) 30 | 두벌식 옛한글 지원(#315130), 안마태 자판 지원 31 | * Over the spot 모드에서 지정된 fontset을 사용할 수 있도록 하는 옵션 추가 32 | * 기본 동작을 system keymap을 무시하고 내장 keymap으로 작동 33 | (qwerty가 아닌 자판을 기본 자판으로 설정했을때 문제 처리) 34 | * 빌드할때 테마를 지정할 수 있는 옵션 추가 35 | * 코드 정리 36 | 37 | 나비 0.99.7 38 | * 한자 전용 모드 구현 39 | * 어플리케이션과 nabi의 locale이 달라도 UTF-8 이면 한글입력이 40 | 가능하도록 함 41 | * X window에서 fontset을 생성할 수 없을때에도 preedit string을 그릴 수 42 | 있도록 함 (#315002) 43 | * Colemak 자판 지원 (http://kldp.net/projects/nabi/forum/309771) 44 | * 버그 수정 45 | 46 | 나비 0.99.6 47 | * 버그수정: [#305368] 알림영역에 들어가지 않는 문제 48 | 최근 버젼의 배포판에서 자동으로 알림영역(Notification Area)에 들어가지 49 | 않던 문제를 해결 50 | 51 | 나비 0.99.5 52 | * 로마자 자판 지원 (libhangul 0.0.10 필요) 53 | * pango 1.16 이하 버젼 지원 (Centos 5.3 지원) 54 | * 버그수정: [#305339] 나비 입력상태 설정 저장 리셋 버그 55 | 56 | 나비 0.99.4 57 | * 설정창에 "초기값으로" 변경하는 버튼 추가 58 | * 시작할때 한글 모드로 시작할 수 있는 옵션 추가 59 | * tray icon을 사용하지 않을 수 있는 옵션 추가 60 | * gvim에서 한글 상태에서 커맨드 모드에서 엔터치면 멈추는 문제 해결(#305259) 61 | * String conversion 기능 구현(그러나 아직 xlib수준에서 지원하지 않고 있음) 62 | * 내부 구현 개선, 버그 수정 63 | 64 | 나비 0.99.3 65 | * 내부 코드 개선 66 | * off the spot, root window에서 사용하는 입력 중인 글자 글꼴 설정 옵션 추가 67 | * 한글 모드에서 한영 키가 작동하지 않는 문제 수정(#304811) 68 | * 자판 변경후 툴팁이 바뀌지 않는 문제 수정(#305100) 69 | 70 | 나비 0.99.2 71 | * 독일어 번역 업데이트 (Thanks to Niklaus Giger) 72 | * 간체자 설정 기본값 버그 수정 (#304722) 73 | * 옛글 자판에서 한자 변환 버그 수정 (#304770) 74 | * 옛글 자판과 현재글 자판 변환할때 모드 변환 버그 수정(#304770) 75 | * 키보드 설정 관련 버그 수정 (#304700) 76 | * svg 아이콘을 먼저 사용하도록 함 77 | * 몇가지 메모리 릭 수정 78 | 79 | 나비 0.99.1 80 | * ic 관리 루틴 개선 81 | * 사용하다가 갑자기 프로그램에 입력이 안되는 문제 해결(#300802,#300723) 82 | 참고: http://bugs.freedesktop.org/show_bug.cgi?id=7869 83 | * 입력모드를 영어 상태로 바꾸는 키 설정 기능 추가(#304688) 84 | * 몇가지 코드 정리 85 | 86 | 나비 0.99.0 87 | * 입력 상태 관리 기능을 개선 88 | * 한자를 간체자로 입력하는 기능 추가 89 | * 프랑스어 자판의 버그 수정(#304587) 90 | * 패널이 세로 방향으로 있을때 발생하는 버그 수정(#304681) 91 | * systray 프로그램이 갑작스럽게 죽는 경우 처리(#300760) 92 | 93 | 나비 0.19 94 | * 라이센스 문제의 소지가 있는 테마 아이콘 제거(MSWindowS, MSWindowsXP, Mac) 95 | * 새로운 테마 추가(KingSejong2, Thanks to Stefan Krämer) 96 | * 자음으로 기호 입력하는 기능 구현 97 | * 자잘한 버그 수정 98 | 99 | 나비 0.18 100 | * 팔레트 모양 개선 101 | * 한자 입력 포맷 지원 102 | * 디버그 메시지 출력 개선 103 | * 단일 한영 모드 옵션 추가 104 | * X 종료시 설정 저장 105 | 106 | 나비 0.17 107 | * 다이나믹 이벤트 처리 옵션 추가 108 | * 단어 단위 입력 기능 추가 109 | * 자동 순서 교정 옵션 추가 110 | * over the spot에서 preedit string 그리는 루틴 개선 111 | * 한영전환시 마지막 글자가 없어지는 문제 해결 112 | * svg 아이콘을 로딩하지 못할때 발생하던 오류 수정 113 | * EUC-KR 로켈에서 세벌식 기호 일부가 입력되지 않던 문제 해결 114 | * 몇몇 자잘한 버그 수정 115 | 116 | 나비 0.16 117 | * libhangul 적용 118 | * 유럽어 자판 지원 기능 구현(프랑스, 독일어 자판) 119 | * 테스트 코드 추가 120 | * 번역 추가 (독일어: Thanks to Niklaus Giger) 121 | 122 | 나비 0.15 123 | * 순아래, 옛글자판 추가 124 | * 아이콘 업데이트 (bluetux님 제공) 125 | * Tux 테마 추가 (exman님 제공) 126 | * 한영 전환, 한자 키 설정 기능 제공 127 | 128 | 나비 0.14 129 | * 설정창 제공 130 | * java 프로그램에서 한글 입력을 더 자연스럽게 수정 131 | * 한자/심벌 입력리스트에서 갯수를 9개로 수정 132 | * 지원하지 않는 locale의 경우 워닝 출력 133 | * en_US.UTF-8 locale에서도 한글 입력 지원 134 | 135 | 나비 0.13 136 | * 세션기능 지원 137 | * 한자 입력시 뜻도 보여줌 138 | * 메모리 릭 문제 등 자잘한 버그 수정 139 | 140 | 나비 0.12 141 | * 트레이 아이콘이 사라지면서 죽는 버그 수정 142 | * 트레이 아이콘 크기를 좀더 똑똑하게 처리함 143 | * MS Windows 2000 테마 추가 144 | * XIM 관련 버그 몇가지 수정 145 | 146 | 나비 0.11 147 | * 메인 윈도우 제공 (시스템트레이를 제공하지 않는 곳에서도 설정가능) 148 | * 세벌식에서 조합중인 글자를 제대로 표현하지 못하던 문제 수정 149 | * 상태정보만 보여주기 위한 -s (--status-only) 옵션 추가 150 | * 나비를 종료하면 gtk2 app가 죽던 문제 수정 151 | * 간단한 몇가지 버그 수정 152 | 153 | 나비 0.10 154 | * 한자 입력 창 개선 155 | * 심벌 문자 입력 기능 156 | 157 | 나비 0.9 158 | * NetBSD, FreeBSD의 EUC-KR locale에서 한글 정상 입력 159 | * Qt에서 한자 입력시 안보이던 문제 수정 160 | 161 | 나비 0.8 162 | * Over the spot 개선 163 | * EUC-KR charset을 좀더 정확히 구분 164 | * About menu에서 키 입력에 대한 간단한 정보 제공 165 | 166 | 나비 0.7 167 | * QT-3.1.2, 3.2.1 에서 한글 입력 됩니다. 대신 모질라에서 한글 입력할때 168 | 깜빡임이 좀 많아집니다. 169 | * F9 키도 한자 입력에 사용할 수 있습니다. 170 | 171 | 나비 0.6 172 | * 세벌식 입력 버그 수정 173 | * 한자 입력 기능 지원 174 | * 세션 관리자 지원 175 | 176 | 나비 0.5 177 | * 드보락 자판 지원 178 | * system tray가 죽어도 종료하지 않음 179 | 180 | 나비 0.4 181 | * 폰트셋 로딩 속도가 빨라짐 182 | * 각 프로세스 별로 한영 상태를 따로 저장 183 | * configure 할때에 기본 자판 설정이 가능해짐 184 | 185 | 나비 0.3 186 | * Mozill3 flash player 에서 가끔 죽던 문제 해결 187 | 188 | 나비 0.2 189 | - 종료시에 메모리 오류 수정 190 | - NumLock이 켜졌을때 제대로 작동하지 않던 문제점 수정 191 | - vi 사용자들을 위해서 Esc 키를 누른 경우 자동으로 영문 상태로 변환함 192 | 193 | 나비 0.1 194 | imhangul_status_applet을 대신할수 있는 프로그램입니다. 195 | 196 | GNOME panel의 Notification Area(System Tray)에 들어가는 프로그램으로 아마도 197 | KDE에서도 도킹이 가능할겁니다. 198 | gtk의 input module인 imhangul의 상태 정보를 보여줄수 있으며 199 | XMODIFIER="@im=nabi" 라고 설정하면 한글 입력기로도 사용할수 있습니다. 200 | 201 | -------------------------------------------------------------------------------- /tables/keyboard/39qwerty: -------------------------------------------------------------------------------- 1 | Name: 3 set 390 2 | 3 | U0021 U11BD # GDK_exclam: jongseong cieuc 4 | U0022 U0022 # GDK_quotedbl: quotatioin mark 5 | U0023 U0023 # GDK_numbersign: number sign 6 | U0024 U0024 # GDK_dollar: dollar sign 7 | U0025 U0025 # GDK_percent: percent sign 8 | U0026 U0026 # GDK_ampersand: ampersand 9 | U0027 U1110 # GDK_apostrophe: choseong thieuth 10 | U0028 U0028 # GDK_parenleft: left parenthesis 11 | U0029 U0029 # GDK_parenright: right parenthesis 12 | U002A U002A # GDK_asterisk: asterisk 13 | U002B U002B # GDK_plus: plus sign 14 | U002C U002C # GDK_comma: comma 15 | U002D U002D # GDK_minus: minus sign 16 | U002E U002E # GDK_period: period 17 | U002F U1169 # GDK_slash: jungseong o 18 | U0030 U110F # GDK_0: choseong khieukh 19 | U0031 U11C2 # GDK_1: jongseong hieuh 20 | U0032 U11BB # GDK_2: jongseong ssangsios 21 | U0033 U11B8 # GDK_3: jongseong pieup 22 | U0034 U116D # GDK_4: jungseong yo 23 | U0035 U1172 # GDK_5: jungseong yu 24 | U0036 U1163 # GDK_6: jungseong ya 25 | U0037 U1168 # GDK_7: jungseong ye 26 | U0038 U1174 # GDK_8: jungseong yi 27 | U0039 U116E # GDK_9: jungseong u 28 | U003A U003A # GDK_colon: colon 29 | U003B U1107 # GDK_semicolon: choseong pieup 30 | U003C U0032 # GDK_less: 2 31 | U003D U003D # GDK_equal: euals sign 32 | U003E U0033 # GDK_greater: 3 33 | U003F U003F # GDK_question: question mark 34 | U0040 U0040 # GDK_at: commertial at 35 | U0041 U11AE # GDK_A: jongseong tikeut 36 | U0042 U0021 # GDK_B: exclamation mark 37 | U0043 U11B1 # GDK_C: jongseong rieul-mieum 38 | U0044 U11B0 # GDK_D: jongseong rieul-kiyeok 39 | U0045 U11BF # GDK_E: jongseong khieukh 40 | U0046 U11A9 # GDK_F: jongseong ssangkiyeok 41 | U0047 U002F # GDK_G: slash 42 | U0048 U0027 # GDK_H: apostrophe 43 | U0049 U0038 # GDK_I: 8 44 | U004A U0034 # GDK_J: 4 45 | U004B U0035 # GDK_K: 5 46 | U004C U0036 # GDK_L: 6 47 | U004D U0031 # GDK_M: 1 48 | U004E U0030 # GDK_N: 0 49 | U004F U0039 # GDK_O: 9 50 | U0050 U003E # GDK_P: greater-than sign 51 | U0051 U11C1 # GDK_Q: jongseong phieuph 52 | U0052 U1164 # GDK_R: jungseong yae 53 | U0053 U11AD # GDK_S: jongseong nieun-hieuh 54 | U0054 U003B # GDK_T: semicolon 55 | U0055 U0037 # GDK_U: 7 56 | U0056 U11B6 # GDK_V: jongseong rieul-hieuh 57 | U0057 U11C0 # GDK_W: jongseong thikeuth 58 | U0058 U11B9 # GDK_X: jongseong pieup-sios 59 | U0059 U003C # GDK_Y: less-than sign 60 | U005A U11BE # GDK_Z: jongseong chieuch 61 | U005B U005B # GDK_bracketleft: left bracket 62 | U005C U005C # GDK_backslash: backslash 63 | U005D U005D # GDK_bracketright: right bracket 64 | U005E U005E # GDK_asciicircum: circumflex accent 65 | U005F U005F # GDK_underscore: underscore 66 | U0060 U0060 # GDK_quoteleft: grave accent 67 | U0061 U11BC # GDK_a: jongseong ieung 68 | U0062 U116E # GDK_b: jungseong u 69 | U0063 U1166 # GDK_c: jungseong e 70 | U0064 U1175 # GDK_d: jungseong i 71 | U0065 U1167 # GDK_e: jungseong yeo 72 | U0066 U1161 # GDK_f: jungseong a 73 | U0067 U1173 # GDK_g: jungseong eu 74 | U0068 U1102 # GDK_h: choseong nieun 75 | U0069 U1106 # GDK_i: choseong mieum 76 | U006A U110B # GDK_j: choseong ieung 77 | U006B U1100 # GDK_k: choseong kiyeok 78 | U006C U110C # GDK_l: choseong cieuc 79 | U006D U1112 # GDK_m: choseong hieuh 80 | U006E U1109 # GDK_n: choseong sios 81 | U006F U110E # GDK_o: choseong chieuch 82 | U0070 U1111 # GDK_p: choseong phieuph 83 | U0071 U11BA # GDK_q: jongseong sios 84 | U0072 U1162 # GDK_r: jungseong ae 85 | U0073 U11AB # GDK_s: jongseong nieun 86 | U0074 U1165 # GDK_t: jungseong eo 87 | U0075 U1103 # GDK_u: choseong tikeut 88 | U0076 U1169 # GDK_v: jungseong o 89 | U0077 U11AF # GDK_w: jongseong rieul 90 | U0078 U11A8 # GDK_x: jongseong kiyeok 91 | U0079 U1105 # GDK_y: choseong rieul 92 | U007A U11B7 # GDK_z: jongseong mieum 93 | U007B U007B # GDK_braceleft: left brace 94 | U007C U007C # GDK_bar: vertical line(bar) 95 | U007D U007D # GDK_braceright: right brace 96 | U007E U007E # GDK_asciitilde: tilde 97 | -------------------------------------------------------------------------------- /src/fontset.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "debug.h" 29 | #include "gettext.h" 30 | #include "fontset.h" 31 | 32 | static GHashTable *fontset_hash = NULL; 33 | static GSList *fontset_list = NULL; 34 | static Display *_display = NULL; 35 | 36 | static NabiFontSet* 37 | nabi_fontset_new(const char *name) 38 | { 39 | XFontSet xfontset; 40 | XFontSetExtents* ext; 41 | NabiFontSet *fontset; 42 | char **missing_list; 43 | int missing_list_count; 44 | char *error_message; 45 | 46 | nabi_log(4, "create fontset: %s\n", name); 47 | xfontset = XCreateFontSet(_display, 48 | name, 49 | &missing_list, 50 | &missing_list_count, 51 | &error_message); 52 | if (missing_list_count > 0) { 53 | gchar *name2; 54 | XFreeStringList(missing_list); 55 | name2 = g_strconcat(name, ",*", NULL); 56 | xfontset = XCreateFontSet(_display, 57 | name2, 58 | &missing_list, 59 | &missing_list_count, 60 | &error_message); 61 | g_free(name2); 62 | if (missing_list_count > 0) { 63 | int i; 64 | nabi_log(1, "missing charset\n"); 65 | nabi_log(1, "font: %s\n", name); 66 | for (i = 0; i < missing_list_count; i++) 67 | nabi_log(1, " %s\n", missing_list[i]); 68 | XFreeStringList(missing_list); 69 | return NULL; 70 | } 71 | } 72 | 73 | ext = XExtentsOfFontSet(xfontset); 74 | 75 | fontset = g_malloc(sizeof(NabiFontSet)); 76 | fontset->name = g_strdup(name); 77 | fontset->ref = 1; 78 | fontset->xfontset = xfontset; 79 | fontset->ascent = ABS(ext->max_logical_extent.y); 80 | fontset->descent = ext->max_logical_extent.height - fontset->ascent; 81 | 82 | g_hash_table_insert(fontset_hash, fontset->name, fontset); 83 | fontset_list = g_slist_prepend(fontset_list, fontset); 84 | 85 | return fontset; 86 | } 87 | 88 | static void 89 | nabi_fontset_ref(NabiFontSet *fontset) 90 | { 91 | if (fontset == NULL) 92 | return; 93 | 94 | fontset->ref++; 95 | } 96 | 97 | static void 98 | nabi_fontset_unref(NabiFontSet *fontset) 99 | { 100 | if (fontset == NULL) 101 | return; 102 | 103 | fontset->ref--; 104 | if (fontset->ref <= 0) { 105 | g_hash_table_remove(fontset_hash, fontset->name); 106 | fontset_list = g_slist_remove(fontset_list, fontset); 107 | 108 | nabi_log(4, "delete fontset: %s\n", fontset->name); 109 | XFreeFontSet(_display, fontset->xfontset); 110 | g_free(fontset->name); 111 | g_free(fontset); 112 | } 113 | } 114 | 115 | static NabiFontSet* 116 | nabi_fontset_find_by_xfontset(XFontSet xfontset) 117 | { 118 | NabiFontSet *fontset; 119 | GSList *list; 120 | list = fontset_list; 121 | 122 | while (list != NULL) { 123 | fontset = (NabiFontSet*)(list->data); 124 | if (fontset->xfontset == xfontset) 125 | return fontset; 126 | list = list->next; 127 | } 128 | 129 | return NULL; 130 | } 131 | 132 | NabiFontSet* 133 | nabi_fontset_create(Display *display, const char *fontset_name) 134 | { 135 | NabiFontSet *nabi_fontset; 136 | 137 | _display = display; 138 | if (fontset_hash == NULL) 139 | fontset_hash = g_hash_table_new(g_str_hash, g_str_equal); 140 | 141 | nabi_fontset = g_hash_table_lookup(fontset_hash, fontset_name); 142 | if (nabi_fontset != NULL) { 143 | nabi_fontset_ref(nabi_fontset); 144 | return nabi_fontset; 145 | } 146 | 147 | nabi_fontset = nabi_fontset_new(fontset_name); 148 | 149 | return nabi_fontset; 150 | } 151 | 152 | void 153 | nabi_fontset_free(Display *display, XFontSet xfontset) 154 | { 155 | NabiFontSet *nabi_fontset; 156 | 157 | _display = display; 158 | nabi_fontset = nabi_fontset_find_by_xfontset(xfontset); 159 | nabi_fontset_unref(nabi_fontset); 160 | } 161 | 162 | void 163 | nabi_fontset_free_all(Display *display) 164 | { 165 | NabiFontSet *fontset; 166 | GSList *list; 167 | _display = display; 168 | 169 | if (fontset_list != NULL) { 170 | nabi_log(1, "remaining fontsets will be freed," 171 | "this must be an error\n"); 172 | list = fontset_list; 173 | while (list != NULL) { 174 | fontset = (NabiFontSet*)(list->data); 175 | XFreeFontSet(_display, fontset->xfontset); 176 | g_free(fontset->name); 177 | g_free(fontset); 178 | list = list->next; 179 | } 180 | } 181 | 182 | if (fontset_hash != NULL) 183 | g_hash_table_destroy(fontset_hash); 184 | if (fontset_list != NULL) 185 | g_slist_free(fontset_list); 186 | } 187 | 188 | /* vim: set ts=8 sw=4 : */ 189 | -------------------------------------------------------------------------------- /tables/candidate/hanja-gettext.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import sys, string 5 | 6 | char_type = 'static const gunichar' 7 | copyright = '' 8 | 9 | def print_help(): 10 | sys.stderr.write("Usage: hanja-gettext.py [Unihan database file]\n") 11 | sys.exit(1); 12 | 13 | def unicodetohexnum(str): 14 | return string.atoi(str[2:], 16) 15 | 16 | def jamotosyllable(cho, jung, jong): 17 | syllable_base = 0xAC00 18 | choseong_base = 0x1100 19 | jungseong_base = 0x1161 20 | jongseong_base = 0x11A7 21 | njungseong = 21 22 | njongseong = 28 23 | 24 | if cho < 0x1100 and cho > 0x1112: 25 | return 0 26 | if jung < 0x1161 and jung > 0x1175: 27 | return 0 28 | if jong < 0x11A8 and jong > 0x11C2: 29 | return 0 30 | 31 | cho -= choseong_base 32 | jung -= jungseong_base 33 | jong -= jongseong_base 34 | 35 | ch = ((cho * njungseong) + jung) * njongseong + jong + syllable_base 36 | if ch >= 0xAC00 and ch <= 0xD7AF: 37 | return ch 38 | else: 39 | return 0 40 | 41 | def phonetocode(phone, error_msg): 42 | # refer to the Yale romanization system 43 | # (http://www.btranslations.com/resources/romanization/korean.asp) 44 | choseong_table = { 45 | 'K': 0x1100, 46 | 'KK': 0x1101, 47 | 'N': 0x1102, 48 | 'T': 0x1103, 49 | 'TT': 0x1104, 50 | 'L': 0x1105, 51 | 'M': 0x1106, 52 | 'P': 0x1107, 53 | 'B': 0x1107, 54 | 'PP': 0x1108, 55 | 'S': 0x1109, 56 | 'SS': 0x110A, 57 | #'': 0x110B, 58 | 'C': 0x110C, 59 | 'CC': 0x110D, 60 | 'CH': 0x110E, 61 | 'KH': 0x110F, 62 | 'TH': 0x1110, 63 | 'PH': 0x1111, 64 | 'H': 0x1112 65 | } 66 | jungseong_table = { 67 | 'A': 0x1161, 68 | 'AY': 0x1162, 69 | 'YA': 0x1163, 70 | 'YAY': 0x1164, 71 | 'E': 0x1165, 72 | 'EY': 0x1166, 73 | 'YE': 0x1167, 74 | 'YEY': 0x1168, 75 | 'O': 0x1169, 76 | 'WA': 0x116A, 77 | 'OAY': 0x116B, 78 | 'WAY': 0x116B, 79 | 'OY': 0x116C, 80 | 'WOY': 0x116C, 81 | 'YO': 0x116D, 82 | 'WU': 0x116E, 83 | 'WE': 0x116F, 84 | 'WEY': 0x1170, 85 | 'WI': 0x1171, 86 | 'YU': 0x1172, 87 | 'U': 0x1173, 88 | 'UI': 0x1174, 89 | 'UY': 0x1174, 90 | 'I': 0x1175 91 | } 92 | jongseong_table = { 93 | 'K': 0x11A8, 94 | 'KK': 0x11A9, 95 | 'KS': 0x11AA, 96 | 'N': 0x11AB, 97 | 'NC': 0x11AC, 98 | 'NH': 0x11AD, 99 | 'T': 0x11AE, 100 | 'L': 0x11AF, 101 | 'LK': 0x11B0, 102 | 'LM': 0x11B1, 103 | 'LP': 0x11B2, 104 | 'LS': 0x11B3, 105 | 'LTH': 0x11B4, 106 | 'LPH': 0x11B5, 107 | 'LH': 0x11B6, 108 | 'M': 0x11B7, 109 | 'P': 0x11B8, 110 | 'PS': 0x11B9, 111 | 'S': 0x11BA, 112 | 'SS': 0x11BB, 113 | 'NG': 0x11BC, 114 | 'C': 0x11BD, 115 | 'CH': 0x11BE, 116 | 'KH': 0x11BF, 117 | 'TH': 0x11C0, 118 | 'PH': 0x11C1, 119 | 'H': 0x11C2 120 | } 121 | orig_phone = phone 122 | if choseong_table.has_key(phone[:2]): 123 | choseong = choseong_table[phone[:2]] 124 | phone = phone[2:] 125 | elif choseong_table.has_key(phone[:1]): 126 | choseong = choseong_table[phone[:1]] 127 | phone = phone[1:] 128 | else: 129 | choseong = 0x110B 130 | 131 | if jungseong_table.has_key(phone[:3]): 132 | jungseong = jungseong_table[phone[:3]] 133 | phone = phone[3:] 134 | elif jungseong_table.has_key(phone[:2]): 135 | jungseong = jungseong_table[phone[:2]] 136 | phone = phone[2:] 137 | elif jungseong_table.has_key(phone[:1]): 138 | jungseong = jungseong_table[phone[:1]] 139 | phone = phone[1:] 140 | else: 141 | sys.stderr.write(error_msg + ':%s: phonetic data error\n' % orig_phone) 142 | return 0 143 | 144 | if jongseong_table.has_key(phone[:3]): 145 | jongseong = jongseong_table[phone[:3]] 146 | phone = phone[3:] 147 | elif jongseong_table.has_key(phone[:2]): 148 | jongseong = jongseong_table[phone[:2]] 149 | phone = phone[2:] 150 | elif jongseong_table.has_key(phone[:1]): 151 | jongseong = jongseong_table[phone[:1]] 152 | phone = phone[1:] 153 | elif len(phone) == 0: 154 | jongseong = 0x11A7 155 | else: 156 | sys.stderr.write(error_msg + ':%s: phonetic data error\n' % orig_phone) 157 | return 0 158 | 159 | # print "%x + %x + %x" % ( choseong, jungseong, jongseong ) 160 | hangulcode = jamotosyllable(choseong, jungseong, jongseong) 161 | 162 | return hangulcode; 163 | 164 | 165 | # start main procedure 166 | data_file_name = "Unihan.txt" 167 | 168 | if len(sys.argv) == 2: 169 | data_file_name = sys.argv[1] 170 | 171 | try: 172 | data_file = open(data_file_name, 'r') 173 | 174 | except: 175 | sys.stderr.write("Cant open file: %s\n" % data_file_name) 176 | print_help() 177 | sys.exit(1) 178 | 179 | table = { } 180 | lineno = 0 181 | for line in data_file.readlines(): 182 | lineno = lineno + 1 183 | 184 | # check for comment, jump over comments 185 | if line[0] == '#': 186 | continue 187 | 188 | # check for korean phonetic data 189 | if string.find(line, "kKorean") < 0: 190 | continue 191 | 192 | tokens = string.split(line) 193 | hanjacode = unicodetohexnum(tokens[0]) 194 | for hangulphone in tokens[2:]: 195 | hangulcode = phonetocode(hangulphone, "%s: U+%X " % (data_file_name, hanjacode)) 196 | if hangulcode == 0: 197 | continue 198 | 199 | if table.has_key(hangulcode): 200 | table[hangulcode].append(hanjacode) 201 | else: 202 | table[hangulcode] = [ hanjacode ] 203 | 204 | data_file.close() 205 | 206 | list = table.keys() 207 | list.sort() 208 | 209 | sys.stderr.write("\n") 210 | char_num = 0 211 | table_len = 0 212 | for key in list: 213 | print '[' + unichr(key).encode('utf-8') + ']' 214 | i = 0 215 | table[key].sort() 216 | for hanja in table[key]: 217 | print unichr(hanja).encode('utf-8') + '=' 218 | char_num = char_num + 1 219 | table_len = len(table[key]) 220 | sys.stderr.write("%s: %d\n" % (unichr(key).encode('utf-8'), table_len)) 221 | 222 | sys.stderr.write("Total %d chars are written\n" % char_num) 223 | -------------------------------------------------------------------------------- /test/xim_filter.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | static int (*orig_XNextEvent)( 7 | Display* /* display */, 8 | XEvent* /* event_return */ 9 | ) = NULL; 10 | 11 | static XIM (*orig_XOpenIM)( 12 | Display* /* dpy */, 13 | struct _XrmHashBucketRec* /* rdb */, 14 | char* /* res_name */, 15 | char* /* res_class */ 16 | ) = NULL; 17 | 18 | static Status (*orig_XCloseIM)( 19 | XIM /* im */ 20 | ) = NULL; 21 | 22 | static void (*orig_XDestroyIC)( 23 | XIC /* ic */ 24 | ) = NULL; 25 | 26 | static void (*orig_XSetICFocus)( 27 | XIC /* ic */ 28 | ) = NULL; 29 | 30 | static void (*orig_XUnsetICFocus)( 31 | XIC /* ic */ 32 | ) = NULL; 33 | 34 | static Bool (*orig_XFilterEvent)( 35 | XEvent* /* event */, 36 | Window /* window */ 37 | ) = NULL; 38 | 39 | static int (*orig_XmbLookupString)( 40 | XIC /* ic */, 41 | XKeyPressedEvent* /* event */, 42 | char* /* buffer_return */, 43 | int /* bytes_buffer */, 44 | KeySym* /* keysym_return */, 45 | Status* /* status_return */ 46 | ) = NULL; 47 | 48 | static Bool (*orig_XRegisterIMInstantiateCallback)( 49 | Display* /* dpy */, 50 | struct _XrmHashBucketRec* /* rdb */, 51 | char* /* res_name */, 52 | char* /* res_class */, 53 | XIDProc /* callback */, 54 | XPointer /* client_data */ 55 | ) = NULL; 56 | 57 | static Bool (*orig_XUnregisterIMInstantiateCallback)( 58 | Display* /* dpy */, 59 | struct _XrmHashBucketRec* /* rdb */, 60 | char* /* res_name */, 61 | char* /* res_class */, 62 | XIDProc /* callback */, 63 | XPointer /* client_data */ 64 | ) = NULL; 65 | 66 | __attribute__((constructor)) 67 | void init() 68 | { 69 | orig_XNextEvent = dlsym(RTLD_NEXT, "XNextEvent"); 70 | orig_XOpenIM = dlsym(RTLD_NEXT, "XOpenIM"); 71 | orig_XCloseIM = dlsym(RTLD_NEXT, "XCloseIM"); 72 | orig_XDestroyIC = dlsym(RTLD_NEXT, "XDestroyIC"); 73 | orig_XSetICFocus = dlsym(RTLD_NEXT, "XSetICFocus"); 74 | orig_XUnsetICFocus = dlsym(RTLD_NEXT, "XUnsetICFocus"); 75 | orig_XFilterEvent = dlsym(RTLD_NEXT, "XFilterEvent"); 76 | orig_XmbLookupString = dlsym(RTLD_NEXT, "XmbLookupString"); 77 | orig_XRegisterIMInstantiateCallback 78 | = dlsym(RTLD_NEXT, "XRegisterIMInstantiateCallback"); 79 | orig_XUnregisterIMInstantiateCallback 80 | = dlsym(RTLD_NEXT, "XUnregisterIMInstantiateCallback"); 81 | } 82 | 83 | int XNextEvent( 84 | Display* display, 85 | XEvent* event_return 86 | ) 87 | { 88 | int ret; 89 | ret = orig_XNextEvent(display, event_return); 90 | if (event_return->type == KeyPress || event_return->type == KeyRelease) { 91 | char t = event_return->type == KeyPress ? 'P' : 'R'; 92 | printf("%s: (%c, c:0x%x, w:0x%x)\n", 93 | __func__, 94 | t, event_return->xkey.keycode, 95 | (unsigned int)event_return->xkey.window); 96 | } 97 | return ret; 98 | } 99 | 100 | XIM XOpenIM( 101 | Display* dpy, 102 | struct _XrmHashBucketRec* rdb, 103 | char* res_name, 104 | char* res_class 105 | ) 106 | { 107 | printf("%s:\n", __func__); 108 | return orig_XOpenIM(dpy, rdb, res_name, res_class); 109 | } 110 | 111 | Status XCloseIM( 112 | XIM im 113 | ) 114 | { 115 | printf("%s:\n", __func__); 116 | return orig_XCloseIM(im); 117 | } 118 | 119 | void XDestroyIC( 120 | XIC ic 121 | ) 122 | { 123 | printf("%s: %p\n", __func__, ic); 124 | return orig_XDestroyIC(ic); 125 | } 126 | 127 | void XSetICFocus( 128 | XIC ic 129 | ) 130 | { 131 | unsigned int* p = (unsigned int*)ic; 132 | printf("%s: %p: focus window: %x %x\n", __func__, ic, p[3], p[5]); 133 | return orig_XSetICFocus(ic); 134 | } 135 | 136 | void XUnsetICFocus( 137 | XIC ic 138 | ) 139 | { 140 | printf("%s: %p\n", __func__, ic); 141 | return orig_XUnsetICFocus(ic); 142 | } 143 | 144 | Bool XFilterEvent( 145 | XEvent* event, 146 | Window window 147 | ) 148 | { 149 | if (window != None) { 150 | if (event->type == KeyPress || event->type == KeyRelease) { 151 | Bool ret = orig_XFilterEvent(event, window); 152 | char t = event->type == KeyPress ? 'P' : 'R'; 153 | printf("%s: (%c, c:0x%x, w:0x%x), window=0x%x, ret: %d\n", 154 | __func__, 155 | t, event->xkey.keycode, 156 | (unsigned int)event->xkey.window, 157 | (unsigned int)window, ret); 158 | return ret; 159 | } 160 | } 161 | return orig_XFilterEvent(event, window); 162 | } 163 | 164 | int XmbLookupString( 165 | XIC ic, 166 | XKeyPressedEvent* event, 167 | char* buffer_return, 168 | int bytes_buffer, 169 | KeySym* keysym_return, 170 | Status* status_return 171 | ) 172 | { 173 | printf("%s: %p\n", __func__, ic); 174 | return orig_XmbLookupString(ic, event, buffer_return, bytes_buffer, 175 | keysym_return, status_return); 176 | } 177 | 178 | Bool XRegisterIMInstantiateCallback( 179 | Display* dpy, 180 | struct _XrmHashBucketRec* rdb, 181 | char* res_name, 182 | char* res_class, 183 | XIDProc callback, 184 | XPointer client_data 185 | ) 186 | { 187 | printf("%s:\n", __func__); 188 | return orig_XRegisterIMInstantiateCallback(dpy, rdb, res_name, res_class, 189 | callback, client_data); 190 | } 191 | 192 | Bool XUnregisterIMInstantiateCallback( 193 | Display* dpy, 194 | struct _XrmHashBucketRec* rdb, 195 | char* res_name, 196 | char* res_class, 197 | XIDProc callback, 198 | XPointer client_data 199 | ) 200 | { 201 | printf("%s:\n", __func__); 202 | return orig_XUnregisterIMInstantiateCallback(dpy, rdb, res_name, res_class, 203 | callback, client_data); 204 | } 205 | -------------------------------------------------------------------------------- /tables/candidate/hanjatable.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys, string 4 | 5 | char_type = 'static const gunichar' 6 | copyright = '' 7 | 8 | def print_help(): 9 | sys.stderr.write("Usage: hanjatable.py [Unihan database file]\n") 10 | sys.exit(1); 11 | 12 | def print_description(): 13 | desc = """/* 14 | * this file is generated from Unihan.txt database file by gen.py (part of 15 | * GTK+-2.0 input module package, imhangul) 16 | * You can get this database file from ftp://www.unicode.org/Public/UNIDATA/ 17 | * or http://www.unicode.org/Public/UNIDATA/ 18 | */ 19 | """ 20 | print desc 21 | 22 | def print_copyright(): 23 | print '/*\n' + copyright + ' */\n' 24 | 25 | def unicodetohexnum(str): 26 | return string.atoi(str[2:], 16) 27 | 28 | def jamotosyllable(cho, jung, jong): 29 | syllable_base = 0xAC00 30 | choseong_base = 0x1100 31 | jungseong_base = 0x1161 32 | jongseong_base = 0x11A7 33 | njungseong = 21 34 | njongseong = 28 35 | 36 | if cho < 0x1100 and cho > 0x1112: 37 | return 0 38 | if jung < 0x1161 and jung > 0x1175: 39 | return 0 40 | if jong < 0x11A8 and jong > 0x11C2: 41 | return 0 42 | 43 | cho -= choseong_base 44 | jung -= jungseong_base 45 | jong -= jongseong_base 46 | 47 | ch = ((cho * njungseong) + jung) * njongseong + jong + syllable_base 48 | if ch >= 0xAC00 and ch <= 0xD7AF: 49 | return ch 50 | else: 51 | return 0 52 | 53 | def phonetocode(phone, error_msg): 54 | choseong_table = { 55 | 'K': 0x1100, 56 | 'KK': 0x1101, 57 | 'N': 0x1102, 58 | 'T': 0x1103, 59 | 'TT': 0x1104, 60 | 'L': 0x1105, 61 | 'M': 0x1106, 62 | 'P': 0x1107, 63 | 'B': 0x1107, 64 | 'PP': 0x1108, 65 | 'S': 0x1109, 66 | 'SS': 0x110A, 67 | #'': 0x110B, 68 | 'C': 0x110C, 69 | 'CC': 0x110D, 70 | 'CH': 0x110E, 71 | 'KH': 0x110F, 72 | 'TH': 0x1110, 73 | 'PH': 0x1111, 74 | 'H': 0x1112 75 | } 76 | jungseong_table = { 77 | 'A': 0x1161, 78 | 'AY': 0x1162, 79 | 'YA': 0x1163, 80 | 'YAY': 0x1164, 81 | 'E': 0x1165, 82 | 'EY': 0x1166, 83 | 'YE': 0x1167, 84 | 'YEY': 0x1168, 85 | 'O': 0x1169, 86 | 'WA': 0x116A, 87 | 'WAY': 0x116B, 88 | 'OY': 0x116C, 89 | 'WOY': 0x116C, 90 | 'YO': 0x116D, 91 | 'WU': 0x116E, 92 | 'WE': 0x116F, 93 | 'WEY': 0x1170, 94 | 'WI': 0x1171, 95 | 'YU': 0x1172, 96 | 'U': 0x1173, 97 | 'UY': 0x1174, 98 | 'I': 0x1175 99 | } 100 | jongseong_table = { 101 | 'K': 0x11A8, 102 | 'KK': 0x11A9, 103 | 'KS': 0x11AA, 104 | 'N': 0x11AB, 105 | 'NC': 0x11AC, 106 | 'NH': 0x11AD, 107 | 'T': 0x11AE, 108 | 'L': 0x11AF, 109 | 'LK': 0x11B0, 110 | 'LM': 0x11B1, 111 | 'LP': 0x11B2, 112 | 'LS': 0x11B3, 113 | 'LTH': 0x11B4, 114 | 'LPH': 0x11B5, 115 | 'LH': 0x11B6, 116 | 'M': 0x11B7, 117 | 'P': 0x11B8, 118 | 'PS': 0x11B9, 119 | 'S': 0x11BA, 120 | 'SS': 0x11BB, 121 | 'NG': 0x11BC, 122 | 'C': 0x11BD, 123 | 'CH': 0x11BE, 124 | 'KH': 0x11BF, 125 | 'TH': 0x11C0, 126 | 'PH': 0x11C1, 127 | 'H': 0x11C2 128 | } 129 | orig_phone = phone 130 | if choseong_table.has_key(phone[:2]): 131 | choseong = choseong_table[phone[:2]] 132 | phone = phone[2:] 133 | elif choseong_table.has_key(phone[:1]): 134 | choseong = choseong_table[phone[:1]] 135 | phone = phone[1:] 136 | else: 137 | choseong = 0x110B 138 | 139 | if jungseong_table.has_key(phone[:3]): 140 | jungseong = jungseong_table[phone[:3]] 141 | phone = phone[3:] 142 | elif jungseong_table.has_key(phone[:2]): 143 | jungseong = jungseong_table[phone[:2]] 144 | phone = phone[2:] 145 | elif jungseong_table.has_key(phone[:1]): 146 | jungseong = jungseong_table[phone[:1]] 147 | phone = phone[1:] 148 | else: 149 | sys.stderr.write(error_msg + ':%s: phonetic data error\n' % orig_phone) 150 | return 0 151 | 152 | if jongseong_table.has_key(phone[:3]): 153 | jongseong = jongseong_table[phone[:3]] 154 | phone = phone[3:] 155 | elif jongseong_table.has_key(phone[:2]): 156 | jongseong = jongseong_table[phone[:2]] 157 | phone = phone[2:] 158 | elif jongseong_table.has_key(phone[:1]): 159 | jongseong = jongseong_table[phone[:1]] 160 | phone = phone[1:] 161 | elif len(phone) == 0: 162 | jongseong = 0x11A7 163 | else: 164 | sys.stderr.write(error_msg + ':%s: phonetic data error\n' % orig_phone) 165 | return 0 166 | 167 | # print "%x + %x + %x" % ( choseong, jungseong, jongseong ) 168 | hangulcode = jamotosyllable(choseong, jungseong, jongseong) 169 | 170 | return hangulcode; 171 | 172 | 173 | # start main procedure 174 | data_file_name = "Unihan.txt" 175 | 176 | if len(sys.argv) == 2: 177 | data_file_name = sys.argv[1] 178 | 179 | try: 180 | data_file = open(data_file_name, 'r') 181 | 182 | except: 183 | sys.stderr.write("Cant open file: %s\n" % data_file_name) 184 | help() 185 | sys.exit(1) 186 | 187 | gather_copyright = 0 188 | table = { } 189 | lineno = 0 190 | for line in data_file.readlines(): 191 | lineno = lineno + 1 192 | 193 | # check for comment, jump over comments 194 | if line[0] == '#': 195 | if gather_copyright == 0: 196 | if string.find(line, "Format information:") != -1 : 197 | gather_copyright = 1 198 | continue 199 | copyright += ' * ' + string.strip(line[1:]) + '\n' 200 | continue 201 | else: 202 | continue 203 | 204 | # check for korean phonetic data 205 | if string.find(line, "kKorean") < 0: 206 | continue 207 | 208 | tokens = string.split(line) 209 | hanjacode = unicodetohexnum(tokens[0]) 210 | for hangulphone in tokens[2:]: 211 | hangulcode = phonetocode(hangulphone, "%s: U+%X " % (data_file_name, hanjacode)) 212 | if hangulcode == 0: 213 | continue 214 | 215 | if table.has_key(hangulcode): 216 | table[hangulcode].append(hanjacode) 217 | else: 218 | table[hangulcode] = [ hanjacode ] 219 | 220 | data_file.close() 221 | 222 | list = table.keys() 223 | list.sort() 224 | 225 | sys.stderr.write("\n") 226 | threshold = 0 227 | section_no = 1 228 | char_num = 0 229 | table_len = 0 230 | sys.stderr.write("-- %d --\n" % section_no) 231 | for key in list: 232 | print '[' + unichr(key).encode('utf-8') + ']' 233 | i = 0 234 | table[key].sort() 235 | for hanja in table[key]: 236 | print unichr(hanja).encode('utf-8') + '=' 237 | char_num = char_num + 1 238 | table_len = len(table[key]) 239 | threshold = threshold + table_len 240 | sys.stderr.write("%s: %d\n" % (unichr(key).encode('utf-8'), table_len)) 241 | if threshold > 100: 242 | threshold = 0 243 | section_no = section_no + 1 244 | sys.stderr.write("-- %d --\n" % section_no) 245 | 246 | sys.stderr.write("Total %d chars are written\n" % char_num) 247 | -------------------------------------------------------------------------------- /IMdkit/i18nAttr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | 3 | Copyright 1994, 1995 by Sun Microsystems, Inc. 4 | Copyright 1993, 1994 by Hewlett-Packard Company 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of Sun Microsystems, Inc. 11 | and Hewlett-Packard not be used in advertising or publicity pertaining to 12 | distribution of the software without specific, written prior permission. 13 | Sun Microsystems, Inc. and Hewlett-Packard make no representations about 14 | the suitability of this software for any purpose. It is provided "as is" 15 | without express or implied warranty. 16 | 17 | SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL 18 | WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 20 | SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 23 | CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 24 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc. 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #include 33 | #include 34 | #include "IMdkit.h" 35 | #include "Xi18n.h" 36 | #include "XimFunc.h" 37 | 38 | typedef struct 39 | { 40 | char *name; 41 | CARD16 type; 42 | } IMListOfAttr; 43 | 44 | typedef struct 45 | { 46 | char *name; 47 | CARD8 major_opcode; 48 | CARD8 minor_opcode; 49 | } IMExtList; 50 | 51 | IMListOfAttr Default_IMattr[] = 52 | { 53 | {XNQueryInputStyle, XimType_XIMStyles}, 54 | {XNQueryIMValuesList, XimType_XIMValuesList}, 55 | {XNQueryICValuesList, XimType_XIMValuesList}, 56 | {(char *) NULL, (CARD16) 0} 57 | }; 58 | 59 | IMListOfAttr Default_ICattr[] = 60 | { 61 | {XNInputStyle, XimType_CARD32}, 62 | {XNClientWindow, XimType_Window}, 63 | {XNFocusWindow, XimType_Window}, 64 | {XNFilterEvents, XimType_CARD32}, 65 | {XNPreeditAttributes, XimType_NEST}, 66 | {XNStatusAttributes, XimType_NEST}, 67 | {XNFontSet, XimType_XFontSet}, 68 | {XNArea, XimType_XRectangle}, 69 | {XNAreaNeeded, XimType_XRectangle}, 70 | {XNColormap, XimType_CARD32}, 71 | {XNStdColormap, XimType_CARD32}, 72 | {XNForeground, XimType_CARD32}, 73 | {XNBackground, XimType_CARD32}, 74 | {XNBackgroundPixmap, XimType_CARD32}, 75 | {XNSpotLocation, XimType_XPoint}, 76 | {XNLineSpace, XimType_CARD32}, 77 | {XNPreeditState, XimType_CARD32}, 78 | {XNPreeditStartCallback, XimType_CARD32}, 79 | {XNPreeditDoneCallback, XimType_CARD32}, 80 | {XNPreeditDrawCallback, XimType_CARD32}, 81 | {XNStringConversionCallback, XimType_CARD32}, 82 | {XNStringConversion, XimType_CARD32}, 83 | {XNSeparatorofNestedList, XimType_SeparatorOfNestedList}, 84 | {(char *) NULL, (CARD16) 0} 85 | }; 86 | 87 | IMExtList Default_Extension[] = 88 | { 89 | {"XIM_EXT_MOVE", XIM_EXTENSION, XIM_EXT_MOVE}, 90 | {"XIM_EXT_SET_EVENT_MASK", XIM_EXTENSION, XIM_EXT_SET_EVENT_MASK}, 91 | {"XIM_EXT_FORWARD_KEYEVENT", XIM_EXTENSION, XIM_EXT_FORWARD_KEYEVENT}, 92 | {(char *) NULL, (CARD8) 0, (CARD8) 0} 93 | }; 94 | 95 | static void CountAttrList(IMListOfAttr *attr, int *total_count) 96 | { 97 | *total_count = 0; 98 | 99 | while (attr->name != NULL) 100 | { 101 | attr++; 102 | ++(*total_count); 103 | } 104 | } 105 | 106 | static XIMAttr *CreateAttrList (Xi18n i18n_core, 107 | IMListOfAttr *attr, 108 | int *total_count) 109 | { 110 | XIMAttr *args, *p; 111 | unsigned int buf_size; 112 | 113 | CountAttrList(attr, total_count); 114 | 115 | buf_size = (unsigned) (*total_count + 1)*sizeof (XIMAttr); 116 | args = (XIMAttr *) malloc (buf_size); 117 | if (!args) 118 | return (XIMAttr *) NULL; 119 | /*endif*/ 120 | memset (args, 0, buf_size); 121 | 122 | for (p = args; attr->name != NULL; attr++, p++) 123 | { 124 | p->name = attr->name; 125 | p->length = strlen (attr->name); 126 | p->type = (CARD16) attr->type; 127 | p->attribute_id = XrmStringToQuark (p->name); 128 | if (strcmp (p->name, XNPreeditAttributes) == 0) 129 | i18n_core->address.preeditAttr_id = p->attribute_id; 130 | else if (strcmp (p->name, XNStatusAttributes) == 0) 131 | i18n_core->address.statusAttr_id = p->attribute_id; 132 | else if (strcmp (p->name, XNSeparatorofNestedList) == 0) 133 | i18n_core->address.separatorAttr_id = p->attribute_id; 134 | /*endif*/ 135 | } 136 | /*endfor*/ 137 | p->name = (char *) NULL; 138 | 139 | return args; 140 | } 141 | 142 | void _Xi18nInitAttrList (Xi18n i18n_core) 143 | { 144 | XIMAttr *args; 145 | int total_count; 146 | 147 | /* init IMAttr list */ 148 | if (i18n_core->address.xim_attr) 149 | XFree ((char *)i18n_core->address.xim_attr); 150 | /*endif*/ 151 | args = CreateAttrList (i18n_core, Default_IMattr, &total_count); 152 | 153 | i18n_core->address.im_attr_num = total_count; 154 | i18n_core->address.xim_attr = (XIMAttr *)args; 155 | 156 | /* init ICAttr list */ 157 | if (i18n_core->address.xic_attr) 158 | XFree ((char *) i18n_core->address.xic_attr); 159 | /*endif*/ 160 | args = CreateAttrList (i18n_core, Default_ICattr, &total_count); 161 | 162 | i18n_core->address.ic_attr_num = total_count; 163 | i18n_core->address.xic_attr = (XICAttr *) args; 164 | } 165 | 166 | void _Xi18nInitExtension(Xi18n i18n_core) 167 | { 168 | register int i; 169 | IMExtList *extensions = (IMExtList *) Default_Extension; 170 | XIMExt *ext_list = (XIMExt *) i18n_core->address.extension; 171 | 172 | for (i = 0; extensions->name; i++, ext_list++, extensions++) 173 | { 174 | ext_list->major_opcode = extensions->major_opcode; 175 | ext_list->minor_opcode = extensions->minor_opcode; 176 | ext_list->name = extensions->name; 177 | ext_list->length = strlen(ext_list->name); 178 | } 179 | /*endfor*/ 180 | i18n_core->address.ext_num = i; 181 | } 182 | -------------------------------------------------------------------------------- /src/handlebox.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #include 24 | 25 | #include "handlebox.h" 26 | 27 | #define HANDLE_SIZE 10 28 | 29 | static void nabi_handle_box_class_init (NabiHandleBoxClass *klass); 30 | static void nabi_handle_box_init (NabiHandleBox *handle_box); 31 | static void nabi_handle_box_size_request (GtkWidget *widget, 32 | GtkRequisition *requisition); 33 | static void nabi_handle_box_size_allocate (GtkWidget *widget, 34 | GtkAllocation *real_allocation); 35 | static gint nabi_handle_box_expose (GtkWidget *widget, 36 | GdkEventExpose *event); 37 | static gboolean nabi_handle_box_button_press(GtkWidget *widget, 38 | GdkEventButton *event); 39 | 40 | static void on_realize(GtkWidget *widget, gpointer data); 41 | 42 | static GtkWindowClass *parent_class = NULL; 43 | 44 | 45 | GType 46 | nabi_handle_box_get_type (void) 47 | { 48 | static GType handle_box_type = 0; 49 | 50 | if (!handle_box_type) 51 | { 52 | static const GTypeInfo handle_box_info = 53 | { 54 | sizeof (NabiHandleBoxClass), 55 | NULL, /* base_init */ 56 | NULL, /* base_finalize */ 57 | (GClassInitFunc) nabi_handle_box_class_init, 58 | NULL, /* class_finalize */ 59 | NULL, /* class_data */ 60 | sizeof (NabiHandleBox), 61 | 0, /* n_preallocs */ 62 | (GInstanceInitFunc) nabi_handle_box_init, 63 | }; 64 | 65 | handle_box_type = g_type_register_static (GTK_TYPE_WINDOW, 66 | "NabiHandleBox", &handle_box_info, 0); 67 | } 68 | 69 | return handle_box_type; 70 | } 71 | 72 | static void 73 | nabi_handle_box_class_init (NabiHandleBoxClass *klass) 74 | { 75 | GtkWidgetClass *widget_class; 76 | 77 | parent_class = g_type_class_peek_parent(klass); 78 | 79 | widget_class = GTK_WIDGET_CLASS(klass); 80 | widget_class->size_request = nabi_handle_box_size_request; 81 | widget_class->size_allocate = nabi_handle_box_size_allocate; 82 | widget_class->expose_event = nabi_handle_box_expose; 83 | widget_class->button_press_event = nabi_handle_box_button_press; 84 | } 85 | 86 | static void 87 | on_realize(GtkWidget *widget, gpointer data) 88 | { 89 | if (widget != NULL && widget->window != NULL) { 90 | int event_mask = gdk_window_get_events(widget->window); 91 | gdk_window_set_events(widget->window, 92 | event_mask | GDK_BUTTON_PRESS_MASK); 93 | } 94 | } 95 | 96 | static void 97 | nabi_handle_box_init (NabiHandleBox *handle_box) 98 | { 99 | gtk_window_set_type_hint(GTK_WINDOW(handle_box), 100 | GDK_WINDOW_TYPE_HINT_TOOLBAR); 101 | gtk_window_set_decorated(GTK_WINDOW(handle_box), FALSE); 102 | gtk_window_set_skip_pager_hint(GTK_WINDOW(handle_box), TRUE); 103 | gtk_window_set_skip_taskbar_hint(GTK_WINDOW(handle_box), TRUE); 104 | gtk_window_set_resizable(GTK_WINDOW(handle_box), FALSE); 105 | gtk_container_set_border_width(GTK_CONTAINER(handle_box), 1); 106 | 107 | g_signal_connect(G_OBJECT(handle_box), "realize", 108 | G_CALLBACK(on_realize), NULL); 109 | } 110 | 111 | GtkWidget* 112 | nabi_handle_box_new (void) 113 | { 114 | GtkWidget* widget = g_object_new (NABI_TYPE_HANDLE_BOX, NULL); 115 | GTK_WINDOW(widget)->type = GTK_WINDOW_TOPLEVEL; 116 | 117 | return widget; 118 | } 119 | 120 | static void 121 | nabi_handle_box_size_request (GtkWidget *widget, 122 | GtkRequisition *requisition) 123 | { 124 | if (GTK_WIDGET_CLASS (parent_class)->size_request) 125 | GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); 126 | 127 | requisition->width += HANDLE_SIZE; 128 | } 129 | 130 | static void 131 | nabi_handle_box_size_allocate (GtkWidget *widget, 132 | GtkAllocation *allocation) 133 | { 134 | GtkBin* bin; 135 | 136 | widget->allocation = *allocation; 137 | 138 | bin = GTK_BIN (widget); 139 | if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { 140 | GtkAllocation child_allocation; 141 | guint border_width; 142 | 143 | border_width = GTK_CONTAINER (widget)->border_width; 144 | 145 | child_allocation.x = border_width; 146 | child_allocation.y = border_width; 147 | child_allocation.x += HANDLE_SIZE; 148 | 149 | child_allocation.width = 150 | MAX (1, (gint)allocation->width - 2 * border_width); 151 | child_allocation.height = 152 | MAX (1, (gint)allocation->height - 2 * border_width); 153 | 154 | child_allocation.width -= HANDLE_SIZE; 155 | 156 | gtk_widget_size_allocate (bin->child, &child_allocation); 157 | } 158 | } 159 | 160 | static void 161 | nabi_handle_box_paint (GtkWidget *widget, 162 | GdkRectangle *area) 163 | { 164 | gint width = 0; 165 | gint height = 0; 166 | GdkRectangle rect; 167 | GdkRectangle dest; 168 | 169 | width = widget->allocation.width; 170 | height = widget->allocation.height; 171 | 172 | rect.x = 0; 173 | rect.y = 0; 174 | rect.width = width; 175 | rect.height = height; 176 | if (gdk_rectangle_intersect (area, &rect, &dest)) { 177 | gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, 178 | GTK_SHADOW_OUT, area, widget, "handlebox", 179 | 0, 0, width, height); 180 | } 181 | 182 | rect.x = 0; 183 | rect.y = 0; 184 | rect.width = HANDLE_SIZE; 185 | rect.height = height; 186 | if (gdk_rectangle_intersect (area, &rect, &dest)) { 187 | gtk_paint_handle (widget->style, widget->window, GTK_STATE_NORMAL, 188 | GTK_SHADOW_OUT, area, widget, "handlebox", 189 | rect.x, rect.y, rect.width, rect.height, 190 | GTK_ORIENTATION_VERTICAL); 191 | } 192 | } 193 | 194 | static gint 195 | nabi_handle_box_expose (GtkWidget *widget, 196 | GdkEventExpose *event) 197 | { 198 | gint ret = FALSE; 199 | if (GTK_WIDGET_CLASS (parent_class)->expose_event) 200 | ret = GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); 201 | 202 | if (GTK_WIDGET_DRAWABLE (widget)) 203 | nabi_handle_box_paint (widget, &event->area); 204 | 205 | return ret; 206 | } 207 | 208 | static gboolean 209 | nabi_handle_box_button_press(GtkWidget *widget, 210 | GdkEventButton *event) 211 | { 212 | if (event->button == 1) { 213 | gtk_window_begin_move_drag(GTK_WINDOW(widget), 214 | event->button, 215 | event->x_root, event->y_root, 216 | event->time); 217 | return TRUE; 218 | } 219 | 220 | return FALSE; 221 | } 222 | -------------------------------------------------------------------------------- /src/ic.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | 20 | #ifndef _NABIIC_H_ 21 | #define _NABIIC_H_ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include "../IMdkit/IMdkit.h" 30 | #include "../IMdkit/Xi18n.h" 31 | 32 | #include "candidate.h" 33 | #include "ustring.h" 34 | 35 | typedef struct _PreeditAttributes PreeditAttributes; 36 | typedef struct _StatusAttributes StatusAttributes; 37 | typedef struct _NabiIC NabiIC; 38 | typedef struct _NabiConnection NabiConnection; 39 | typedef struct _NabiToplevel NabiToplevel; 40 | 41 | typedef enum { 42 | NABI_INPUT_MODE_DIRECT, 43 | NABI_INPUT_MODE_COMPOSE 44 | } NabiInputMode; 45 | 46 | struct _NabiConnection { 47 | CARD16 id; 48 | NabiInputMode mode; 49 | GIConv cd; 50 | CARD16 next_new_ic_id; 51 | GSList* ic_list; 52 | }; 53 | 54 | struct _NabiToplevel { 55 | Window id; 56 | NabiInputMode mode; 57 | unsigned int ref; 58 | }; 59 | 60 | struct _PreeditAttributes { 61 | UString* str; 62 | GdkWindow* window; /* where to draw the preedit string */ 63 | int width; /* preedit area width */ 64 | int height; /* preedit area height */ 65 | XPoint spot; /* window position */ 66 | 67 | XRectangle area; /* area */ 68 | XRectangle area_needed; /* area needed */ 69 | 70 | Colormap cmap; /* colormap */ 71 | GdkGC* normal_gc; /* gc */ 72 | GdkGC* hilight_gc; /* gc */ 73 | unsigned long foreground; /* foreground */ 74 | unsigned long background; /* background */ 75 | 76 | char *base_font; /* base font of fontset */ 77 | XFontSet font_set; /* font set */ 78 | int ascent; /* font property */ 79 | int descent; /* font property */ 80 | 81 | Pixmap bg_pixmap; /* background pixmap */ 82 | CARD32 line_space; /* line spacing */ 83 | Cursor cursor; /* cursor */ 84 | 85 | XIMPreeditState state; /* preedit state */ 86 | Bool start; /* preedit start */ 87 | int prev_length; /* previous preedit string length */ 88 | 89 | gboolean has_start_cb; /* whether XNPreeditStartCallback 90 | * registered */ 91 | gboolean has_draw_cb; /* whether XNPreeditDrawCallback 92 | * registered */ 93 | gboolean has_done_cb; /* whether XNPreeditDoneCallback 94 | * registered */ 95 | }; 96 | 97 | struct _StatusAttributes { 98 | XRectangle area; /* area */ 99 | XRectangle area_needed; /* area needed */ 100 | Colormap cmap; /* colormap */ 101 | unsigned long foreground; /* foreground */ 102 | unsigned long background; /* background */ 103 | Pixmap bg_pixmap; /* background pixmap */ 104 | char *base_font; /* base font of fontset */ 105 | CARD32 line_space; /* line spacing */ 106 | Cursor cursor; /* cursor */ 107 | }; 108 | 109 | struct _NabiIC { 110 | CARD16 id; /* ic id */ 111 | INT32 input_style; /* input style */ 112 | Window client_window; /* client window */ 113 | Window focus_window; /* focus window */ 114 | char* resource_name; /* resource name */ 115 | char* resource_class; /* resource class */ 116 | StatusAttributes status; /* status attributes */ 117 | PreeditAttributes preedit; /* preedit attributes */ 118 | 119 | NabiConnection* connection; 120 | NabiToplevel* toplevel; 121 | 122 | /* hangul data */ 123 | NabiInputMode mode; 124 | HangulInputContext* hic; 125 | 126 | /* hanja or symbol select window */ 127 | NabiCandidate* candidate; 128 | 129 | gboolean composing_started; 130 | UString* client_text; 131 | gboolean wait_for_client_text; /* whether this ic requested 132 | * client text */ 133 | gboolean has_str_conv_cb; /* whether XNStringConversionCallback 134 | * registered */ 135 | }; 136 | 137 | NabiConnection* nabi_connection_create(CARD16 id, const char* encoding); 138 | void nabi_connection_destroy(NabiConnection* conn); 139 | NabiIC* nabi_connection_create_ic(NabiConnection* conn, 140 | IMChangeICStruct* data); 141 | void nabi_connection_destroy_ic(NabiConnection* conn, NabiIC* ic); 142 | NabiIC* nabi_connection_get_ic(NabiConnection* conn, CARD16 id); 143 | 144 | NabiToplevel* nabi_toplevel_new(Window id); 145 | void nabi_toplevel_ref(NabiToplevel* toplevel); 146 | void nabi_toplevel_unref(NabiToplevel* toplevel); 147 | 148 | NabiIC* nabi_ic_create(NabiConnection* conn, IMChangeICStruct *data); 149 | void nabi_ic_destroy(NabiIC *ic); 150 | void nabi_ic_real_destroy(NabiIC *ic); 151 | 152 | void nabi_ic_set_values(NabiIC *ic, IMChangeICStruct *data); 153 | void nabi_ic_get_values(NabiIC *ic, IMChangeICStruct *data); 154 | 155 | Bool nabi_ic_is_empty(NabiIC *ic); 156 | CARD16 nabi_ic_get_id(NabiIC* ic); 157 | KeySym nabi_ic_lookup_keysym(NabiIC* ic, XKeyEvent* event); 158 | 159 | void nabi_ic_set_focus(NabiIC *ic); 160 | 161 | void nabi_ic_set_mode(NabiIC *ic, NabiInputMode mode); 162 | void nabi_ic_start_composing(NabiIC *ic); 163 | void nabi_ic_end_composing(NabiIC *ic); 164 | 165 | void nabi_ic_preedit_start(NabiIC *ic); 166 | void nabi_ic_preedit_done(NabiIC *ic); 167 | void nabi_ic_preedit_update(NabiIC *ic); 168 | void nabi_ic_preedit_clear(NabiIC *ic); 169 | 170 | void nabi_ic_status_start(NabiIC *ic); 171 | void nabi_ic_status_done(NabiIC *ic); 172 | void nabi_ic_status_update(NabiIC *ic); 173 | 174 | Bool nabi_ic_commit(NabiIC *ic); 175 | 176 | Bool nabi_ic_process_keyevent(NabiIC* ic, KeySym keysym, unsigned int state); 177 | void nabi_ic_flush(NabiIC *ic); 178 | void nabi_ic_reset(NabiIC *ic, IMResetICStruct *data); 179 | 180 | Bool nabi_ic_popup_candidate_window(NabiIC *ic, const char* key); 181 | void nabi_ic_insert_candidate(NabiIC *ic, const Hanja* hanja); 182 | 183 | void nabi_ic_process_string_conversion_reply(NabiIC* ic, const char* text); 184 | 185 | #endif /* _NABIIC_H_ */ 186 | /* vim: set ts=8 sw=4 sts=4 : */ 187 | -------------------------------------------------------------------------------- /IMdkit/XimProto.h: -------------------------------------------------------------------------------- 1 | /* $XConsortium: XimProto.h,v 1.2 94/01/20 18:02:24 rws Exp $ */ 2 | /****************************************************************** 3 | 4 | Copyright 1992, 1993, 1994 by FUJITSU LIMITED 5 | 6 | Permission to use, copy, modify, distribute, and sell this software 7 | and its documentation for any purpose is hereby granted without fee, 8 | provided that the above copyright notice appear in all copies and 9 | that both that copyright notice and this permission notice appear 10 | in supporting documentation, and that the name of FUJITSU LIMITED 11 | not be used in advertising or publicity pertaining to distribution 12 | of the software without specific, written prior permission. 13 | FUJITSU LIMITED makes no representations about the suitability of 14 | this software for any purpose. 15 | It is provided "as is" without express or implied warranty. 16 | 17 | FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 19 | EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR 20 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 21 | USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 22 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 23 | PERFORMANCE OF THIS SOFTWARE. 24 | 25 | Author: Takashi Fujiwara FUJITSU LIMITED 26 | fujiwara@a80.tech.yk.fujitsu.co.jp 27 | 28 | This version tidied and debugged by Steve Underwood May 1999 29 | 30 | ******************************************************************/ 31 | 32 | #ifndef _XIMPROTO_H 33 | #define _XIMPROTO_H 34 | 35 | /* 36 | * Default Preconnection selection target 37 | */ 38 | #define XIM_SERVERS "XIM_SERVERS" 39 | #define XIM_LOCALES "LOCALES" 40 | #define XIM_TRANSPORT "TRANSPORT" 41 | 42 | /* 43 | * categories in XIM_SERVERS 44 | */ 45 | #define XIM_SERVER_CATEGORY "@server=" 46 | #define XIM_LOCAL_CATEGORY "@locale=" 47 | #define XIM_TRANSPORT_CATEGORY "@transport=" 48 | 49 | /* 50 | * Xim implementation revision 51 | */ 52 | #define PROTOCOLMAJORVERSION 0 53 | #define PROTOCOLMINORVERSION 0 54 | 55 | /* 56 | * Major Protocol number 57 | */ 58 | #define XIM_CONNECT 1 59 | #define XIM_CONNECT_REPLY 2 60 | #define XIM_DISCONNECT 3 61 | #define XIM_DISCONNECT_REPLY 4 62 | 63 | #define XIM_AUTH_REQUIRED 10 64 | #define XIM_AUTH_REPLY 11 65 | #define XIM_AUTH_NEXT 12 66 | #define XIM_AUTH_SETUP 13 67 | #define XIM_AUTH_NG 14 68 | 69 | #define XIM_ERROR 20 70 | 71 | #define XIM_OPEN 30 72 | #define XIM_OPEN_REPLY 31 73 | #define XIM_CLOSE 32 74 | #define XIM_CLOSE_REPLY 33 75 | #define XIM_REGISTER_TRIGGERKEYS 34 76 | #define XIM_TRIGGER_NOTIFY 35 77 | #define XIM_TRIGGER_NOTIFY_REPLY 36 78 | #define XIM_SET_EVENT_MASK 37 79 | #define XIM_ENCODING_NEGOTIATION 38 80 | #define XIM_ENCODING_NEGOTIATION_REPLY 39 81 | #define XIM_QUERY_EXTENSION 40 82 | #define XIM_QUERY_EXTENSION_REPLY 41 83 | #define XIM_SET_IM_VALUES 42 84 | #define XIM_SET_IM_VALUES_REPLY 43 85 | #define XIM_GET_IM_VALUES 44 86 | #define XIM_GET_IM_VALUES_REPLY 45 87 | 88 | #define XIM_CREATE_IC 50 89 | #define XIM_CREATE_IC_REPLY 51 90 | #define XIM_DESTROY_IC 52 91 | #define XIM_DESTROY_IC_REPLY 53 92 | #define XIM_SET_IC_VALUES 54 93 | #define XIM_SET_IC_VALUES_REPLY 55 94 | #define XIM_GET_IC_VALUES 56 95 | #define XIM_GET_IC_VALUES_REPLY 57 96 | #define XIM_SET_IC_FOCUS 58 97 | #define XIM_UNSET_IC_FOCUS 59 98 | #define XIM_FORWARD_EVENT 60 99 | #define XIM_SYNC 61 100 | #define XIM_SYNC_REPLY 62 101 | #define XIM_COMMIT 63 102 | #define XIM_RESET_IC 64 103 | #define XIM_RESET_IC_REPLY 65 104 | 105 | #define XIM_GEOMETRY 70 106 | #define XIM_STR_CONVERSION 71 107 | #define XIM_STR_CONVERSION_REPLY 72 108 | #define XIM_PREEDIT_START 73 109 | #define XIM_PREEDIT_START_REPLY 74 110 | #define XIM_PREEDIT_DRAW 75 111 | #define XIM_PREEDIT_CARET 76 112 | #define XIM_PREEDIT_CARET_REPLY 77 113 | #define XIM_PREEDIT_DONE 78 114 | #define XIM_STATUS_START 79 115 | #define XIM_STATUS_DRAW 80 116 | #define XIM_STATUS_DONE 81 117 | 118 | /* 119 | * values for the flag of XIM_ERROR 120 | */ 121 | #define XIM_IMID_VALID 0x0001 122 | #define XIM_ICID_VALID 0x0002 123 | 124 | /* 125 | * XIM Error Code 126 | */ 127 | #define XIM_BadAlloc 1 128 | #define XIM_BadStyle 2 129 | #define XIM_BadClientWindow 3 130 | #define XIM_BadFocusWindow 4 131 | #define XIM_BadArea 5 132 | #define XIM_BadSpotLocation 6 133 | #define XIM_BadColormap 7 134 | #define XIM_BadAtom 8 135 | #define XIM_BadPixel 9 136 | #define XIM_BadPixmap 10 137 | #define XIM_BadName 11 138 | #define XIM_BadCursor 12 139 | #define XIM_BadProtocol 13 140 | #define XIM_BadForeground 14 141 | #define XIM_BadBackground 15 142 | #define XIM_LocaleNotSupported 16 143 | #define XIM_BadSomething 999 144 | 145 | /* 146 | * byte order 147 | */ 148 | #define BIGENDIAN (CARD8) 0x42 /* MSB first */ 149 | #define LITTLEENDIAN (CARD8) 0x6c /* LSB first */ 150 | 151 | /* 152 | * values for the type of XIMATTR & XICATTR 153 | */ 154 | #define XimType_SeparatorOfNestedList 0 155 | #define XimType_CARD8 1 156 | #define XimType_CARD16 2 157 | #define XimType_CARD32 3 158 | #define XimType_STRING8 4 159 | #define XimType_Window 5 160 | #define XimType_XIMStyles 10 161 | #define XimType_XRectangle 11 162 | #define XimType_XPoint 12 163 | #define XimType_XFontSet 13 164 | #define XimType_XIMOptions 14 165 | #define XimType_XIMHotKeyTriggers 15 166 | #define XimType_XIMHotKeyState 16 167 | #define XimType_XIMStringConversion 17 168 | #define XimType_XIMPreeditState 18 169 | #define XimType_XIMResetState 19 170 | #define XimType_XIMValuesList 20 171 | #define XimType_NEST 0x7FFF 172 | 173 | /* 174 | * values for the category of XIM_ENCODING_NEGOTIATON_REPLY 175 | */ 176 | #define XIM_Encoding_NameCategory 0 177 | #define XIM_Encoding_DetailCategory 1 178 | 179 | /* 180 | * value for the index of XIM_ENCODING_NEGOTIATON_REPLY 181 | */ 182 | #define XIM_Default_Encoding_IDX -1 183 | 184 | /* 185 | * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT 186 | */ 187 | #define XimSYNCHRONUS 0x0001 188 | #define XimLookupChars 0x0002 189 | #define XimLookupKeySym 0x0004 190 | #define XimLookupBoth 0x0006 191 | 192 | /* 193 | * request packet header size 194 | */ 195 | #define XIM_HEADER_SIZE \ 196 | sizeof(CARD8) /* sizeof mejor-opcode */ \ 197 | + sizeof(CARD8) /* sizeof minor-opcode */ \ 198 | + sizeof(INT16) /* sizeof length */ 199 | 200 | /* 201 | * Client Message data size 202 | */ 203 | #define XIM_CM_DATA_SIZE 20 204 | 205 | /* 206 | * XIM data structure 207 | */ 208 | typedef CARD16 BITMASK16; 209 | typedef CARD32 BITMASK32; 210 | typedef CARD32 EVENTMASK; 211 | 212 | typedef CARD16 XIMID; /* Input Method ID */ 213 | typedef CARD16 XICID; /* Input Context ID */ 214 | 215 | /* 216 | * Padding macro 217 | */ 218 | #define XIM_PAD(length) ((4 - ((length) % 4)) % 4) 219 | 220 | #define XIM_SET_PAD(ptr, length) \ 221 | { \ 222 | register int Counter = XIM_PAD((int)length); \ 223 | if (Counter) { \ 224 | register char *Ptr = (char *)(ptr) + (length); \ 225 | length += Counter; \ 226 | for (; Counter; --Counter, ++Ptr) \ 227 | *Ptr = '\0'; \ 228 | } \ 229 | } 230 | 231 | #endif 232 | 233 | -------------------------------------------------------------------------------- /src/session.c: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2008 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #ifdef HAVE_LIBSM 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include "debug.h" 34 | #include "server.h" 35 | #include "session.h" 36 | #include "nabi.h" 37 | 38 | static SmcConn session_connection; 39 | 40 | static gboolean 41 | process_ice_messages(GIOChannel *channel, 42 | GIOCondition condition, gpointer client_data) 43 | { 44 | IceConn ice_conn = (IceConn)client_data; 45 | IceProcessMessagesStatus status; 46 | 47 | status = IceProcessMessages(ice_conn, NULL, NULL); 48 | if (status == IceProcessMessagesIOError) { 49 | nabi_log(1, "ice message process error\n"); 50 | IceSetShutdownNegotiation(ice_conn, False); 51 | IceCloseConnection(ice_conn); 52 | } 53 | 54 | return TRUE; 55 | } 56 | 57 | static void 58 | ice_watch_proc(IceConn ice_conn, IcePointer client_data, 59 | Bool opening, IcePointer *watch_data) 60 | { 61 | guint input_id; 62 | if (opening) { 63 | GIOChannel *channel; 64 | 65 | channel = g_io_channel_unix_new(IceConnectionNumber(ice_conn)); 66 | input_id = g_io_add_watch(channel, 67 | G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI, 68 | process_ice_messages, ice_conn); 69 | g_io_channel_unref(channel); 70 | *watch_data = (IcePointer)GUINT_TO_POINTER(input_id); 71 | } else { 72 | input_id = GPOINTER_TO_UINT((gpointer) *watch_data); 73 | g_source_remove(input_id); 74 | } 75 | } 76 | 77 | static void 78 | save_yourself_proc(SmcConn smc_conn, SmPointer client_data, int save_type, 79 | Bool shutdown, int interact_style, Bool fast) 80 | { 81 | nabi_app_save_config(); 82 | SmcSaveYourselfDone(smc_conn, True); 83 | } 84 | 85 | static void 86 | die_proc(SmcConn smc_conn, SmPointer client_data) 87 | { 88 | nabi_app_quit(); 89 | } 90 | 91 | static void 92 | save_complete_proc(SmcConn smc_conn, SmPointer client_data) 93 | { 94 | } 95 | 96 | static void 97 | shutdown_cancelled_proc(SmcConn smc_conn, SmPointer client_data) 98 | { 99 | SmcSaveYourselfDone(smc_conn, True); 100 | } 101 | 102 | static SmProp * 103 | property_new(const char *name, const char *type, ...) 104 | { 105 | SmProp *prop; 106 | SmPropValue *val_list; 107 | va_list args; 108 | const char *str; 109 | int n, i; 110 | 111 | prop = g_malloc(sizeof(SmProp)); 112 | prop->name = g_strdup(name); 113 | prop->type = g_strdup(type); 114 | 115 | va_start(args, type); 116 | str = va_arg(args, const char*); 117 | for (n = 0; str != NULL; n++, str = va_arg(args, const char*)) 118 | continue; 119 | va_end(args); 120 | 121 | prop->num_vals = n; 122 | 123 | val_list = g_malloc(sizeof(SmPropValue) * n); 124 | va_start(args, type); 125 | for (i = 0; i < n; i++) { 126 | str = va_arg(args, const char*); 127 | val_list[i].length = strlen(str); 128 | val_list[i].value = g_strdup(str); 129 | } 130 | va_end(args); 131 | 132 | prop->vals = val_list; 133 | 134 | return prop; 135 | } 136 | 137 | static void 138 | property_free(SmProp *prop) 139 | { 140 | int i; 141 | 142 | g_free(prop->name); 143 | g_free(prop->type); 144 | for (i = 0; i < prop->num_vals; i++) 145 | g_free(prop->vals[i].value); 146 | g_free(prop->vals); 147 | g_free(prop); 148 | } 149 | 150 | static void 151 | setup_properties(const char *client_id) 152 | { 153 | gchar *process_id; 154 | gchar *restart_style_hint; 155 | const gchar *program; 156 | const gchar *user_id; 157 | SmProp *prop_list[6]; 158 | 159 | if (session_connection == NULL) 160 | return; 161 | 162 | process_id = g_strdup_printf("%d", (int) getpid()); 163 | program = g_get_prgname(); 164 | user_id = g_get_user_name(); 165 | 166 | prop_list[0] = property_new(SmCloneCommand, SmLISTofARRAY8, program, NULL); 167 | prop_list[1] = property_new(SmProcessID, SmARRAY8, process_id, NULL); 168 | prop_list[2] = property_new(SmProgram, SmARRAY8, program, NULL); 169 | if (nabi->status_only) 170 | prop_list[3] = property_new(SmRestartCommand, SmLISTofARRAY8, 171 | program, "--status-only", 172 | "--sm-client-id", client_id, NULL); 173 | else 174 | prop_list[3] = property_new(SmRestartCommand, SmLISTofARRAY8, 175 | program, "--sm-client-id", client_id, NULL); 176 | prop_list[4] = property_new(SmUserID, SmARRAY8, user_id, NULL); 177 | restart_style_hint = g_strdup_printf("%c", (char)SmRestartImmediately); 178 | prop_list[5] = property_new(SmRestartStyleHint, 179 | SmCARD8, restart_style_hint, NULL); 180 | g_free(restart_style_hint); 181 | 182 | SmcSetProperties(session_connection, 6, prop_list); 183 | 184 | property_free(prop_list[0]); 185 | property_free(prop_list[1]); 186 | property_free(prop_list[2]); 187 | property_free(prop_list[3]); 188 | property_free(prop_list[4]); 189 | property_free(prop_list[5]); 190 | 191 | g_free(process_id); 192 | } 193 | 194 | void 195 | nabi_session_open(char *previos_id) 196 | { 197 | char buf[256]; 198 | SmcCallbacks callbacks; 199 | char *client_id = NULL; 200 | 201 | IceAddConnectionWatch(ice_watch_proc, NULL); 202 | 203 | callbacks.save_yourself.callback = save_yourself_proc; 204 | callbacks.save_yourself.client_data = NULL; 205 | callbacks.die.callback = die_proc; 206 | callbacks.die.client_data = NULL; 207 | callbacks.save_complete.callback = save_complete_proc; 208 | callbacks.save_complete.client_data = NULL; 209 | callbacks.shutdown_cancelled.callback = shutdown_cancelled_proc; 210 | callbacks.shutdown_cancelled.client_data = NULL; 211 | 212 | session_connection = SmcOpenConnection(NULL, NULL, 213 | SmProtoMajor, SmProtoMinor, 214 | SmcSaveYourselfProcMask | 215 | SmcDieProcMask | 216 | SmcSaveCompleteProcMask | 217 | SmcShutdownCancelledProcMask, 218 | &callbacks, 219 | previos_id, 220 | &client_id, 221 | sizeof(buf), 222 | buf); 223 | if (session_connection == NULL) { 224 | nabi_log(1, "session: %s\n", buf); 225 | return; 226 | } 227 | 228 | if (client_id == NULL) 229 | return; 230 | 231 | setup_properties(client_id); 232 | gdk_set_sm_client_id(client_id); 233 | 234 | g_free(nabi->session_id); 235 | nabi->session_id = client_id; 236 | return; 237 | } 238 | 239 | void 240 | nabi_session_close(void) 241 | { 242 | char *prop_names[] = { SmRestartStyleHint, 0 }; 243 | 244 | if (session_connection == NULL) 245 | return; 246 | 247 | SmcDeleteProperties(session_connection, 1, prop_names); 248 | SmcCloseConnection(session_connection, 0, NULL); 249 | gdk_set_sm_client_id(NULL); 250 | g_free(nabi->session_id); 251 | nabi->session_id = NULL; 252 | } 253 | 254 | #else /* HAVE_LIBSM */ 255 | 256 | void nabi_session_open(char *previos_id) 257 | { 258 | } 259 | 260 | void nabi_session_close(void) 261 | { 262 | } 263 | 264 | #endif /* HAVE_LIBSM */ 265 | -------------------------------------------------------------------------------- /src/server.h: -------------------------------------------------------------------------------- 1 | /* Nabi - X Input Method server for hangul 2 | * Copyright (C) 2003-2009 Choe Hwanjin 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 | */ 18 | 19 | #ifndef __SERVER_H_ 20 | #define __SERVER_H_ 21 | 22 | #ifdef HAVE_STDINT_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "../IMdkit/IMdkit.h" 35 | #include "../IMdkit/Xi18n.h" 36 | 37 | #include "ic.h" 38 | #include "keyboard-layout.h" 39 | 40 | typedef struct _NabiHangulKeyboard NabiHangulKeyboard; 41 | typedef struct _NabiServer NabiServer; 42 | 43 | #define KEYBOARD_TABLE_SIZE 94 44 | struct _NabiHangulKeyboard { 45 | const gchar* id; 46 | const gchar* name; 47 | }; 48 | 49 | typedef enum { 50 | NABI_OUTPUT_SYLLABLE, 51 | NABI_OUTPUT_JAMO, 52 | NABI_OUTPUT_MANUAL 53 | } NabiOutputMode; 54 | 55 | typedef enum { 56 | NABI_INPUT_MODE_PER_DESKTOP, 57 | NABI_INPUT_MODE_PER_APPLICATION, 58 | NABI_INPUT_MODE_PER_TOPLEVEL, 59 | NABI_INPUT_MODE_PER_IC 60 | } NabiInputModeScope; 61 | 62 | enum { 63 | NABI_MODE_INFO_NONE, 64 | NABI_MODE_INFO_DIRECT, 65 | NABI_MODE_INFO_COMPOSE 66 | }; 67 | 68 | typedef void (*NabiModeInfoCallback)(int); 69 | 70 | struct NabiStatistics { 71 | int total; 72 | int space; 73 | int backspace; 74 | int shift; 75 | int jamo[256]; 76 | }; 77 | 78 | struct _NabiServer { 79 | /* XIMS */ 80 | Display* display; 81 | int screen; 82 | char* name; 83 | XIMS xims; 84 | Window window; 85 | long filter_mask; 86 | XIMTriggerKeys trigger_keys; 87 | XIMTriggerKeys off_keys; 88 | XIMTriggerKeys candidate_keys; 89 | char** locales; 90 | 91 | /* xim connection list */ 92 | GSList* connections; 93 | GSList* toplevels; 94 | 95 | /* keyboard translate */ 96 | GList* layouts; 97 | NabiKeyboardLayout* layout; 98 | 99 | /* hangul automata */ 100 | char* hangul_keyboard; 101 | NabiHangulKeyboard* hangul_keyboard_list; 102 | 103 | NabiOutputMode output_mode; 104 | 105 | /* hanja */ 106 | HanjaTable* hanja_table; 107 | 108 | /* symbol */ 109 | HanjaTable* symbol_table; 110 | 111 | /* options */ 112 | Bool dynamic_event_flow; 113 | Bool commit_by_word; 114 | Bool auto_reorder; 115 | Bool show_status; 116 | Bool hanja_mode; 117 | Bool use_simplified_chinese; 118 | Bool ignore_app_fontset; 119 | Bool use_system_keymap; 120 | NabiInputMode default_input_mode; 121 | NabiInputMode input_mode; 122 | NabiInputModeScope input_mode_scope; 123 | GdkColor preedit_fg; 124 | GdkColor preedit_bg; 125 | 126 | PangoFontDescription* preedit_font; 127 | PangoFontDescription* candidate_font; 128 | 129 | /* statistics */ 130 | time_t start_time; 131 | struct NabiStatistics statistics; 132 | }; 133 | 134 | extern NabiServer* nabi_server; 135 | 136 | NabiServer* nabi_server_new (Display* display, 137 | int screen, 138 | const char* name); 139 | void nabi_server_destroy (NabiServer* server); 140 | int nabi_server_start (NabiServer* server); 141 | int nabi_server_stop (NabiServer *server); 142 | 143 | Bool nabi_server_is_running(); 144 | Bool nabi_server_is_trigger_key (NabiServer* server, 145 | KeySym key, 146 | unsigned int state); 147 | Bool nabi_server_is_off_key (NabiServer* server, 148 | KeySym key, 149 | unsigned int state); 150 | Bool nabi_server_is_candidate_key(NabiServer* server, 151 | KeySym key, 152 | unsigned int state); 153 | void nabi_server_set_trigger_keys (NabiServer *server, char **keys); 154 | void nabi_server_set_off_keys (NabiServer *server, char **keys); 155 | void nabi_server_set_candidate_keys(NabiServer *server, char **keys); 156 | 157 | void nabi_server_load_keyboard_layout(NabiServer *server, 158 | const char *filename); 159 | void nabi_server_set_keyboard_layout(NabiServer *server, 160 | const char* name); 161 | void nabi_server_set_hangul_keyboard(NabiServer *server, 162 | const char *id); 163 | void nabi_server_toggle_input_mode(NabiServer* server); 164 | 165 | void nabi_server_set_mode_info(NabiServer *server, int state); 166 | void nabi_server_set_output_mode (NabiServer *server, 167 | NabiOutputMode mode); 168 | void nabi_server_set_preedit_font(NabiServer *server, 169 | const gchar *font_desc); 170 | void nabi_server_set_candidate_font(NabiServer *server, 171 | const gchar *font_desc); 172 | void nabi_server_set_dynamic_event_flow(NabiServer* server, Bool flag); 173 | void nabi_server_set_xim_name(NabiServer* server, const char* name); 174 | void nabi_server_set_commit_by_word(NabiServer* server, Bool flag); 175 | void nabi_server_set_auto_reorder(NabiServer* server, Bool flag); 176 | void nabi_server_set_hanja_mode(NabiServer* server, Bool flag); 177 | void nabi_server_set_default_input_mode(NabiServer* server, 178 | NabiInputMode mode); 179 | void nabi_server_set_input_mode_scope(NabiServer* server, 180 | NabiInputModeScope scope); 181 | void nabi_server_set_simplified_chinese(NabiServer* server, Bool state); 182 | void nabi_server_set_ignore_app_fontset(NabiServer* server, Bool state); 183 | void nabi_server_set_use_system_keymap(NabiServer* server, Bool state); 184 | 185 | NabiIC* nabi_server_get_ic (NabiServer *server, 186 | CARD16 connect_id, CARD16 icid); 187 | gboolean nabi_server_is_valid_ic (NabiServer* server, NabiIC* ic); 188 | 189 | NabiConnection* nabi_server_create_connection (NabiServer *server, 190 | CARD16 connect_id, 191 | const char* locale); 192 | NabiConnection* nabi_server_get_connection (NabiServer *server, 193 | CARD16 connect_id); 194 | void nabi_server_destroy_connection(NabiServer *server, 195 | CARD16 connect_id); 196 | 197 | NabiToplevel* nabi_server_get_toplevel(NabiServer* server, Window id); 198 | void nabi_server_remove_toplevel(NabiServer* server, 199 | NabiToplevel* toplevel); 200 | 201 | Bool nabi_server_is_locale_supported(NabiServer *server, 202 | const char *locale); 203 | Bool nabi_server_is_valid_str (NabiServer *server, const char* str); 204 | 205 | void nabi_server_log_key (NabiServer *server, 206 | ucschar c, 207 | unsigned int state); 208 | void nabi_server_write_log(NabiServer *server); 209 | 210 | Bool nabi_server_load_keyboard_table(NabiServer *server, 211 | const char *filename); 212 | Bool nabi_server_load_compose_table(NabiServer *server, 213 | const char *filename); 214 | 215 | const NabiHangulKeyboard* 216 | nabi_server_get_hangul_keyboard_list(NabiServer* server); 217 | 218 | const char* nabi_server_get_keyboard_name_by_id(NabiServer* server, 219 | const char* id); 220 | const char* nabi_server_get_current_keyboard_name(NabiServer* server); 221 | 222 | #endif /* __SERVER_H_ */ 223 | 224 | /* vim: set ts=8 sw=4 sts=4 : */ 225 | --------------------------------------------------------------------------------