Virtual keyboard input is mostly magically integrated when using Qt, QML
or libmeegotouch on a Nokia N9. However, when using SDL1.2 or Xlib directly,
the virtual keyboard isn't activated, and one has to implement support for
this manually. Useful reference code can be found in the MeeGo Harmattan
sources, in particular meego-im-framework-0.81.7.harmattan1+0m8 has the
implementation of the keyboard process as well as gtk-input-context, a
handy reference for which messages are supported.
Note that you have to use the PR 1.3 Source DVD to get the latest sources for packages, the harmattan-dev mirror usually includes slightly older versions of everything that is good enough to link/build against, but not for looking at the implementation as a reference.
An example how to interact with the virtual keyboard on an N9 with an application that uses SDL1.2 is included here. Extending this to include support for generic Xlib-based windows is left as an exercise for the reader, but it's really not that difficult, since it's using X11 window IDs in the protocol, anyway (bringing up a window quickly to focus on D-Bus communcation here was just easier with SDL 1.2, neither D-Bus nor Maliit depend on SDL, obviously).
Example source code and binary: n9-sdl-vkb.tgz
See also (some additional links for reference):