[Mono-bugs] [Bug 477383] MaskedTextBox: Backspace doesn't work

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jul 20 03:10:09 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=477383

User rguo at novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=477383#c12





--- Comment #12 from Matt Guo <rguo at novell.com>  2009-07-20 01:10:07 MDT ---
Created an attachment (id=306046)
 --> (http://bugzilla.novell.com/attachment.cgi?id=306046)
code to output some log and demostrate the root cause of the bug

I can reproduce this bug easily on Felicia and Ray's notebook(both of
them are Dell D630), on both mono r137183 and mono trunk. However, on
other two Dell D630, I cannot reproduce the bug on them, really weird.

The 4 Dell D630 all installed open suse 11.1, and the versions of
"xorg-x11-server" are all 7.4-14.7.1.

And  I found the the bug is originated from the XLookupString P/Invoke in
X11Keyboard.LookupString. (this native API just don't return the same result
with same input arguments at different time)

in detail:
The MWF keyboard event processing procedure on X11:
in X11Keyboard.TranslateMessage, the source will post a WM_CHAR
message if the return value of "ToUnicode" is 1, and make the "buffer"
var be the message's wParam, and in most cases the "buffer" is
assigned in "ToUnicode" accroding to the value of "lookup_buffer", and
the "lookup_buffer" is assigned by the "XLookupString" native API,
which is called by "LookupString".

And as I watched, the problem happens when "XLookupString" didn't
assign the sound value to lookup_buffer, so that "ToUnicode" will not
return the correct value, and the "buffer" var is not correctly set in
X11Keyboard.TranslateMessage, so that the expected WM_CHAR (with
wParam equals to 8, which is the code for backspace key) message is
not generated, so that TextBoxBase.HandleBackspace will not be
invoked.

To demostrate the problem (firslty u need to find a machine which has
backspace problem on MWF), u could apply the following patch on
X11Keyboard.cs in SWF, and then compile and run a Textbox sample, and
then hit backspace in the TextBox. On a normal machine the output will
be:

Evt: 22, 16, True, False, 26716165, 2397, 127, 138777296, 0, 111149117
Non-XIC: XK_BackSpace, 1, [], 24
Evt: 22, 16, False, False, 0, 0, 0, 138777296, 0, 0
Non-XIC: XK_BackSpace, 1, ], 24
UTF.LookupString: XK_BackSpace, 0, ]
which means after XLookupString is invoked, the returned lookup_buffer
is "/b" (/b means the backspace char)

however on a problem machine, the output could be:

Evt: 22, 16, True, False, 26786491, 5327, 127, 138777296, 0, 111149117
Non-XIC: XK_BackSpace, 1, [], 24
Evt: 22, 16, False, False, 0, 0, 0, 138777296, 0, 0
Non-XIC: XK_BackSpace, 1, [], 24
UTF.LookupString: XK_BackSpace, 0, []

which means after XLookupString is invoked, the returned lookup_buffer
is "". Actually on Felicia's machine the returned lookup_buffer could
be any kind of value, e.g. I've watched once the length of the
returned lookup_buffer is 4.

-- 
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.


More information about the mono-bugs mailing list