Code review comment for lp:~nwkj86/compiz/add-background-conf-to-switcher

Revision history for this message
MC Return (mc-return) wrote :

> About 6: I'm setting background_pixel = 0, because *switcher is doing that in
> original version. Yes, unchecking EnableBackground option resets it to be
> transparent (as before my changes).

Yeah, it was only my first test version, which did not update the useBackgroundColor bool correctly - I had to fix this by manually updating this bool shortly after creation of the popup window (hint if you experience the same problem).

Here the improved version for the updateBackground function, now also using some magic to factor in transparency into background_pixel, maybe you want to use it:

void
BaseSwitchScreen::updateBackground (bool useBackgroundColor,
        unsigned short backgroundColor [])
{
    if (!popupWindow)
 return;

    unsigned long background_pixel;

    if (useBackgroundColor)
 background_pixel = (unsigned long)((((backgroundColor [3] * backgroundColor [2]) >> 24) & 0x0000ff) |
        (((backgroundColor [3] * backgroundColor [1]) >> 16) & 0x00ff00) |
        (((backgroundColor [3] * backgroundColor [0]) >> 8) & 0xff0000) |
        (((backgroundColor [3] & 0xff00) << 16)));
    else
 background_pixel = 0ul;

    XSetWindowBackground (screen->dpy (), popupWindow, background_pixel);
}

« Back to merge proposal