JUN
29
2008

Context menus with just a touchscreen

An issue I encountered while running plasma on my Neo1973 is the lack of a right mouse button (the screen can't really distinguish between ends of the stylus/which finger I use). A situation where this lack of an RMB is most clear is when you want to use some functionality that is only available in a context-menu. I've implemented one way this is sometimes handled on other devices: if you hold your 'left' button for more than a certain delay (without moving more than a certain distance), the widget will receive a context menu event instead of the original left mouse button down and up events. I've implemented this by installing an event filter on the application object that intercepts all mouse events and when it detects a left mouse press, this event is saved and not immediately passed to the program. Instead a timer is started. If the left mouse button is released or the mouse is moved far enough before the timer fires, the original event will be send, so the application will just think a normal click or drag happened, however if the timer fires before the button is released or the mouse is moved, both the press and release events will be eaten by the event filter and instead a QContextMenuEvent is sent.

Currently I've written this code inside the plasma application, but once I've moved it to be part of KApplication all KDE applications should be a lot more usable with just a left mouse button. When I do this I probably should also make the delay and distance parameters configurable.

(If you're wondering why my previous plasma screenshots didn't have a background image but these screenshots do, it is because I hadn't installed the 'qt4-plugin-imageformat-jpeg' package and thus jpeg loading didn't work; one of the disadvantages of a system where qt4 is split in 163 different packages, it is a lot of work to ensure everything I need on my phone is also actually installed)

(for anyone interested in the actual code (which is currently very ugly) I'm working on this code in a branch of kdelibs/kdebase at branches/work/soc-plasma-sff)

Comments

With the availability of KDE on Mac machines - which have no RMB either - I thought the issue was already solved, although I have no idea how that was done. Have you checked that?


By liquidat at Mon, 06/30/2008 - 11:55

On Mac (even with native mac applications) you ctrl+left click is interpreted as a right click. However the big difference between KDE on Mac machines and KDE on touchscreen only devices, is that (at least the device I'm currently working with) does not have a keyboard, so the some-key+click combination won't work.


By mkruisselbrink at Mon, 06/30/2008 - 12:17

Awesome. How fast...err, how slow is KDE4 on neo1973? I own one and interested to try out, are there any binaries out there?

-- keep in touch. berkus.


By Stanislav Karchebny at Mon, 06/30/2008 - 20:00