Inhibiting Sun Window Color Change

Charles Noren noren at dinl.uucp
Fri Apr 14 02:28:33 AEST 1989


(I realize this should be posted under comp.sys.sun, but I am having
trouble sending this to the moderated Sun group).

I am running a DataViews (VI Corp) application and need to perform a screen
dump to a laser printer.  I have a function that almosts works, however, it
has the undesired side effect of changing the background color of the
screen from black to white.  It happens when I call win_grabio.  I'm
not much of Sun View expert (ignorant is the word).  Is there anything
I can do to prevent the background color change?

Thanks,
Chuck

Damaged code fragment follows:
----------------cut here------------------------
#include <stdio.h>
#include <fcntl.h>
#include <sunwindow/window_hs.h>

int screen_dump()
{
    int     sunview_status;
    char    parent_name[WIN_NAMESIZE];
    int     root_window_fd;
    Cursor  old_cursor;
    Cursor  null_cursor;

    sunview_status = we_getparentwindow(parent_name);

    if(sunview_status == 0)
    {
        root_window_fd = open(parent_name, O_RDWR, 0);
        if(root_window_fd >= 0)
        {
            old_cursor = cursor_create(0);
            win_getcursor(root_window_fd, old_cursor);
            null_cursor = cursor_create(0);
            win_setcursor(root_window_fd, null_cursor);

            /*
             * Executing win_grabio, the background color
             * of the window turns from black to white.
             */
            win_grabio(root_window_fd);
        }
        else
        {
            sunview_status = -1;
        }
    }

    system("screendump | rasfilter8to1 | lpr -Plw -v");

    if(sunview_status == 0)
    {
        win_releaseio(root_window_fd);
        win_setcursor(root_window_fd, old_cursor);
        close(root_window_fd);
    }

    return(0);
}
----------------cut here------------------------

-- 
Chuck Noren
NET:     ncar!dinl!noren
US-MAIL: Martin Marietta I&CS, MS XL8058, P.O. Box 1260,
         Denver, CO 80201-1260
Phone:   (303) 971-7930



More information about the Comp.unix.questions mailing list