[PATCH] Re: Input method context switch

Tom Hindle <[email protected]>
Newsgroups gmane.comp.gnome.mono.devel,gmane.comp.gnome.winforms
Message-ID <1258070147.8661.3.camel@byrd>
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
> [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
XIM-focus.patch (text/x-patch, 1.2 KB)
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 <[email protected]>
+	* 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 <[email protected]>
 
 	* 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;
 				}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.