A blog about random things and sometimes about my work translating and developing KDE and anything

Wednesday, December 07, 2011

Sad story of the day: Qt and XF86XK_TouchpadToggle

Today I realized Gnome has support for XF86XK_TouchpadToggle, i.e. if you press the key in your keyboard that has the touchpad with an X symbol over it, it toggles the enabled state of the touchpad.

This is very useful if you are like me and attach/detach a mouse various times during the day.

Since as far as I know this is not supported in KDE, this afternoon I decided to write a quick kded module that would listen to XF86XK_TouchpadToggle and call the corresponding XInput2 functions to toggle the state of the touchpad.

Investigating XInput2 was supposed to be the difficult part since it is out of my area of comfort, but at the end it resulted it was not that difficult and the desired effect can be achieved with no more than 10 lines of code.

After getting the correct XInput2 calls I started to build the skeleton of my kded module and when I was going to register the global KAction to listen for XF86XK_TouchpadToggle I realized Qt does not have support for this key, which means I can not use a KAction for that. Sad :-/

@Lamarque: My Qt patch is already approved, this Qt Project thing seems to be working :-)

@Kevin: We are not at Nokia's mercy, Qt Project is "an open thing" so we can just contribute code as well as anyone. It is true that i don't like the contributors agreement much, but for such a small change i can live with it.

@saLOUT: good question, i guess they don't have an anonymous mode for their review tracker, you can get an account by registering at their bug tracker (https://bugreports.qt.nokia.com) and using that information as your user/password for the review site

There used to be a setting to disable the touchpad when any USB mouse is plugged in in System Settings / Input / Touchpad, but it's not there anymore. I guess it's kcm_touchpad that offers it and not syaptiks that openSUSE uses.