diff --git a/scim-wnn/src/scim_wnn_def.h b/scim-wnn/src/scim_wnn_def.h index e0ba1d6..56a5ee1 100644 --- a/scim-wnn/src/scim_wnn_def.h +++ b/scim-wnn/src/scim_wnn_def.h @@ -69,6 +69,8 @@ #define SCIM_DEFAULT_WNN_MINISTATUS false #define SCIM_PROP_WNN_MODESTATUS "/IMEngine/Wnn/Property/ModeStatus" +#define SCIM_PROP_WNN_INPUTMODE "/IMEngine/Wnn/InputMode" + #endif diff --git a/scim-wnn/src/scim_wnn_imengine.cpp b/scim-wnn/src/scim_wnn_imengine.cpp index f5f4ae1..f6a95af 100644 --- a/scim-wnn/src/scim_wnn_imengine.cpp +++ b/scim-wnn/src/scim_wnn_imengine.cpp @@ -56,7 +56,6 @@ #define SCIM_WNN_ICON_FILE (SCIM_ICONDIR "/scim-wnn.png") #endif -#define SCIM_PROP_WNN_INPUTMODE "/IMEngine/Wnn/InputMode" static Pointer _scim_wnn_factory; static ConfigPointer _scim_config; @@ -177,7 +176,6 @@ : IMEngineInstanceBase (factory, encoding, id) { m_iconv.set_encoding ("EUC-JP"); - m_connected = false; preeditors.push_back(new Romkan(_scim_config)); preeditors.push_back(new KanaInput(_scim_config)); m_preeditor = preeditors.at(0); @@ -618,7 +616,9 @@ m_conversion = false; m_lookup = false; wnn.reset(); + wnn.wnnDisconnect(); m_preeditor->reset(); + m_proplist.clear(); updatePreEditor(); } @@ -664,10 +664,10 @@ void WnnInstance::startConversion(WideString s) { hide_aux_string(); - if (!m_connected) { - m_connected = wnn.wnnConnect(String("scim-wnn"),host,rc,0); + if (!wnn.isConnected()) { + wnn.wnnConnect(String("scim-wnn"),host,rc,0); } - if (!m_connected) { + if (!wnn.isConnected()) { update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); show_aux_string(); return; diff --git a/scim-wnn/src/scim_wnn_imengine.h b/scim-wnn/src/scim_wnn_imengine.h index 47447ca..344f911 100644 --- a/scim-wnn/src/scim_wnn_imengine.h +++ b/scim-wnn/src/scim_wnn_imengine.h @@ -93,7 +93,6 @@ bool mini_status; String host; String rc; - bool m_connected; IConvert m_iconv; vector preeditors; protected: diff --git a/scim-wnn/src/wnnconversion.cpp b/scim-wnn/src/wnnconversion.cpp index fe24ae6..08bea82 100644 --- a/scim-wnn/src/wnnconversion.cpp +++ b/scim-wnn/src/wnnconversion.cpp @@ -95,6 +95,17 @@ /*! + \fn WnnConversion::wnnDisconnect() + */ +void WnnConversion::wnnDisconnect() +{ + reset(); + if (wnn) jl_close(wnn); + wnn = 0; +} + + +/*! \fn WnnConversion::isConnected() */ bool WnnConversion::isConnected() @@ -358,3 +369,4 @@ { return(caretPos); } + diff --git a/scim-wnn/src/wnnconversion.h b/scim-wnn/src/wnnconversion.h index 30eab17..0745380 100644 --- a/scim-wnn/src/wnnconversion.h +++ b/scim-wnn/src/wnnconversion.h @@ -63,6 +63,7 @@ bool resizeRegion(int w); void updateFrequency(); bool wnnConnect(String name,String host,String rc,int timeout); + void wnnDisconnect(); int getCaretPos(); protected: diff --git a/scim-wnn/src/wnnproto.h b/scim-wnn/src/wnnproto.h index 7debc74..fa8da9f 100644 --- a/scim-wnn/src/wnnproto.h +++ b/scim-wnn/src/wnnproto.h @@ -32,6 +32,7 @@ #define w_char unsigned short struct wnn_buf *jl_open_lang(char *,char *,char *,char *,int (*)(char *),int(*)(char *),int); #define jl_open(a,b,c,d,e,f) jl_open_lang(a,b,NULL,c,d,e,f) + void jl_close(struct wnn_buf*); /*