Index: qt/immodule-plugin.cpp =================================================================== --- qt/immodule-plugin.cpp (revision 5483) +++ qt/immodule-plugin.cpp (working copy) @@ -44,6 +44,7 @@ #include "immodule-plugin.h" #include "immodule-quiminputcontext_with_slave.h" #include "immodule-quiminfomanager.h" +#include "init-wrap.h" #if UIM_QT_USE_JAPANESE_KANA_KEYBOARD_HACK #include "uim/uim-x-util.h" @@ -121,7 +122,7 @@ void UimInputContextPlugin::uimInit() { - if ( !uim_init() ) { + if ( !uim_wrap_uim_init() ) { if (!infoManager) infoManager = new QUimInfoManager(); #if UIM_QT_USE_JAPANESE_KANA_KEYBOARD_HACK @@ -136,7 +137,7 @@ { if ( uimReady ) { - uim_quit(); + uim_wrap_uim_quit(); delete infoManager; uimReady = false; } Index: qt/immodule-quiminputcontext.h =================================================================== --- qt/immodule-quiminputcontext.h (revision 5483) +++ qt/immodule-quiminputcontext.h (working copy) @@ -88,7 +88,6 @@ uim_context uimContext() { return m_uc; } static QUimInputContext *focusedIC(); - static void reloadUim(); void commitString( const QString& str ); Index: qt/pref-qt.cpp =================================================================== --- qt/pref-qt.cpp (revision 5483) +++ qt/pref-qt.cpp (working copy) @@ -59,6 +59,7 @@ #include #include +#include "init-wrap.h" #include "qtgettext.h" #include @@ -70,7 +71,7 @@ : QDialog( parent, name ), m_isValueChanged( false ) { - uim_init(); + uim_wrap_uim_init(); if (uim_custom_enable()) { checkDotUimFile(); setupWidgets(); @@ -78,7 +79,7 @@ #if defined(ENABLE_DEBUG) qDebug("uim_custom_enable() failed."); #endif - uim_quit(); + uim_wrap_uim_quit(); QApplication::exit( -1 ); } @@ -87,7 +88,7 @@ UimPrefDialog::~UimPrefDialog() { - uim_quit(); + uim_wrap_uim_quit(); } void UimPrefDialog::checkDotUimFile() Index: qt/immodule-quiminputcontext.cpp =================================================================== --- qt/immodule-quiminputcontext.cpp (revision 5483) +++ qt/immodule-quiminputcontext.cpp (working copy) @@ -58,6 +58,7 @@ #ifdef Q_WS_X11 #include "immodule-quiminputcontext_compose.h" #endif +#include "init-wrap.h" #if UIM_QT_USE_JAPANESE_KANA_KEYBOARD_HACK #include @@ -375,27 +376,6 @@ return focusedInputContext; } -void QUimInputContext::reloadUim() -{ - QUimInputContext *ic; - QUimInfoManager *infoManager = UimInputContextPlugin::getQUimInfoManager(); - - for ( ic = contextList.first(); ic; ic = contextList.next() ) - { - ic->reset(); - uim_release_context( ic->m_uc ); - } - - uim_quit(); - uim_init(); - infoManager->initUimInfo(); - - for ( ic = contextList.first(); ic; ic = contextList.next() ) - { - ic->m_uc = ic->createUimContext( ic->m_imname ); - } -} - void QUimInputContext::setMicroFocus( int x, int y, int w, int h, QFont * /* f */) { #ifdef ENABLE_DEBUG Index: qt/init-wrap.c =================================================================== --- qt/init-wrap.c (revision 0) +++ qt/init-wrap.c (revision 0) @@ -0,0 +1,66 @@ +/* + +Copyright (c) 2008 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#include + +#include + +#include "uim/uim.h" +#include "init-wrap.h" + +unsigned int uim_wrap_init_count; + +int uim_wrap_uim_init() +{ + uim_wrap_init_count++; + fprintf(stderr, "init: init wrap now %d\n", uim_wrap_init_count); + if (uim_wrap_init_count != 1) + return 0; + + return uim_init(); +} + +void uim_wrap_uim_quit() +{ + uim_wrap_init_count--; + fprintf(stderr, "quit: init wrap now %d\n", uim_wrap_init_count); + if (uim_wrap_init_count != 0) + return; + + uim_quit(); +} + +void uim_wrap_force_uim_quit() +{ + uim_wrap_init_count = 0; + uim_quit(); +} Index: qt/init-wrap.h =================================================================== --- qt/init-wrap.h (revision 0) +++ qt/init-wrap.h (revision 0) @@ -0,0 +1,49 @@ +/* + +Copyright (c) 2008 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ + +#ifndef UIM_QT_INIT_WRAP_H +#define UIM_QT_INIT_WRAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +int uim_wrap_uim_init(void); +void uim_wrap_uim_quit(void); +void uim_wrap_force_uim_quit(void); + +#ifdef __cplusplus +} +#endif + +#endif Index: qt/Makefile.am =================================================================== --- qt/Makefile.am (revision 5483) +++ qt/Makefile.am (working copy) @@ -28,6 +28,9 @@ toolbar-applet-kde.h endif +HEADER_FILES += \ + init-wrap.h + MOC_FILES = \ toolbar-common-quimhelpertoolbar.moc \ toolbar-common-uimstateindicator.moc \ @@ -67,6 +70,10 @@ libexec_PROGRAMS = uim-candwin-qt +noinst_LTLIBRARIES = libuim-init-wrap.la +libuim_init_wrap_la_SOURCES = init-wrap.c +libuim_init_wrap_la_CPPFLAGS = -I$(top_srcdir) + if APPLET_KDE applet_LTLIBRARIES = uim_panelapplet.la appletdir = @KDE_LIB_DIR@/kde3 @@ -105,7 +112,8 @@ immodule-subwindow.cpp immodule-subwindow.h libquiminputcontextplugin_la_CXXFLAGS = $(QT_CXXFLAGS) @X_CFLAGS@ libquiminputcontextplugin_la_LDFLAGS = $(QT_LDFLAGS) -avoid-version -libquiminputcontextplugin_la_LIBADD = $(top_builddir)/uim/libuim-scm.la \ +libquiminputcontextplugin_la_LIBADD = libuim-init-wrap.la \ + $(top_builddir)/uim/libuim-scm.la \ $(top_builddir)/uim/libuim.la if LIBUIM_X_UTIL libquiminputcontextplugin_la_LIBADD += $(top_builddir)/uim/libuim-x-util.la @@ -120,7 +128,7 @@ endif # Toolbar Common -noinst_LTLIBRARIES = libtoolbarcommon.la +noinst_LTLIBRARIES += libtoolbarcommon.la libtoolbarcommon_la_SOURCES = toolbar-common-quimhelpertoolbar.cpp toolbar-common-uimstateindicator.cpp qtgettext.h \ toolbar-common-quimhelpertoolbar.h toolbar-common-uimstateindicator.h libtoolbarcommon_la_CXXFLAGS = $(QT_CXXFLAGS) @@ -182,7 +190,8 @@ uim_pref_qt_CXXFLAGS = $(QT_CXXFLAGS) uim_pref_qt_LDFLAGS = $(QT_LDFLAGS) -uim_pref_qt_LDADD = $(top_builddir)/uim/libuim-custom.la \ +uim_pref_qt_LDADD = libuim-init-wrap.la \ + $(top_builddir)/uim/libuim-custom.la \ $(top_builddir)/uim/libuim-scm.la \ $(top_builddir)/uim/libuim.la