diff --git a/scim-wnn/src/scim_wnn_def.h b/scim-wnn/src/scim_wnn_def.h index f143c69..ebdd3b0 100644 --- a/scim-wnn/src/scim_wnn_def.h +++ b/scim-wnn/src/scim_wnn_def.h @@ -71,6 +71,8 @@ #define SCIM_DEFAULT_WNN_SERVER "localhost" #define SCIM_CONFIG_WNN_RC "/IMEngine/Wnn/Rc" #define SCIM_DEFAULT_WNN_RC "/usr/lib/wnn7/ja_JP/wnnenvrc" +#define SCIM_CONFIG_WNN_SERVERTYPE "/IMEngine/Wnn/ServerType" +#define SCIM_DEFAULT_WNN_SERVERTYPE "Wnn4" #define SCIM_CONFIG_WNN_MINISTATUS "/IMEngine/Wnn/MiniStatus" #define SCIM_DEFAULT_WNN_MINISTATUS false diff --git a/scim-wnn/src/scim_wnn_imengine.cpp b/scim-wnn/src/scim_wnn_imengine.cpp index a90f34d..7dccfbd 100644 --- a/scim-wnn/src/scim_wnn_imengine.cpp +++ b/scim-wnn/src/scim_wnn_imengine.cpp @@ -207,6 +207,14 @@ alp = _scim_config->read(String(SCIM_CONFIG_WNN_ALP),SCIM_DEFAULT_WNN_ALP); mini_status = _scim_config->read(String(SCIM_CONFIG_WNN_MINISTATUS),SCIM_DEFAULT_WNN_MINISTATUS); yosoku = _scim_config->read(String(SCIM_CONFIG_WNN_YOSOKU),SCIM_DEFAULT_WNN_YOSOKU); + String t = _scim_config->read(String(SCIM_CONFIG_WNN_SERVERTYPE),String(SCIM_DEFAULT_WNN_SERVERTYPE)); + if (t == "Wnn6") { + sType = Wnn6; + } else if (t == "Wnn7") { + sType = Wnn7; + } else { + sType = Wnn4; + } // �ǥե���ȥ������ꡣ scim_string_to_key_list(k_conversion_start, @@ -276,7 +284,7 @@ // �����ǰ�����³���Ƥ������� - wnn.wnnConnect(String("scim-wnn"),host,rc,0); + wnn.wnnConnect(String("scim-wnn"),host,rc,sType,0); } @@ -350,7 +358,7 @@ hide_aux_string(); } - if ((!m_conversion) && yosoku && m_preeditor->getTextLength() && wnn.isConnected()) { + if ((!m_conversion) && yosoku && m_preeditor->getTextLength() && wnn.isConnected() && (sType == Wnn7)) { m_convList = wnn.getYosokuList(m_preeditor->getText()); if (m_convList.count) { m_lookup_table.clear(); @@ -477,6 +485,17 @@ */ bool WnnInstance::process_conversion_key_event(const KeyEvent &key) { + if ((key.code == SCIM_KEY_Shift_L) || + (key.code == SCIM_KEY_Shift_R) || + (key.code == SCIM_KEY_Control_L) || + (key.code == SCIM_KEY_Control_R) || + (key.code == SCIM_KEY_Alt_L) || + (key.code == SCIM_KEY_Alt_R) || + (key.code == SCIM_KEY_Super_L) || + (key.code == SCIM_KEY_Super_R) || + (key.code == SCIM_KEY_Hyper_L) || + (key.code == SCIM_KEY_Hyper_R)) return(true); + if ((alp <= alp_count) && (alp != 0)) { if (!m_lookup) startLookup(); } @@ -537,15 +556,17 @@ alp_count = 1; return(true); } else - if (k_conversion_rensou.comp(key)) { + if (k_conversion_rensou.comp(key) && (sType == Wnn7) ) { m_convList = wnn.getConversionList(wnn.getPos(),RENSOU); + if (m_convList.count == 0) return(true); startLookup(); updateConversion(); alp_count = 1; return(true); } else - if (k_conversion_ikeiji.comp(key)) { + if (k_conversion_ikeiji.comp(key) && (sType == Wnn7)) { m_convList = wnn.getConversionList(wnn.getPos(),IKEIJI); + if (m_convList.count == 0) return(true); startLookup(); updateConversion(); alp_count = 1; @@ -733,7 +754,7 @@ wnn.reset(); m_preeditor->reset(); if (wnn.isConnected()) wnn.wnnDisconnect(); - wnn.wnnConnect(String("scim-wnn"),host,rc,0); + wnn.wnnConnect(String("scim-wnn"),host,rc,sType,0); updatePreEditor(); } @@ -785,7 +806,7 @@ hide_aux_string(); if (!wnn.isConnected()) { - if (!wnn.wnnConnect(String("scim-wnn"),host,rc,0)) { + if (!wnn.wnnConnect(String("scim-wnn"),host,rc,sType,0)) { update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); show_aux_string(); return; @@ -836,6 +857,7 @@ void WnnInstance::startLookup() { createLookupTable(m_convList); + if (m_convList.count == 0) return; m_lookup = true; switch(m_convList.kType) { case IKEIJI: { diff --git a/scim-wnn/src/scim_wnn_imengine.h b/scim-wnn/src/scim_wnn_imengine.h index 4697160..6eeaa31 100644 --- a/scim-wnn/src/scim_wnn_imengine.h +++ b/scim-wnn/src/scim_wnn_imengine.h @@ -100,6 +100,7 @@ bool yosoku; String host; String rc; + JServerType sType; IConvert m_iconv; vector preeditors; protected: diff --git a/scim-wnn/src/wnnconversion.cpp b/scim-wnn/src/wnnconversion.cpp index 67dd3bb..804fc1c 100644 --- a/scim-wnn/src/wnnconversion.cpp +++ b/scim-wnn/src/wnnconversion.cpp @@ -42,6 +42,7 @@ pos = 0; bunsetu = 0; wnn = 0; + sType = Wnn4; } @@ -83,9 +84,9 @@ /*! - \fn WnnConversion::wnnConnect(String name,String host,String rc,int timeout) + \fn WnnConversion::wnnConnect(String name,String host,String rc,JServerType type,int timeout) */ -bool WnnConversion::wnnConnect(String name,String host,String rc,int timeout) +bool WnnConversion::wnnConnect(String name,String host,String rc,JServerType type,int timeout) { wnn = jl_open((char *)name.c_str(),(char *)host.c_str(),(char *)rc.c_str(),wnn_error,wnn_message,timeout); //wnn = jl_open_lang("test","localhost","jp_JP","/usr/lib/wnn7/ja_JP/wnnenvrc",wnn_error,wnn_message,10); @@ -94,6 +95,7 @@ // ͽ¬���Ϥ��������Ƥ����� jl_yosoku_init(wnn); #endif + sType = type; return(true); } @@ -341,6 +343,8 @@ convList.Yomi.clear(); convList.pos = 0; convList.count = 0; + if ((sType != Wnn7) && (kt != DEFAULT)) return(convList); + if (p == -1) p = pos; if ((p >= bunsetu) || (p < 0)) p = p % bunsetu; pos = p; @@ -379,6 +383,7 @@ // @todo jl_zenkouho should change to jl_zenkouho_dai. //convList.pos = jl_zenassoc_dai(wnn,pos,pos + 1,WNN_USE_ZENGO,WNN_UNIQ); //convList.pos = jl_zenkouho(wnn,pos,conn,WNN_UNIQ); + if (convList.pos == -1) return(convList); convList.count = jl_zenkouho_suu(wnn); for (unsigned int i = 0;i < convList.count; i ++) { @@ -454,6 +459,3 @@ return(caretPos); } - - - diff --git a/scim-wnn/src/wnnconversion.h b/scim-wnn/src/wnnconversion.h index d8743b4..3cedf6f 100644 --- a/scim-wnn/src/wnnconversion.h +++ b/scim-wnn/src/wnnconversion.h @@ -44,6 +44,7 @@ @author TAM(Teppei Tamra) */ enum KouhoType { DEFAULT, IKEIJI, RENSOU, YOSOKU }; +enum JServerType { Wnn4, Wnn6, Wnn7 }; class WnnConversionList{ public: @@ -73,7 +74,7 @@ AttributeList getAttributeList(); bool resizeRegion(int w); void updateFrequency(); - bool wnnConnect(String name,String host,String rc,int timeout); + bool wnnConnect(String name,String host,String rc,JServerType type,int timeout); void wnnDisconnect(); int getCaretPos(); @@ -88,6 +89,7 @@ struct wnn_buf *wnn; String wnn_server; String wnn_rc; + JServerType sType; int wnn_timeout; IConvert m_iconv; WideString yomiText;