http://bugzilla.novell.com/show_bug.cgi?id=557268
http://bugzilla.novell.com/show_bug.cgi?id=557268#c0 Summary: [PATCH] Allow WinForm controls to use on-the-spot XIM input methods Classification: Mono Product: Mono: Class Libraries Version: SVN Platform: Other OS/Version: Ubuntu Status: NEW Severity: Enhancement Priority: P5 - None Component: Windows.Forms AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=328711) --> (http://bugzilla.novell.com/attachment.cgi?id=328711) Sends Windows Messages of WM_XIM_* for on the spot preedit notification. User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091109 Ubuntu/9.10 (karmic) Firefox/3.5.5 Attached Patch allows WinForms controls to get preedit notifications (by overriding WndProc) when mono is run with MONO_WINFORMS_XIM_STYLE=on-the-spot mono Changelog from attach patch: 2009-11-20 Tom Hindle <[email protected]> * XplatUIStructs.cs: Added user messages WM_XIM_PREEDITSTART, WM_XIM_PREEDITDONE, WM_XIM_PREEDITDRAW, WM_XIM_PREEDITCARET * X11Keyboard.cs: Changed preedit callbacks to emit WM_XIM_* messages * X11Structs.cs: Added XIMFeedbackStruct and XIMFeedback enum. Here is some sample code which make use of this feature: /// <summary> /// Proof on concept implementation of a user defined TextBox that does on-the-spot /// input method editing. /// There is a number of know flaws - eg. doesn't end preedit when user moves cursor with mouse. /// Need to run with MONO_WINFORMS_XIM_STYLE=on-the-spot mono /// </summary> public class OnTheSpotTextBox : TextBox, XIM.IPreedit { // store text before preedit. string backup; #region IPreedit implementation public int PreeditStart (IntPtr clientData, IntPtr callData) { Console.WriteLine ("PreeditStart"); backup = Text; return 100; } public int PreeditDone (IntPtr clientData, IntPtr callData) { Clear (); AppendText (backup); return 0; } public int PreeditDraw (IntPtr clientData, IntPtr callData) { XIM.PreeditDrawInfo info = new XIM.PreeditDrawInfo (callData); Console.WriteLine ("PreeditDraw PreeditDrawInfo {0}", info); if (info.ChangeLength > 0) { Clear (); AppendText (backup); } if (info.Caret > 0) { AppendText (info.Text); } return 0; } public int PreeditCaret (IntPtr clientData, IntPtr callData) { XIM.PreeditCaretInfo info = new XIM.PreeditCaretInfo (clientData); Console.WriteLine ("PreeditCaret PreeditCaretInfo {0}", info); return 0; } protected override void WndProc (ref Message m) { switch (m.Msg) { case /*WM_USER*/0x400 + 0x1d00: // WM_XIM_PREEDITSTART // The WParam value identifies what is occurring. PreeditStart (m.WParam, m.LParam); break; case /*WM_USER*/0x400 + 0x1d01: // WM_XIM_PREEDITDONE PreeditDone (m.WParam, m.LParam); break; case /*WM_USER*/0x400 + 0x1d02: // WM_XIM_PREEDITDRAW PreeditDraw (m.WParam, m.LParam); break; case /*WM_USER*/0x400 + 0x1d03: // WM_XIM_PREEDITCARET PreeditCaret (m.WParam, m.LParam); break; } base.WndProc (ref m); } #endregion } Reproducible: Always Steps to Reproduce: 1. 2. 3. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
