I am currently trying to debug an issue I've been experiencing with the program 'matchbox-keyboard'(http://matchbox-project.org/), and I'm hoping for some assistance. matchbox-keyboard is an on-screen keyboard that I am currently using in a touchscreen kiosk to allow users to enter some basic input for doing searches etc. It may be a little old, but nonetheless it is ideal for my application because it is an 'on-demand' keyboard (i.e. it only appears when needed), lightweight, and works well with matchbox-window-manager, which I am using on the device. However, one of the sites the kiosk must visit requires the user to log in temporarily, and for some reason the on-screen keyboard disappears whenever the user clicks in the password field.
The site that the users must visit cannot be changed, so I resolved myself to try and patch matchbox-keyboard to change this behavior. To that end, I have traced the issue back to a custom Atom defined in the code, as follows
typedef enum {
MBKeyboardRemoteNone = 0,
MBKeyboardRemoteShow,
MBKeyboardRemoteHide,
MBKeyboardRemoteToggle,
} MBKeyboardRemoteOperation;
=============
void
mb_kbd_remote_init (MBKeyboardUI *ui)
{
Atom_MB_IM_INVOKER_COMMAND = XInternAtom(mb_kbd_ui_x_display(ui),
"_MB_IM_INVOKER_COMMAND", False);
}
This Atom is then checked for in the Xevents, and then data from the xevent (xevent->xclient.data.l[0]
) is used to determine what state to put the keyboard in. The thing I can't figure out is how does the X display know when the Xevent is supposed to be a '_MB_IM_INVOKER_COMMAND' type, and how it actually sets the data value. Specifically, how/why it sets the value of xevent->xclient.data.l[0]
to 2 (MBKeyboardRemoteHide
) when I enter a password field.
I have tried scouring the code for references to the critical objects mentioned here, as well as reading up on Xlib Events from the guide here: http://tronche.com/gui/x/xlib/events/, and searching for answers on google, but honestly this is just a bit over my head, and I can't get a grip on the issue. At this point it has passed from a necessity for my kiosk project and become more of a curiosity on my part(and something that will drive me nuts until I figure it out), so if anybody could help me get some answers, I would be most appreciative.
========== Update ==========
Further testing/information:
the issue does not appear to be browser implementation specific, as I tried my desired website,as well as a basic test HTML page that has only a text and password field, on a gecko browser(Firefox), as well as a webkit browser(Midori), and in both browsers, on both pages, the behavior was the same. Here's the test HTML page for reference:
<head>
</head>
<body>
<form>
Name: <input type="text" name="firstname"><br>
PW: <input type="password" name="lastname">
</form>
</body>
</html>
It appears to me that the password field, is intentionally rejecting focus for some reason, whereby clicking the field directly causes the gtk-im method focus-out to be called. My suspicion is that it's probably a part of the GTK implementation, possibly related to the act that password fields are typically 'hidden'. Perhaps this is done to prevent the on-demand clipboard from storing passwords or something to that effect?
When examining the event list/debug output from clicking on the password field and on the text field, the list of received events for each field type is very similar. Many of the events are the same type, but there are a few differences between them that I am still trying to decode. I know the event numbers are mostly meaningless in this context, but for illustration, here's the different event lists for non-password field:
matchbox-keyboard-remote.c:47,mb_kbd_remote_process_xevents() got a message of type _MB_IM_INVOKER_COMMAND, val 1
matchbox-keyboard-ui.c:560,mb_kbd_ui_redraw() mark
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 37748776
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35651628
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35651629
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35682433
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
and for password field:
matchbox-keyboard-remote.c:47,mb_kbd_remote_process_xevents() got a message of type _MB_IM_INVOKER_COMMAND, val 2
matchbox-keyboard-ui.c:1230,mb_kbd_ui_event_loop() Hide timed out, calling mb_kbd_ui_hide
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 69206018
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35651628
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35682433
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35665943
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 39845918
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35651628
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35651629
matchbox-keyboard-remote.c:38,mb_kbd_remote_process_xevents() got a message, type 35682433
Unfortunately this is the best my info gets at the moment, since my C skills are quite rusty.
Right-click the password field and click Inspect Element. A gray bar will appear with the password field highlighted. Press Alt+M or click on the icon shown below to open the Markup Panel. It will show you the code for the password field.
The <input type="password"> defines a password field (characters are masked). Note: Any forms involving sensitive information like passwords should be served over HTTPS.
<input type="password"> <input> elements of type password provide a way for the user to securely enter a password.
As another security precaution, a password field stores its value as an array of characters, rather than as a string. Like an ordinary text field, a password field fires an action event when the user indicates that text entry is complete, for example by pressing the Enter button.
matchbox-keyboard installs a GTK input method (see the gtk-im directory). This is responsible for sending the message to the keyboard.
It currently sends this MBKeyboardRemoteHide
command when the input method is told that the focus is removed (see gtk-im/im-context.c).
In terms of XEvent
handling this is just a ClientMessage
which allows clients to communicate amongst themselves using their own "protocol".
What I can't explain is why when you click into the password field you don't get the focus_in vfunc called. This could be part of the browser implementation or a GtkIMContext
issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With