[maemo-developers] GtkWidget* handler from QWidget

From: Naikel Aparicio naikel at gmail.com
Date: Fri Jun 8 19:50:10 EEST 2012
I don’t know if you all received this email about attaching the notification 
to a child window of the application and not the main one.  Again thank you 
very much!

---cut-here---

I found a way.  In the source of the task-navigator (hd-task-navigator.c in 
hildon-desktop) says:

      /*
       * -- @nodest:      What notifications this thumbnails is destination 
for.
       *                  Taken from the _HILDON_NOTIFICATION_THREAD 
property
       *                  of the thumbnail's client or its WM_CLASS hint.

So well that’s what I did in Qt:

    #include <X11/Xlib.h>
    #include <X11/Xatom.h>

    (...)

    QString test = “thread example”;

    // Set the thread name
    Atom atom = XInternAtom(QX11Info::display(), 
"_HILDON_NOTIFICATION_THREAD", False);
    if (atom)
    {
        XChangeProperty (QX11Info::display(),
                         winId(),
                         atom,
                         XA_STRING,
                         8,
                         PropModeReplace,
                         (unsigned char *)test.toUtf8().constData(),
                         test.toUtf8().length()
                         );
    }

I verified the settings using xprop:

[sbox-FREMANTLE_X86: ~] > xprop -id 18874418 | grep THREAD
_HILDON_NOTIFICATION_THREAD(STRING) = “thread example”

... and now the notification attaches to the correct window if it has a hint 
“message-thread” as “thread example”.

Thank you so much for your help!! It was very hard to do, and I had to read 
a lot of the source code.

    Naikel

More information about the maemo-developers mailing list