a virtual keyboard plasmoid for touchscreens

Marco Martin notmart at gmail.com
Mon Mar 23 09:52:19 CET 2009


On Monday 23 March 2009, Björn Ruberg wrote:
> Hello plasmafolks,
>
> this mail is about my idea (and implementation) of an virtual keyboard for
> plasma. It is splitted in three sections, so you can skip what you do not
> want to read.
>
> 1. Why I'm interested in a virtual keyboard for plasma and where my ideas
> come from
> 2. Why having such a virtual keyboard is important for kde
> 3. Some technical questions. I need your help
>
> -------------------
> Part 1:
> Some weeks ago I owned a Gigabyte M704. That's an 7-inch touchscreen 
UMPC
> with a VIA C7 1,2 GHz CPU and 768 MiB of RAM. (I do not have it anymore,
little mobile interenet devices are so cool now, so no explanation needed :p
> ------------
> Part 2:
>
> So, why should you care about my story?
> If KDE does not work well with touchscreens, users may be forced to stick
> with gnome. Or more worth, even with Windows.
> Luckily the missing virtual keyboard is the only critical problem KDE has
> with touchscreens, as far as I can tell. Support of certain mousegestures
> (i.e. for grabbing) is another one, but that's only a nice to have, no
> must.
indeed
>
> --------------
> Part 3:
>
> I have some question though:
>
> - Where to get the key layouts from?
>   Of course it's not optimal to have key layouts hard coded in the code.
> Although it may even do the job, what other ways are there?
>   The other problem are the keymaps. What key does produce which symbol?
> Currently I hardcoded that too. It may even be a good solution, if I can
> get XKeycodeToKeysym() to work. This Xlib function should recognize the
> xkb-layout and the pressed key modifiers for me, so I don't have to worry
> about it. Does anybody can help me using that function? It's not too well
> documented and I cannot find sourcecode.
>
> - X-Dependency
>   Currently I use the function XTestFakeKeyEvent to produce key events that
> should work with everything you  can have on your desktop. This means that
> plasmaboard needs X to work correctly. Is there any alternative for faking
> key events?
>   Is X-dependency a problem at all? Windows users do indeed have
> alternatives for a virtual keyboard.

just add #ifdef Q_WS_X11 before the x calls, so will compile also on non x11 
platforms, for now it won't do anything here, but it could be added easily a 
windows/mac equivalent function here


> - plasma crashes when typing fast
>   When typing a lot and call XTestFakeKeyEvent often, plasma crashs with a
> "X server busy" message. You can probably easy reproduce that by typing
> some sentences with plasmaboard. That's a bug that needs to be solved. Can
> a plasma dev debug it? It may be okay to loose a key when typing, but
> crashing plasma is bad.
uuuugly :/ yeah, joys of use x
if there is not a saner way the key events should perhaps be put in a queue 
and have a timer thet empties that quque and sends events at a fixed speed?
>
> - How to find out the display?
>   I currently use KWin::display() to get the acutal display. I need it for
> XTestFakeKeyEvent . It works for me but probably it is totally wrong. Where
> to get the display from correctly?
QX11Info::display()?
> - Plasma::PushButtons
>   I currently use Plasma::PushButton for my Buttons. I tested svg and
> iconwidget, too, but they didn't work for me. I have currently two problems
> with it: Fist I need a way to put a button in a pressed state (for example
> Control should stay pressed until another key is pressed). I didn't find
> one. Can you help?
nativeWidget->setCheckable() and then toggle() and isToggled() to test
right now you won't have visual  feedback because pushbutton don't manage this 
case, but i'll correct that, in the meantime it will work anyways
>   Second I want a better formed Return-Button. My current overlapping
> solution is not beautiful. Any ideas how I can create a button that is not
> formed as an rectangle?
would requirecustom graphics, and thus an hell to theme, i would stick with a 
rectabgle, really
>
> - Problems with Extender
>   I recently implemented the keyboard as an Extender. Since that I can
> resize the keyboard only horizontally any more. Not vertically. When put on
> the desktop, the keyboard is not resizeable at all. What do I wrong?
>   Moreover, when I drag the keyboard on the desktop and click on the icon
> in the panel again, I only get a small empty window, but no new keyboard.
> How to do it right?
eeh, i see it with other things too like the calendar.
not sure if an extender is adapt since the point of that applet is to have the 
keyboard and nothing else, hmm
>
>   I noticed the extender to be quite buggy. Moving around my keyboard (but
> it happens with the battery extender as well) is likely to crash plasma. I
> exspecially have a problem when I try to resize the keyboard to full screen
> width. Try it, suddenly around 30 pixels at the left are clipped away.

yeah, extenders needs a bit of love in that front...

Cheers,
Marco Martin

>
> Well, this was a long mail. I appreciate suggestions, tipps, answers and of
> course help in coding. Perhaps somebody can tell me what to do for making
> plasmaboard ready to get into a plasma-package like plasma-addons?
>
> Greetings,
>
> Björn
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel




More information about the Plasma-devel mailing list