How to Detect when entering a password field <p>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.</p> <p>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</p> <pre><code>typedef enum { MBKeyboardRemoteNone = 0, MBKeyboardRemoteShow, MBKeyboardRemoteHide, MBKeyboardRemoteToggle, } MBKeyboardRemoteOperation; </code></pre> <p>=============</p> <pre><code>void mb_kbd_remote_init (MBKeyboardUI *ui) { Atom_MB_IM_INVOKER_COMMAND = XInternAtom(mb_kbd_ui_x_display(ui), "_MB_IM_INVOKER_COMMAND", False); } </code></pre> <p>This Atom is then checked for in the Xevents, and then data from the xevent (<code>xevent-&gt;xclient.data.l[0]</code>) 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 <code>xevent-&gt;xclient.data.l[0]</code> to 2 (<code>MBKeyboardRemoteHide</code>) when I enter a password field.</p> <p>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: <a href="http://tronche.com/gui/x/xlib/events/" rel="nofollow">http://tronche.com/gui/x/xlib/events/</a>, 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.</p> <p>========== Update ==========</p> <p>Further testing/information: </p> <p>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: </p> <pre><code>&lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; Name: &lt;input type="text" name="firstname"&gt;&lt;br&gt; PW: &lt;input type="password" name="lastname"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>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?</p> <p>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:</p> <pre><code>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 </code></pre> <p>and for password field:</p> <pre><code>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 </code></pre> <p>Unfortunately this is the best my info gets at the moment, since my C skills are quite rusty.</p>