[Patch]scim-bridge doesn't respect the config key "/Hotkeys/FrontEnd/ValidKeyMask"

2 messages Options
Embed this post
Permalink
Peng Wu

[Patch]scim-bridge doesn't respect the config key "/Hotkeys/FrontEnd/ValidKeyMask"

Reply Threaded More More options
Print post
Permalink
Hi Ryo,
  In scim, there is a config key "/Hotkeys/FrontEnd/ValidKeyMask". One
use case of the config key is to filter out the CapsLock in KeyEvent.
  When change the key from:
  /Hotkeys/FrontEnd/ValidKeyMask = Shift+Control+Alt+CapsLock+Meta
+QuirkKanaRo
 to:
 /Hotkeys/FrontEnd/ValidKeyMask = Shift+Control+Alt+Meta+QuirkKanaRo,
 you can still switch input method with CapsLock on.
 scim-bridge misses this feature, so I borrow some code from scim, then
add it to scim-bridge.
 Url for bug report: https://bugzilla.novell.com/show_bug.cgi?id=463495
 The attachment is the patch.
Best Wishes,
  Peng Wu


Index: scim-bridge-0.4.15/agent/scim-bridge-agent.cpp
===================================================================
--- scim-bridge-0.4.15.orig/agent/scim-bridge-agent.cpp
+++ scim-bridge-0.4.15/agent/scim-bridge-agent.cpp
@@ -144,6 +144,7 @@ class ScimBridgeAgentImpl: public ScimBr
         ScimBridgeAgentSignalListener *signal_listener;
 
         ScimBridgeDisplay *display;
+        int m_valid_key_mask;
 
         retval_t initialize_scim ();
         retval_t finalize_scim ();
@@ -523,6 +524,17 @@ void ScimBridgeAgentImpl::slot_reload_co
     scim_frontend_hotkey_matcher.load_hotkeys (scim_config);
     scim_imengine_hotkey_matcher.load_hotkeys (scim_config);
 
+    KeyEvent key;
+
+    scim_string_to_key (key,
+        config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK),
+                      String ("Shift+Control+Alt+Lock")));
+
+    m_valid_key_mask = (key.mask > 0) ? key.mask : 0xFFFF;
+    m_valid_key_mask |= SCIM_KEY_ReleaseMask;
+    // Special treatment for two backslash keys on jp106 keyboard.
+    m_valid_key_mask |= SCIM_KEY_QuirkKanaRoMask;
+
     ScimBridgeAgentIMContext::set_enabled_by_default (scim_config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), ScimBridgeAgentIMContext::is_enabled_by_default ()));
     ScimBridgeAgentIMContext::set_imengine_shared (scim_config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), ScimBridgeAgentIMContext::is_imengine_shared ()));
     ScimBridgeAgentIMContext::set_on_the_spot_enabled (scim_config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), ScimBridgeAgentIMContext::is_on_the_spot_enabled ()));
@@ -680,6 +692,7 @@ bool ScimBridgeAgentImpl::filter_key_eve
     scim_bridge_pdebugln (5, "filter_key_event ()");
     
     KeyEvent new_key_event = key_event;
+    new_key_event.mask &= m_valid_key_mask;
     new_key_event.layout = scim_keyboard_layout;
 
     ScimBridgeAgentIMContext *imcontext = ScimBridgeAgentIMContext::find (imcontext_id);

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Scim-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/scim-devel
Ryo Dairiki-2

Re: [Patch]scim-bridge doesn't respect the config key "/Hotkeys/FrontEnd/ValidKeyMask"

Reply Threaded More More options
Print post
Permalink
Thank you for the patch. :)
Now this patch has been applied on the svn latest.
This patch should be included the next release.

Ryo

Peng Wu wrote:

> Hi Ryo,
>   In scim, there is a config key "/Hotkeys/FrontEnd/ValidKeyMask". One
> use case of the config key is to filter out the CapsLock in KeyEvent.
>   When change the key from:
>   /Hotkeys/FrontEnd/ValidKeyMask = Shift+Control+Alt+CapsLock+Meta
> +QuirkKanaRo
>  to:
>  /Hotkeys/FrontEnd/ValidKeyMask = Shift+Control+Alt+Meta+QuirkKanaRo,
>  you can still switch input method with CapsLock on.
>  scim-bridge misses this feature, so I borrow some code from scim, then
> add it to scim-bridge.
>  Url for bug report: https://bugzilla.novell.com/show_bug.cgi?id=463495
>  The attachment is the patch.
> Best Wishes,
>   Peng Wu
>
>  
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ------------------------------------------------------------------------
>
> _______________________________________________
> Scim-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/scim-devel


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Scim-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/scim-devel