Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto launching keyboard in Linux when user presses on editable UI components

Problem statement : The virtual keyboard is required in linux environment which should be launched every time when user presses on editable UI components, like virtual keyboard in iPhone, iPad, Android, etc.

Solution overview : As basis for virtual keyboard was taken matchbox-keyboard which is an open-source application and provides rich functionality. The mechanism of auto-toggling was solved by modifying the source of QT and GTK to send Dbus signals on "on_press" signal (when user presses on editable UI comp.) to some daemon which turns virtual keyboard on.

Issue : "on_press" Dbus signal is sent when user presses or clicks on UI components i.e. during "on_click" event of QT and GTK. The virtual keyboard is hidden on "focus_out" event of QT and GTK. Keyboard is not switched on during "focus_in" event because some application while launching are emitting "focus_in" event for a moment then emitting "focus_out" event, so virtual keyboard was shows for a short time then hidden which was not accurate. this was solved by generating "on_press" Dbus signal during "on_click" GTK and QT events.

So now here I have another problem.

  1. Lets say user pressed on editable box, virtual keyboard appeared, "on_click" (GTK, QT event) -> "on_press" (Dbus signal) -> virtual keyboard is launched
  2. Then user presses on Tab button to switch to other editable box. "focus_out" (GTK, QT event) -> "hide_keyboard" (Dbus signal) -> virtual keyboard is hidden and is not launched again.

This happens because the second editable box emits "focus_in" event and not "on_click" event.

So please help to find a solution for the case when user switches between editable box with tab button. Or if you have totally other solution please suggest it.

Thanks in advance, Levon

like image 688
deimus Avatar asked Jan 13 '11 07:01

deimus


2 Answers

I'm the author of Florence Virtual Keyboard: http://florence.sourceforge.net. I used at-spi (http://en.wikipedia.org/wiki/Assistive_Technology_Service_Provider_Interface) to solve the problem. The advantage of at-spi is that it works not only with GTK and Qt but also with java, Firefox and Libre/OpenOffice.

like image 121
François Agrech Avatar answered Oct 03 '22 20:10

François Agrech


On supported platforms (Embedded Linux, WinCE) Qt emits a special QEvent when software input panel should be shown;

QEvent::RequestSoftwareInputPanel   

Description is;

A widget wants to open a software input panel (SIP).
like image 23
ismail Avatar answered Oct 03 '22 20:10

ismail