選擇用CapsLock切換中英文顯示問題

165 views
Skip to first unread message

m105093015 (TMU)

unread,
Jul 2, 2022, 7:09:13 PM7/2/22
to Chewing IM Development
目前使用的是 版本1.3.0-beta2
發現若將設定改為CapsLock切換中英文時
Snipaste_2022-06-27_16-18-02.jpg
狀態列上的顯示,並不會隨著中英切換時即時更改為 "中" 或 "A"
但如果設定中選擇 Shift 切換中英文,就可以變動
這點有點困擾...

陳鈺同

unread,
Jul 3, 2022, 12:28:41 AM7/3/22
to Chewing IM Development
會不會是因為 CapsLock本身就帶有功能,然後與新酷音的功能相沖突呢?
另一方面,把大寫鎖定設定成中英文的轉換,到時候打英文想要打小寫不就要一直按著shift?

m1050...@tmu.edu.tw 在 2022年7月3日 星期日清晨7:09:13 [UTC+8] 的信中寫道:

康家豪

unread,
Aug 11, 2022, 4:33:41 AM8/11/22
to Chewing IM Development
這個已經有人提 PIME 的 Issue 了,還有技術問題要克服

jack...@gmail.com 在 2022年7月3日 星期日中午12:28:41 [UTC+8] 的信中寫道:

magi...@gmail.com

unread,
Aug 12, 2022, 2:10:32 AM8/12/22
to Chewing IM Development
請用以下的 patch 改看看:

--- a/python/input_methods/chewing/chewing_ime.py
+++ b/python/input_methods/chewing/chewing_ime.py
@@ -28,6 +28,11 @@ from ctypes import windll  # for ShellExecuteW()
 
 from .chewing_config import chewingConfig
 
+import ctypes
+def CAPSLOCK_STATE():
+    hllDll = ctypes.WinDLL("User32.dll")
+    caps = hllDll.GetKeyState(VK_CAPITAL)
+    return (caps & 0x0001)
 
 # 按鍵內碼和名稱的對應
 keyNames = {
@@ -351,6 +356,11 @@ class ChewingTextService(TextService):
             return False
         # --------------   以下皆為中文模式   --------------
 
+        # 中文模式下按下 Capslock,須更新語言列
+        if cfg.enableCapsLock and keyEvent.isKeyDown(VK_CAPITAL):
+            self.updateSwitchLangIcon = True
+            self.updateLangButtons()
+
         # 中文模式下開啟 Capslock,須切換成英文
         if cfg.enableCapsLock and keyEvent.isKeyToggled(VK_CAPITAL):
             # 如果此按鍵是英文字母,中文模式下要從大寫轉小寫,需要輸入法處理
@@ -392,6 +402,11 @@ class ChewingTextService(TextService):
         else:
             chewingContext.set_easySymbolInput(0)
 
+        # 中文模式下按下 Capslock,須更新語言列
+        if cfg.enableCapsLock and keyEvent.isKeyDown(VK_CAPITAL):
+            self.updateSwitchLangIcon = True
+            self.updateLangButtons()
+
         # 若目前輸入的按鍵是可見字元 (字母、數字、標點、空白...等)
         if keyEvent.isPrintableChar():
             keyHandled = True
@@ -769,6 +784,8 @@ class ChewingTextService(TextService):
                     icon_name = "simC.ico"
                 else:
                     icon_name = "traC.ico"
+                if chewingConfig.enableCapsLock and CAPSLOCK_STATE():
+                    icon_name = "engC.ico"
             else:
                 icon_name = "eng.ico"
             icon_path = os.path.join(self.icon_dir, icon_name)

otto...@gmail.com 在 2022年8月11日 星期四下午4:33:41 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages