Input method context switch

View: New views
2 Messages — Rating Filter:   Alert me  

Input method context switch

by PaxErit :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi mono team,
in developing software for linguistic applications our team recently
developed a patch for the SCIM input method manager that allows us to
programmatically change the selected Input Method (IM). The key idea is
that when a user switches from a textbox that expects English input to,
say, a textbox that expects Thai, the Input Method is automatically
switched.
We do this switch in the OnEnter eventhandler. Unfortunately, it seems
that the X Input Context is switched AFTER the OnEntry event is fired.
As a result we end up switching the IM for the previous context (ie the
English textbox) rather than the new one (ie the Thai textbox). Can you
give any insight into this behavior or do have any thoughts?
Thanks,
Tim
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@...
http://lists.ximian.com/mailman/listinfo/mono-devel-list

[PATCH] Re: Input method context switch

by tom_hindle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cross posting as this belongs on the mono-winforms list.

Attaching patch for review.

Thanks
Tom

On Tue, 2009-11-03 at 16:50 +0700, Tim Armstrong wrote:

> Hi mono team,
> in developing software for linguistic applications our team recently
> developed a patch for the SCIM input method manager that allows us to
> programmatically change the selected Input Method (IM). The key idea is
> that when a user switches from a textbox that expects English input to,
> say, a textbox that expects Thai, the Input Method is automatically
> switched.
> We do this switch in the OnEnter eventhandler. Unfortunately, it seems
> that the X Input Context is switched AFTER the OnEntry event is fired.
> As a result we end up switching the IM for the previous context (ie the
> English textbox) rather than the new one (ie the Thai textbox). Can you
> give any insight into this behavior or do have any thoughts?
> Thanks,
> Tim
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@...
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

[XIM-focus.patch]

Index: class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog (revision 146079)
+++ class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2009-11-12 Tom Hindle <tom_hindle@...>
+ * XplatUIX11.cs: Move Keyboard.FocusIn method call in GetMessage
+ so XIM has focus before calling SendMessage with WM_SETFOCUS. This
+ allows changing the scim keyboards in the focus handing of winform
+ controls.
+
 2009-11-11  Carlos Alberto Cortez <calberto.cortez@...>
 
  * DataGrid.cs: Add a new internal property to get the maximum possible
Index: class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs (revision 144586)
+++ class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs (working copy)
@@ -4395,8 +4395,8 @@
  }
  goto ProcessNextMessage;
  }
+ Keyboard.FocusIn (FocusWindow);
  SendMessage(FocusWindow, Msg.WM_SETFOCUS, IntPtr.Zero, IntPtr.Zero);
- Keyboard.FocusIn (FocusWindow);
  goto ProcessNextMessage;
  }
 


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@...
http://lists.ximian.com/mailman/listinfo/mono-devel-list