[compiz] replace notify functions with functions that apply changes

David Reveman davidr at novell.com
Thu Mar 29 05:18:42 PDT 2007


I've been thinking about removing all existing notification functions in
favor of just having functions that apply changes. This is better as it
allow each plugin to execute something both before and after the change
has been applied. Example:

Instead of wrapping a windowStateChangeNotify function you would wrap a
changeWindowState function

static void
pluginChangeWindowState (CompWindow *w, int state)
{
    int oldState = w->state;

    PLUGIN_SCREEN (w->screen);

    if ((oldState ^ state) & STATE_PLUGIN_CARE_ABOUT_MASK)
    {
        /* do something interesting */
    }

    UNWRAP (ps, w->screen, changeWindowState);
    (*w->screen->changeWindowState) (w, state);
    WRAP (ps, w->screen, changeWindowState, pluginChangeWindowState);

    if ((oldState ^ state) & STATE_PLUGIN_CARE_ABOUT_MASK)
    {
        /* do something else interesting */
    }
}

This makes even more sense for move and resize notify functions and
before we add another notify function I'd like us to decide if we want
to do this or not. I'm strongly in favor of making this change.

- David



More information about the compiz mailing list