|
|
问题:在KDE程序中使scim作为输入法时,如果KDE程序是从终端启动,那么会在终端中输出很多的调试信息。从google来的结果看。这个问题在2005年已经出现,当时Sir上的帖子中贴的输出已经有了这个问题,只不过大家一直没有当作BUG看待。只有Mandavia发行版本才为RPM包打了一个补丁,未测试其效果。
原理:输出信息系scim-qtimm和为qt-3的qt-x11-immoudles组件等打的补丁中,使用了很多的调试输出的调用并且没有注释掉。
解决方法:注释掉这些无关紧要的代码即可清静。
警告:这里只做建议性修改方法,具体目录请根据个人环境变通。强烈建议等待热心网友做的ebuild(本人不会)。对于任何尝试过程中造成的后果,本人概不负责。
操作步骤:
1、qt代码的修改方法。限qt-3.3.8-r4的ebuild。
先将代码解压:
- sudo ebuild /usr/portage/x11-libs/qt/qt-3.3.8-r4.ebuild unpack
复制代码
然后cd到/var/tmp/portage/x11-libs/qt-3.3.8-r4/work/qt-x11-free-3.3.8/src/kernel目录,使用vi编辑qinputcontext.cpp文件,将527行到539中的3句qDebug的输出语句注释掉:
- 527
- 528 if ( type == QEvent::IMStart ) {
- 529 // qDebug( "sending IMStart with %d chars to %p",
- 530 // text.length(), receiver );
- 531 event = new QIMEvent( type, text, cursorPosition );
- 532 } else if ( type == QEvent::IMEnd ) {
- 533 // qDebug( "sending IMEnd with %d chars to %p, text=%s",
- 534 // text.length(), receiver, (const char*)text.local8Bit() );
- 535 event = new QIMEvent( type, text, cursorPosition );
- 536 } else if ( type == QEvent::IMCompose ) {
- 537 // qDebug( "sending IMCompose to %p with %d chars, cpos=%d, sellen=%d,
- text=%s",
- 538 // receiver, text.length(), cursorPosition, selLength,
- 539 // (const char*)text.local8Bit() );
- 540 event = new QIMComposeEvent( type, text, cursorPosition, selLength
- );
- 541 }
复制代码
然后,切换到/var/tmp/portage/x11-libs/qt-3.3.8-r4/work/qt-x11-free-3.3.8/plugins/src/inputmethods/imsw-multi目录,编辑qmultiinputcontext.cpp文件,将309,310的两行调试语句注视掉:
- 306
- 307 currentIMKey = key;
- 308
- 309 // qDebug( "QMultiInputContext::changeInputMethod(): index=%d, slave=% s",
- 310 // imIndex, (const char *)_slave->identifierName() );
- 311 }
- 312 }
- 313
复制代码
最后依次执行
- sudo ebuild /usr/portage/x11-libs/qt/qt-3.3.8-r4.ebuild compile
- sudo ebuild /usr/portage/x11-libs/qt/qt-3.3.8-r4.ebuild install
- sudo ebuild /usr/portage/x11-libs/qt/qt-3.3.8-r4.ebuild qmerge
复制代码
介此qt补丁的修改工作完毕。
2、下面是修改scim-qtimm原理同上
- sudo ebuild /usr/portage/app-i18n/scim-qtimm/scim-qtimm-0.9.4.ebuild unpack
- cd /var/tmp/portage/app-i18n/scim-qtimm-0.9.4/work/scim-qtimm-0.9.4/src
复制代码
先编辑plugin.cpp,将构造和析构函数中的qDebug语句注视掉:
- 9 class ScimInputContextPlugin : public QInputContextPlugin
- 10 {
- 11 public:
- 12 ScimInputContextPlugin() : QInputContextPlugin() {
- 13 // qDebug("ScimInputContextPlugin()");
- 14 }
- 15
- 16 ~ScimInputContextPlugin()
- 17 {
- 18 // qDebug("~ScimInputContextPlugin()");
- 19 }
复制代码
再编辑qsciminputcontext.cpp文件,将310-312的3行注视掉:
- 305 config_module_name = config_list [0];
- 306 } else {
- 307 config_module_name = "dummy";
- 308 }
- 309
- 310 // if (config_module_name != "kconfig") {
- 311 // std::cerr << "WARNING: please edit ~/.scim/global and change /DefaultConfigModule to kconfig\n";
- 312 // }
- 313
- 314 const char *engine_list_str = getenv ("QT_IM_SCIM_IMENGINE_MODULES");
- 315 if (engine_list_str != NULL) {
- 316 std::vector <String> spec_engine_list;
- 317 scim_split_string_list (spec_engine_list, engine_list_str, ',');
- 318
复制代码
最后:
- sudo ebuild /usr/portage/app-i18n/scim-qtimm/scim-qtimm-0.9.4.ebuild compile
- sudo ebuild /usr/portage/app-i18n/scim-qtimm/scim-qtimm-0.9.4.ebuild install
- sudo ebuild /usr/portage/app-i18n/scim-qtimm/scim-qtimm-0.9.4.ebuild qmerge
复制代码
终端启动一个KDE程序,切换输入法打几个字试试,是不是清静了? |
|