Author: ek.kato
Date: Mon May 12 08:31:29 2008
New Revision: 5488
Added:
branches/1.5/uim/counted-init.c
branches/1.5/uim/counted-init.h
Modified:
branches/1.5/qt/Makefile.am
branches/1.5/qt/immodule-plugin.cpp
branches/1.5/qt/immodule-quiminputcontext.cpp
branches/1.5/qt/immodule-quiminputcontext.h
branches/1.5/qt/pref-qt.cpp
branches/1.5/uim/Makefile.am
Log:
* Merge r5487 from trunk.
Modified: branches/1.5/qt/Makefile.am
==============================================================================
--- branches/1.5/qt/Makefile.am (original)
+++ branches/1.5/qt/Makefile.am Mon May 12 08:31:29 2008
@@ -105,7 +105,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 =
$(top_builddir)/uim/libuim-counted-init.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
@@ -182,7 +183,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 = $(top_builddir)/uim/libuim-counted-init.la \
+ $(top_builddir)/uim/libuim-custom.la \
$(top_builddir)/uim/libuim-scm.la \
$(top_builddir)/uim/libuim.la
Modified: branches/1.5/qt/immodule-plugin.cpp
==============================================================================
--- branches/1.5/qt/immodule-plugin.cpp (original)
+++ branches/1.5/qt/immodule-plugin.cpp Mon May 12 08:31:29 2008
@@ -40,6 +40,7 @@
#include <locale.h>
#include "uim/uim.h"
+#include "uim/counted-init.h"
#include "immodule-plugin.h"
#include "immodule-quiminputcontext_with_slave.h"
@@ -121,7 +122,7 @@
void
UimInputContextPlugin::uimInit()
{
- if ( !uim_init() ) {
+ if ( !uim_counted_init() ) {
if (!infoManager)
infoManager = new QUimInfoManager();
#if UIM_QT_USE_JAPANESE_KANA_KEYBOARD_HACK
@@ -136,7 +137,7 @@
{
if ( uimReady )
{
- uim_quit();
+ uim_counted_quit();
delete infoManager;
uimReady = false;
}
Modified: branches/1.5/qt/immodule-quiminputcontext.cpp
==============================================================================
--- branches/1.5/qt/immodule-quiminputcontext.cpp (original)
+++ branches/1.5/qt/immodule-quiminputcontext.cpp Mon May 12 08:31:29 2008
@@ -375,27 +375,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
Modified: branches/1.5/qt/immodule-quiminputcontext.h
==============================================================================
--- branches/1.5/qt/immodule-quiminputcontext.h (original)
+++ branches/1.5/qt/immodule-quiminputcontext.h Mon May 12 08:31:29 2008
@@ -88,7 +88,6 @@
uim_context uimContext() { return m_uc; }
static QUimInputContext *focusedIC();
- static void reloadUim();
void commitString( const QString& str );
Modified: branches/1.5/qt/pref-qt.cpp
==============================================================================
--- branches/1.5/qt/pref-qt.cpp (original)
+++ branches/1.5/qt/pref-qt.cpp Mon May 12 08:31:29 2008
@@ -59,6 +59,7 @@
#include <qmessagebox.h>
#include <qsettings.h>
+#include "uim/counted-init.h"
#include "qtgettext.h"
#include <stdlib.h>
@@ -70,7 +71,7 @@
: QDialog( parent, name ),
m_isValueChanged( false )
{
- uim_init();
+ uim_counted_init();
if (uim_custom_enable()) {
checkDotUimFile();
setupWidgets();
@@ -78,7 +79,7 @@
#if defined(ENABLE_DEBUG)
qDebug("uim_custom_enable() failed.");
#endif
- uim_quit();
+ uim_counted_quit();
QApplication::exit( -1 );
}
@@ -87,7 +88,7 @@
UimPrefDialog::~UimPrefDialog()
{
- uim_quit();
+ uim_counted_quit();
}
void UimPrefDialog::checkDotUimFile()
Modified: branches/1.5/uim/Makefile.am
==============================================================================
--- branches/1.5/uim/Makefile.am (original)
+++ branches/1.5/uim/Makefile.am Mon May 12 08:31:29 2008
@@ -18,6 +18,7 @@
if LIBUIM_X_UTIL
noinst_LTLIBRARIES += libuim-x-util.la
endif
+noinst_LTLIBRARIES += libuim-counted-init.la
# Although uim only needs *.so for the plugins, whether *.la is
# installed or not is system-dependent and uim leaves it untouched. It
@@ -209,6 +210,9 @@
libuim_custom_enabler_la_LIBADD = libuim-custom.la libuim-scm.la libuim.la
libuim_custom_enabler_la_LDFLAGS = -rpath $(uim_plugindir)
-avoid-version -module
libuim_custom_enabler_la_CPPFLAGS = -I$(top_srcdir)
+
+libuim_counted_init_la_SOURCES = counted-init.c counted-init.h
+libuim_counted_init_la_CPPFLAGS = -I$(top_srcdir)
if LIBUIM_X_UTIL
libuim_x_util_la_SOURCES = uim-x-util.h uim-x-kana-input-hack.c
Added: branches/1.5/uim/counted-init.c
==============================================================================
--- (empty file)
+++ branches/1.5/uim/counted-init.c Mon May 12 08:31:29 2008
@@ -0,0 +1,62 @@
+/*
+
+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 <config.h>
+
+#include "uim.h"
+#include "counted-init.h"
+
+unsigned int uim_init_count;
+
+int uim_counted_init()
+{
+ uim_init_count++;
+ if (uim_init_count != 1)
+ return 0;
+
+ return uim_init();
+}
+
+void uim_counted_quit()
+{
+ uim_init_count--;
+ if (uim_init_count != 0)
+ return;
+
+ uim_quit();
+}
+
+void uim_force_quit_regardless_of_count()
+{
+ uim_init_count = 0;
+ uim_quit();
+}
Added: branches/1.5/uim/counted-init.h
==============================================================================
--- (empty file)
+++ branches/1.5/uim/counted-init.h Mon May 12 08:31:29 2008
@@ -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_COUNTED_INIT_H
+#define UIM_COUNTED_INIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int uim_counted_init(void);
+void uim_counted_quit(void);
+void uim_force_quit_regardless_of_count(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif