[maemo-developers] [maemo-developers] Re: non-gtk app integration

From: Chris Warren-Smith cwarrensmith at gmail.com
Date: Sun Jul 10 14:40:49 EEST 2005
>On Thu, 2005-07-07 at 10:24 +0930, ext Chris Warren-Smith wrote:
>> I managed to get a non-gtk app to integrate with the
>> taskswitcher. Here's a screenshot:
>> http://www.twpo.com.au/cwarrens/n770/mandelbrot.jpeg
>> Non-gtk apps just needs to use _NET_ACTIVE_WINDOW
>> and _NET_CLIENT_LIST atoms, as well as following the 
>> maemo integration instructions.
>
>Actually applications are supposed to be working without manually
>managing those bits.
>
>On any compliant desktop, the window manager manages two properties in
>the root window: _NET_CLIENT_LIST and _NET_ACTIVE_WINDOW - the first
>listing all application windows and the latter indicating the currently
>active one.  (Having the information in the root window enables all
>kinds of task switchers and window list applets nicely synchronize each
>other.)
<snip>
Hi Tommi,
Thank you for a very informative respose. My theory about _NET_ACTIVE_WINDOW
was wrong but I think I've now found the correct solution. 
The root window sends _NET_ACTIVE_WINDOW to raise the window just as you 
indicated but there's a problem in handle_active_window_prop(). It uses 
the root window ID to obtain the applications WM_CLASS attribute but only
uses this to check the "Home" window. 
I think handle_active_window_prop() should contain something like this:

....
    /* No WM_CLASS set? Need to check if it's Home... */
    if (wm_class_str == NULL)
    {
        gdk_error_trap_push();
        XGetWindowProperty(GDK_DISPLAY(), realwin_value.window_value[0],
                           wm_class_atom, 0, 24,
                           False, XA_STRING, &actual_type, &actual_format,
                           &nitems, &bytes_after, &local_wm_class);
        gdk_error_trap_pop();
        if (local_wm_class == NULL) {
            /* application error */
            return;
        }

        if (strcmp(local_wm_class, HOME_WMCLASS) == 0) {
            /* It's Home. Ask Application switcher to depress the icon */
            wm_cbs.topped_desktop_cb(wm_cbs.cb_data);
            XFree(local_wm_class);
            return;
        } else if (is_window_hildonapp(realwin_value.window_value[0])) {
            /* hildon apps send their own _NET_ACTIVE_WINDOW messages */
            XFree(local_wm_class);
            return;
        } else {
            /* make win_id point to non-hildon app window in lieu root window */
            /* note: const removed from func signature */
            win_id = realwin_value.window_value[0];
            /* top_view() assumes view-id is 0 for non-hildon apps */
            value.window_value[0] = 0;
            /* point to WM_CLASS of non-hildon app */
            wm_class_str = local_wm_class;
            /* continue processing below */
        }
    }
...

The only special thing the non-gtk/hildon app code needs to do is call
osso_initialize.
With this change I can switch to/from maemopad and maldelbrot w/out
and problems.

Regards,
Chris

More information about the maemo-developers mailing list