Index: ChangeLog =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/ChangeLog,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- ChangeLog 7 Mar 2004 07:07:43 -0000 1.71 +++ ChangeLog 9 Mar 2004 13:52:43 -0000 1.72 @@ -1,3 +1,14 @@ +2004-03-09 YamaKen + + * QPE/IMEチャネルの'keyEvent(int,int,int,int,int)'メッセージでキー + 入力を行えるようにした + + * KeyHelperAppletとの連携機能を追加。IMにキー入力を渡す前に一度 + KeyHelperを経由させる事でキーマップの変換等を可能にした + + * QPE/IMEチャネルで受け付けるメッセージに'imkit'プリフィクスが無い + バージョンを追加した + 2004-03-07 YamaKen * IMKIT_0_4_0_PRE8: テスト向けリリース Index: README =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/README,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- README 21 Jan 2004 16:12:14 -0000 1.13 +++ README 9 Mar 2004 13:52:43 -0000 1.14 @@ -114,6 +114,7 @@ QPE/IME チャネル + - setMode(QString) - imkitSetMode(QString) 入力文字種を選択します。以下のいずれかを引数に指定します。現 @@ -132,6 +133,23 @@ HKATAKANA … (いわゆる)半角カタカナ KANJI … 漢字直接入力(T-Code等) + + - keyEvent(int,int,int,int,int) + - imkitKeyEvent(int,int,int,int,int) + + キー入力をエミュレートします。これにより他のアプリケーション + からキー入力をコントロールできます。引数は + QWSServer::sendKeyEvent(int unicode, int keycode, int + modifiers, bool isPress, bool autoRepeat)に渡すものと同じで + す。 + +-------------------------------- +その他の機能 + +- yaktyさん作のKeyHelperApplet(Version 1.1.3以降)と連携する機能 + を持っています。IMKitはKeyHelperが起動している事を自動的に検知 + し、キー入力を一旦KeyHelperに渡して処理した結果をIMに渡します + -------------------------------- 関連リンク、連絡先等 @@ -164,13 +182,16 @@ - Linuxザウルス開発メモ/IMKit-uim (Wiki) http://digit.que.ne.jp/visit/index.cgi?Linux%a5%b6%a5%a6%a5%eb%a5%b9%b3%ab%c8%af%a5%e1%a5%e2%2fIMKit%2duim -・Anthy, uimの各プロジェクトについては以下のページをご参照ください +・関連ソフトウェアについては以下のページをご参照ください Anthy http://sourceforge.jp/projects/anthy/ uim http://uim.freedesktop.org/ + + KeyHelperApplet + http://yakty.s31.xrea.com/linuzau/keyhelper/ -------------------------------- 謝辞 Index: README.en =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/README.en,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- README.en 21 Jan 2004 16:12:16 -0000 1.6 +++ README.en 9 Mar 2004 13:52:43 -0000 1.7 @@ -115,6 +115,7 @@ QPE/IME channel + - setMode(QString) - imkitSetMode(QString) Changes input mode on current inputmethod. This message @@ -133,6 +134,22 @@ HKATAKANA -- half width katakana KANJI -- direct kanji input (T-Code, etc) + - keyEvent(int,int,int,int,int) + - imkitKeyEvent(int,int,int,int,int) + + Emulates key input. This enables other applications to + control key input to IMKit. The arguments are same as + QWSServer::sendKeyEvent(int unicode, int keycode, int + modifiers, bool isPress, bool autoRepeat). + +-------------------------------- +Miscellaneous features + +- IMKit can cooperate with yakty-san's KeyHelperApplet(Version + 1.1.3 or lator). IMKit will detect running of KeyHelper and + forwards key input to it, then KeyHelper sends back processed + key to IMKit. + -------------------------------- Related links and contact @@ -164,13 +181,16 @@ Linux Zarus development memo/IMKit-uim (Japanese) http://digit.que.ne.jp/visit/index.cgi?Linux%a5%b6%a5%a6%a5%eb%a5%b9%b3%ab%c8%af%a5%e1%a5%e2%2fIMKit%2duim -* Related projects +* Related softwares Anthy http://sourceforge.jp/projects/anthy/ uim http://uim.freedesktop.org/ + + KeyHelperApplet + http://yakty.s31.xrea.com/linuzau/keyhelper/ -------------------------------- Thanks Index: libimkit/aux_keyhelper.cpp =================================================================== RCS file: libimkit/aux_keyhelper.cpp diff -N libimkit/aux_keyhelper.cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ libimkit/aux_keyhelper.cpp 9 Mar 2004 13:52:43 -0000 1.1 @@ -0,0 +1,76 @@ +// IMKit: An inputmethod adaptation library for Qtopia environment +// Copyright (C) 2002-2004 YamaKen +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +// $Name: $ +// $Id: aux_keyhelper.cpp,v 1.1 2004/03/09 13:52:43 yamaken Exp $ + +#include +#include +#ifdef IMKIT_QPE16_PLATFORM +#include +#else +#include +#endif +#include "aux_keyhelper.h" + + +void +KeyHelperForwarder::on_activate(void) { + // instruct KeyHelper to send back key events to IMKit + QCopEnvelope envelope("QPE/KeyHelper", "hook(QString)"); + + envelope << "QPE/IME"; +} + +void +KeyHelperForwarder::on_deactivate(void) { + QCopEnvelope envelope("QPE/KeyHelper", "unhook()"); +} + +void +KeyHelperForwarder::on_input(QKeyEvent &e) { + if (QCopChannel::isRegistered("QPE/KeyHelper")) { + forward(e); + e.accept(); + } +} + +void +KeyHelperForwarder::forward(QKeyEvent &e) { + QCopEnvelope envelope("QPE/KeyHelper", "event(int,int,int,int,int)"); + int unicode, modifiers; + bool is_press; + + unicode = e.text().at(0).unicode(); + modifiers = e.state(); + is_press = (e.type() == QEvent::KeyPress); + + envelope << unicode << e.key() << modifiers + << (int)is_press << (int)e.isAutoRepeat(); +} + +KeyHelperForwarder::KeyHelperForwarder(void) { +} + +KeyHelperForwarder::~KeyHelperForwarder(void) { + deactivate(); +} + +void +KeyHelperForwarder::slot_activate(bool activity) { + activate(activity); +} Index: libimkit/aux_keyhelper.h =================================================================== RCS file: libimkit/aux_keyhelper.h diff -N libimkit/aux_keyhelper.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ libimkit/aux_keyhelper.h 9 Mar 2004 13:52:43 -0000 1.1 @@ -0,0 +1,60 @@ +// IMKit: An inputmethod adaptation library for Qtopia environment +// Copyright (C) 2002-2004 YamaKen +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +// $Name: $ +// $Id: aux_keyhelper.h,v 1.1 2004/03/09 13:52:43 yamaken Exp $ + +// aux_keyhelper: An auxiliary keyfilter to cooperate with +// yakty-san's KeyHelperApplet. This enables KeyHelper to +// process key events precede IMKit. See following pages +// (written in Japanese). +// +// - homepage +// http://yakty.s31.xrea.com/linuzau/keyhelper/ +// +// - key hook feature +// http://yakty.s31.xrea.com/cgi-bin/wiki/linuzau/wiki.cgi?KeyHelperApplet%2f%a5%ad%a1%bc%a5%d5%a5%c3%a5%af%b5%a1%c7%bd + +#ifndef IMKIT_AUX_KEYHELPER_H +#define IMKIT_AUX_KEYHELPER_H + +#include +#include "util.h" +#include "keyfilter.h" + + +class KeyHelperForwarder + : public QObject, public CascadeKeyFilter, public StdActivatable +{ + Q_OBJECT + +protected: + virtual void on_activate(void); + virtual void on_deactivate(void); + virtual void on_input(QKeyEvent &e); + virtual void forward(QKeyEvent &e); + +public: + KeyHelperForwarder(void); + virtual ~KeyHelperForwarder(void); + +public slots: + virtual void slot_activate(bool activity); +}; + + +#endif // IMKIT_AUX_KEYHELPER_H Index: libimkit/platform_qpe.cpp =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/libimkit/platform_qpe.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- libimkit/platform_qpe.cpp 7 Mar 2004 07:07:43 -0000 1.22 +++ libimkit/platform_qpe.cpp 9 Mar 2004 13:52:43 -0000 1.23 @@ -237,6 +237,36 @@ receiver, SLOT(qcopReceive(const QCString&, const QByteArray&))); } +KeyInjector::KeyInjector(QObject *parent, const char *name) + : QObject(parent, name) +{ +} + +KeyInjector::~KeyInjector(void) { +} + +bool +KeyInjector::filter(int unicode, int keycode, int modifiers, + bool is_press, bool autorepeat) +{ + QKeyEvent *e; + bool stopped; + + e = keyevent_converter.create(unicode, keycode, modifiers, + is_press, autorepeat); + e->ignore(); + output(e); + stopped = e->isAccepted(); + delete e; + + return stopped; +} + +void +KeyInjector::slot_activate(bool activity) { + activate(activity); +} + void QWSKeyBypassIn::on_activate(void) { if (!keyfilter_is_registered) { @@ -260,36 +290,13 @@ } QWSKeyBypassIn::QWSKeyBypassIn(void) - : QObject(NULL, "QWSKeyBypassIn"), - keyevent_converter(), keyfilter_is_registered(false) + : KeyInjector(NULL, "QWSKeyBypassIn"), keyfilter_is_registered(false) { } QWSKeyBypassIn::~QWSKeyBypassIn(void) { } -bool -QWSKeyBypassIn::filter(int unicode, int keycode, int modifiers, - bool is_press, bool autorepeat) -{ - QKeyEvent *e; - bool stopped; - - e = keyevent_converter.create(unicode, keycode, modifiers, - is_press, autorepeat); - e->ignore(); - output(e); - stopped = e->isAccepted(); - delete e; - - return stopped; -} - -void -QWSKeyBypassIn::slot_activate(bool activity) { - activate(activity); -} - void QWSKeyBypassOut::on_input(QKeyEvent &e) { emit_as_signal(e); @@ -346,14 +353,20 @@ join_to_bypass(im_ui->keyfilter_begin()); QObject::connect(im_ui, SIGNAL(slot_activated(bool)), bypass_in, SLOT(slot_activate(bool))); + QObject::connect(im_ui, SIGNAL(slot_activated(bool)), + forwarder, SLOT(slot_activate(bool))); + QObject::connect(im_ui, SIGNAL(slot_activated(bool)), + injector, SLOT(slot_activate(bool))); } } void IMKitImpl::prepare_key_bypass(void) { bypass_in = new QWSKeyBypassIn; + forwarder = new KeyHelperForwarder; + injector = new KeyInjector; bypass_out = new QWSKeyBypassOut; - bypass_in->insert_after(bypass_out); + *bypass_in << *forwarder << *injector << *bypass_out; bypass_out->activate(); } @@ -380,6 +393,8 @@ qDebug("IMKitImpl::~IMKitImpl()"); delete receiver; delete bypass_out; + delete injector; + delete forwarder; delete bypass_in; delete _icon; if (im_ui) { @@ -427,7 +442,7 @@ IMKitImpl::qcopReceive(const QCString &msg, const QByteArray &data) { QDataStream stream(data, IO_ReadOnly); - if (msg == "imkitSetMode(QString)") { + if (msg == "imkitSetMode(QString)" || msg == "setMode(QString)") { QString map_name; InputMap map_val; @@ -436,6 +451,13 @@ if (map_val == IMKIT_INPUT_MAP_TERM) return; im_ui->engine().select_map(map_val); + } else if (msg == "imkitKeyEvent(int,int,int,int,int)" + || msg == "keyEvent(int,int,int,int,int)") + { + int unicode, keycode, modifiers, is_press, autorepeat; + + stream >> unicode >> keycode >> modifiers >> is_press >> autorepeat; + injector->filter(unicode, keycode, modifiers, is_press, autorepeat); } } Index: libimkit/platform_qpe.h =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/libimkit/platform_qpe.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- libimkit/platform_qpe.h 7 Mar 2004 07:07:43 -0000 1.14 +++ libimkit/platform_qpe.h 9 Mar 2004 13:52:43 -0000 1.15 @@ -31,6 +31,7 @@ #include "keyfilter.h" #include "ui.h" #include "ui_std.h" +#include "aux_keyhelper.h" typedef IMUserInterface *(*imkit_create_custom_ui_t)(StdIMWidgetFactory *elem_factory); @@ -69,7 +70,7 @@ }; -class QWSKeyBypassIn +class KeyInjector : public QObject, public CascadeKeyFilter, public StdActivatable, public QWSServer::KeyboardFilter { @@ -77,6 +78,22 @@ protected: KeyEventConverter keyevent_converter; + +public: + KeyInjector(QObject *parent = NULL, const char *name = "KeyInjector"); + virtual ~KeyInjector(void); + virtual bool filter(int unicode, int keycode, int modifiers, + bool is_press, bool autorepeat); + +public slots: + virtual void slot_activate(bool activity); +}; + + +class QWSKeyBypassIn : public KeyInjector { + Q_OBJECT + +protected: bool keyfilter_is_registered; protected: @@ -86,11 +103,6 @@ public: QWSKeyBypassIn(void); virtual ~QWSKeyBypassIn(void); - virtual bool filter(int unicode, int keycode, int modifiers, - bool is_press, bool autorepeat); - -public slots: - virtual void slot_activate(bool activity); }; @@ -149,6 +161,8 @@ imkit_create_custom_ui_t ui_creator; QPixmap *_icon; QWSKeyBypassIn *bypass_in; + KeyHelperForwarder *forwarder; + KeyInjector *injector; QWSKeyBypassOut *bypass_out; IMKitQCopReceiver *receiver; Index: libimkit/platform_qpe16.cpp =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/libimkit/platform_qpe16.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- libimkit/platform_qpe16.cpp 7 Mar 2004 07:07:43 -0000 1.36 +++ libimkit/platform_qpe16.cpp 9 Mar 2004 13:52:43 -0000 1.37 @@ -16,7 +16,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // $Name: $ -// $Id: platform_qpe16.cpp,v 1.36 2004/03/07 07:07:43 yamaken Exp $ +// $Id: platform_qpe16.cpp,v 1.37 2004/03/09 13:52:43 yamaken Exp $ #include #include @@ -360,6 +360,10 @@ join_to_bypass(im_ui->keyfilter_begin()); QObject::connect(im_ui, SIGNAL(slot_activated(bool)), bypass_in, SLOT(slot_activate(bool))); + QObject::connect(im_ui, SIGNAL(slot_activated(bool)), + forwarder, SLOT(slot_activate(bool))); + QObject::connect(im_ui, SIGNAL(slot_activated(bool)), + injector, SLOT(slot_activate(bool))); qws_im = new IMKitInputMethod(bypass_in, bypass_out); #ifdef IMKIT_QPE16_EXPERIMENTAL_CONTEXT_RESET QObject::connect(qws_im, SIGNAL(signal_reset(void)), @@ -372,12 +376,14 @@ void ExtIMKitImpl::prepare_key_bypass(void) { bypass_in = new Qpe16QWSKeyBypassIn; + forwarder = new KeyHelperForwarder; + injector = new KeyInjector; #ifdef IMKIT_BROKEN_QPE16_KEYFILTER bypass_out = new Qpe16QWSKeyBypassOut; #else bypass_out = new QWSKeyBypassOut; #endif - bypass_in->insert_after(bypass_out); + *bypass_in << *forwarder << *injector << *bypass_out; bypass_out->activate(); } @@ -406,6 +412,8 @@ ExtIMKitImpl::~ExtIMKitImpl(void) { qDebug("ExtIMKitImpl::~ExtIMKitImpl()"); delete bypass_out; + delete injector; + delete forwarder; delete bypass_in; if (im_ui) { delete qws_im; Index: libimkit/platform_qpe16.h =================================================================== RCS file: /var/cvsroot/yamaken/devel/zaurus/imkit/libimkit/platform_qpe16.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- libimkit/platform_qpe16.h 7 Mar 2004 07:07:43 -0000 1.20 +++ libimkit/platform_qpe16.h 9 Mar 2004 13:52:43 -0000 1.21 @@ -35,6 +35,7 @@ #include "ui_std.h" #include "widgets/imkit_compactselector.h" #include "platform_qpe.h" +#include "aux_keyhelper.h" class IMKitInputMethod; @@ -177,6 +178,8 @@ imkit_create_custom_ui_t ui_creator; QPixmap *_icon; QWSKeyBypassIn *bypass_in; + KeyHelperForwarder *forwarder; + KeyInjector *injector; QWSKeyBypassOut *bypass_out; private: