Proper use of windows on a unix-pc

Tom Tkacik tkacik at rphroy.UUCP
Thu Jul 14 01:44:47 AEST 1988


When writing a program for the unixpc that requires its own 
graphics windows, two things can be done.
Either the current shell window can be resized and used by the program,
or a new window can be opened.
Which method is preferred?

>From looking at several existing programs, it appears that
they seem to open a new window.
And those that use the current window seem to always screw things up
when they finish.
However, when I have several graphics programs running at the same time,
I have several times run out of windows.
This is because for every program there is the shell window and 
the graphics window, thus each program takes two windows.
A waste of precious windows.

Is the reason that most graphics prorams use a second window because it
is just easier to clean up afterwords, or is there some other reason.
I have written several programs that open the current window, and resize it
as needed.
When the program ends, the window is then set back to the original parameters.
Of course, it is still filled with whatever graphics were used.
But this does not use up windows needlessly.

Doing this right is a little tricky, but not to difficult.
First the window parameters of the current window must be saved using
an ioctl() call.  Then all signals must be caught, so that cleanup can
be done.  When the program finishes, whether due to the program ending,
an interrupt, or to a bus error, it does any necessary action, and then
set the window parameters back to their original values using another
ioctl().

So, should I continue to have my programs use the current window, or
is there a real reason for opening (and wasting) a second window?

Tom Tkacik
   ...!edsews!rphroy!clyde!tkacik



More information about the Unix-pc.general mailing list