[comp.sys.amiga] Fixed EXPOSE

john13@garfield.UUCP (04/25/87)

[]
Here is a debugged version of expose. It now will not attempt to resize
screen-height windows that have no resize gadgets, nor will it attempt to
move them. All others (as long as they are tight to the top border) are
assumed to be safe to send move messages at least, and resize messages for
those with size gadgets.

I can't verify that the method used is 100% foolproof; however it now works
with DPaint II, and even with VT100 (I guess it must have an invisible size
gadget, or a non-standard-height screen?). Please let me know if there are
any programs that it fools up with.

Usage: expose
Purpose: re-arrange windows so you have at least 1 pixel of the top border
         free on all screens, so you can drag screens up and down, or use
         the depth arranger gadget. Saves needless "mousing". I'd like to
         be able to put this on a hotkey, but that's not exactly vital :-).

John Russell               john13@garfield.mun.cdn
5 Alderdice Place          john13@garfield.UUCP
St. John's, NF (Canada)
A1B 2P8
(709) 726-7847


-----Cut Here-----Cut Here-----Cut Here-----Cut Here-----
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	expose.c
#	expose.uue
echo shar: extracting expose.c
sed 's/^X//' << 'END_OF_FILE' > expose.c
X/*
X *  This program will attempt to let you at the screen depth arrangment
X *  gadgets. All windows that are tight to the top border will be moved
X *  down by one pixel, and resized if necessary (ie they are as high as
X *  the screen). After running it, you can also access the screen drag
X *  bars.
X *
X *  Does anyone else hate having to fiddle with the initial CLI window
X *  and the VT100 window to get at those $@$@#$@ gadgets???
X *
X *  ((c)) 1987, John Russell
X *  Unlimited distribution; donations to starving programmers always welcome.
X */
X
X/*
X *  This is the second posting of this program. The first would act flakey,
X *  since there was a missing ",0L" in the OpenLibrary call. It would work
X *  time after time in some cases, and not at all in others.
X *
X *  This release also incorporates a fix which should keep it from moving any
X *  windows which really don't want to be moved (the DPaint window is one
X *  example). I initially used a delay to see if the window responded to the
X *  sizewindow message; it seems like the sizewindow itself may introduce
X *  problems, so I no longer try to size the window if it has no size gadget.
X *  There is no delay, but the window will not be moved if it is full screen-
X *  height and cannot be resized.
X */
X
Xchar *copyright = "((c)) 1987, John Russell";
Xchar *address = "5 Alderdice Place";
Xchar *city = "St. John's, Newfoundland, Canada";
Xchar *postal_code = "A1B 2P8";
Xchar *phone = "(709) 726-7847";
X
X#include "intuition/intuition.h"
X
Xstruct IntuitionBase *IntuitionBase;
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X    struct Screen *screen;
X    struct Window *window;
X
X    if ((IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L))==NULL) {
X        exit(0);
X    }
X
X    Forbid();
X
X    screen=IntuitionBase->FirstScreen;
X
X    while (screen) {
X
X        window=screen->FirstWindow;
X
X        while(window) {
X
X            if (window->TopEdge == 0) {   /* NOT "== screen->topedge" */
X
X                if ((window->Height == screen->Height) &&
X                    (window->Flags & WINDOWSIZING)) {
X
X/* window sent resizing message only if full screen-height AND it has a
X   sizing gadget. Otherwise results with backdrop windows and those with
X   odd Viewmodes, overscan, etc are unpredictable. */
X
X                    SizeWindow(window,0,-1);
X                }
X
X                if ((window->Height != screen->Height) ||
X                    (window->Flags & WINDOWSIZING) ) {
X
X/* move a window that is
X    1) not as tall as the screen and hence can be lowered
X    2) equipped with a size gadget, which will shrink vertically when it
X       gets the first message
X*/
X
X                    MoveWindow(window,0,1); /* move down and expose gadgets */
X                }
X            }
X            window=window->NextWindow;
X        }
X        screen=screen->NextScreen;
X    }
X
X    Permit();
X
X    CloseLibrary(IntuitionBase);
X}
X
X
END_OF_FILE
echo 'Orignal Sum -> 52935     3'
echo -n 'Current Sum -> '
sum expose.c
echo shar: extracting expose.uue
sed 's/^X//' << 'END_OF_FILE' > expose.uue
Xbegin 600 expose
XM   #\P         #          (   '+    4P        /I   !RTZY   !
XM<B@H8RDI(#$Y.#<L($IO:&X@4G5S<V5L;   -2!!;&1E<F1I8V4@4&QA8V4 
XM4W0N($IO:&XG<RP@3F5W9F]U;F1L86YD+"!#86YA9&$  $$Q0B R4#@ *#<P
XM.2D@-S(V+3<X-#<  $Y5__A"ITAZ .Q.N@9<4$\I0("V2H!F"$*G3KH!,%A/
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@+Y.[O\N(&\ !"QL@+Y.[OZ,3OH  BQL@+XB;P $
XM("\ "$[N_=@L;("^3N[_=B)O  0L;("^3N[^AB!O  0L;("^3N[^@"!O  1,
XM[P #  @L;("V3N[_6"!O  1,[P #  @L;("V3N[^X    ^P    !        
XM  (        #\0    (              _(   /J    *     8    @    
XM,@   %0   !<            (" @(" @(" @,# P,# @(" @(" @(" @(" @
XM(" @(""00$! 0$! 0$! 0$! 0$! # P,# P,# P,#$! 0$! 0$ )"0D)"0D!
XM 0$! 0$! 0$! 0$! 0$! 0$! 4! 0$! 0 H*"@H*"@(" @(" @(" @(" @("
XM @(" @("0$! 0"        /L    !0              !     @    ,    
XE$         /Q     @             #\@   ^L        #\@@ 
X 
Xend
END_OF_FILE
echo 'Orignal Sum -> 23234     3'
echo -n 'Current Sum -> '
sum expose.uue
exit