[comp.sys.amiga] DMOUSE V1.00

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/10/88)

	Please report any bugs!

					-Matt


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	dmouse.doc
#	dmouse.uue
#	dmouse.c
# This archive created: Mon May  9 11:46:43 1988
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'dmouse.doc'" '(2611 characters)'
if test -f 'dmouse.doc'
then
	echo shar: "will not over-write existing file 'dmouse.doc'"
else
cat << \!Funky!Stuff! > 'dmouse.doc'

V1.00			   DMOUSE.DOC		8 May 1988

			  Matthew Dillon
			  891 Regal Rd
			  Berkeley, California 94708
			  USA

	YAIH (Yet Another Input Handler)... nahh, like DMouse better...
for "Dillon's Mouse"???   Placed in PUBLIC DOMAIN because it's such a
great example.

	After looking at and rejecting several mouse-intuition input
handler enhancers (you know, accelerate the mouse, click-to-front, etc...)
and finding them ALL useless, I have written my own.

	- Any option can be turned off.

	- Screen blanker after N1 seconds inactivity (def. 300 secs)

	- Mouse blanker after N2 seconds inactivity (def. 5 secs)

	- Auto Activate window when mouse moved over it

	- Mouse Accelerator.  Back feeds power into the mouse unit;
	  give it a nudge and it is guarenteed to penetrate up to an
	  inch and a half of wall plaster.

	- Programmable command-key and command string ala PopCli, default
	  left-Amiga ESC.

	- Left Mouse Button click in window brings it to the front
	    DOES NOT BRING THE WINDOW TO THE FRONT IF IT IS ALREADY
	    IN FRONT.  Other programs would call WindowToFront() on
	    every click, which is horrible if you have a simple-refresh
	    window.

	- Hold LMB, click Right Mouse Button .. Window to Back!  Great
	  for cycling windows.

	- Same sequence as above, but if there is no window under the
	  current mouse position, cycles through screens

	- NO DAMN CLOCK.  Use another utility to get a clock.

	- Uses a CLI (sorry).  The executable could be smaller if I wrote
	  my own startup so stdio isn't included.  BREAK the CLI to exit
	  the program.	RUNable, of course.


RUN FROM CLI, example:

    1> run dmouse
    [CLI 4]
	    OR (another example)
    1> run >nil: <nil: dmouse -C newcli "<nil: >nil: con:320/120/320/80/Shell c:shell.exe"
    [CLI 4]

TO KILL:

    1> Break 4	    (or whichever CLI it was run under)

COMMAND LINE ARGUMENTS:

    -h		HELP
    -a# 	Set acceleration to #.	Default 3,	     1 disables option
    -s# 	Set screen timeout to # (secs), Default 300, 0 disables option
    -m# 	Set mouse timeout to # (secs), Defalut 5,    0 disabled option
    -L0 	Disable LMB Window To Front and LMB/RMB Window To Back
    -A0 	Disable Auto-Activate when mouse moved over a window
    -Rqqqq	Set Qualfier (HEX) with RMB for Window To Back (default is
		 the LMB qualifier).
    -Kcccc	Set Keycode (HEX)   for command key (default 0045)
    -Qqqqq	Set Qualifier (HEX) for command key (default 8040)
		    (For keycode and qualfier, must specify 4 hex digits)
    -C CMD	Set Command to run.  Default is NEWCLI.  Remaining arguments
		on command line is the command.

!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'dmouse.uue'" '(11857 characters)'
if test -f 'dmouse.uue'
then
	echo shar: "will not over-write existing file 'dmouse.uue'"
else
cat << \!Funky!Stuff! > 'dmouse.uue'
begin 644 dmouse
M```#\P`````````#``````````(```;D````Y`````$```/I```&Y$[Z#&1N
M97=C;&D``$Y5_\Y(YP\@>`%@``($,`1(P.6`(&T`#"1P"``@2E2(+PA.N0``
M"^I83RX`#!(`+68``=P0*@`!2(!(P&```8HSQP````!@``'&(\<````"8``!
MO"/'````!F```;(3QP```!1@``&H($I4B"\(3KH)MEA/,\`````.8``!DA/'
M````%6```8@@2E2(+PA.N@F66$\SP`````I@``%R($I4B"\(3KH)@%A/,\``
M```,8``!7"!*5(@O"$ZY```1)EA/5(`\`#($2,%2@3H!2,%@'#`%2,#E@"!M
M``PO,`@`3KD``!$F6$]2@-Q`4D4P!4C`L*T`"&W:,`9(P"\`3KD``!2`6$\C
MP````!`@2E2(+P@O.0```!!.N0``$"103S`$2,!2@#H`8#H@>0```!!*$&<2
M2'H$%B\Y````$$ZY```/^E!/,`5(P.6`(&T`#"\P"``O.0```!!.N0``#_I0
M3U)%,`5(P+"M``AMO&```)Y(>@/:3KD``!`T6$](>@0%3KD``!`T6$](>@0H
M3KD``!`T6$](>@1,3KD``!`T6$](>@1^3KD``!`T6$](>@2B3KD``!`T6$](
M>``!3KD``!9"6$]@1I"\````06<`_JY5@&<`_MY1@&<`_JQ3@&<`_GQ;@&<`
M_K93@&<`_GJ0O`````]G`/Y(D+P````,9P#^4EV`9P#^0F``_V921#`$2,"P
MK0`(;0#]]$AY``$``TAX``A.N0``&?I03RM`_^(@;?_B,+S^`"!M_^(Q?/\`
M``)"ITZY```:(EA/(\````-*0J="ITZY```8:%!/(\````-2+SD```-23KD`
M`!E26$\K0/_\2'@$`TZY```+6EA/0KD```-&&WP`,__O0?H#\"M(__A"K?_T
M0J<O+?_\0J=(>@//3KD``!J`3^\`$$J`9@`"6$*M_]Y"K?_:(&W__#%\``D`
M'$'M_^8B;?_\(T@`*"\M__Q.N0``&@Q83R!Y```#4G``$"@`#W(!X:$(P0`,
M+P%.N0``&N983RM`_]8@>0```U)P`!`H``]R`>&APJW_UF<``4HO.0```U).
MN0``&EY83RM`_])G``$T(&W_TB`H``I@``#T2JW_WF<,+RW_WDZY```;0EA/
M0JW_WF```/)*K?_>9BY(>0```!9.N0``&TY83RM`_]YG&D*G0J="IT*G(&W_
MWDAH`"Q.N0``&OY/[P`48```NDJM_]IG*B!Y```#"BMH`";_SB`M_]IR$.*H
M(&W_SC%```H@;?_.,6W_W``.0JW_VF```(9*K?_:9D0@>0```PHK:``F_\X@
M;?_.<``P*``*<A#CH")M_\YT`#0I``Z`@BM`_]H@+?_B<A#BJ"!M_\XQ0``*
M(&W_SC%M_^0`#F`X0J="IR\Y````$$ZY```7YD_O``Q@(O_*_W[_2O\2_OB0
MO/____NPO`````5D"N.`,#L`Y$[[```@;?_2<``P*``2+P`O+?_23KD``!H^
M4$]@`/ZZ""T`!/_89@1@`/YT(&W__#%\``H`'$'M_^8B;?_\(T@`*"\M__Q.
MN0``&@Q83R\M__Q.N0``&$Q83R\Y```#4DZY```:7EA/*T#_UF<:(&W_UG``
M,"@`$B\`+RW_UDZY```:/E!/8-)*K?_>9PPO+?_>3KD``!M"6$]*K?_:9RH@
M>0```PHK:``F_]8@+?_:<A#BJ"!M_]8Q0``*(&W_UC%M_]P`#D*M_]HO.0``
M`U).N0``&/183R\M__Q.N0``&6A83TAX__].N0``"H183TAX``@O+?_B3KD`
M`!H^4$],WP3P3EU.=2``1$U/55-%("UA(R`M<R,@+6TC("U,,"`M4G%Q<7$@
M+4$P("U+8V-C8R`M47%Q<7$@+4,@8VUD`%8Q+C`P(%!50DQ)0R!$3TU!24XL
M($UA='1H97<@1&EL;&]N+"!-87D@,3DX.`H`06-C96QE<F%T:6]N("@S*2`@
M4V-R965N('1O("@S,#`I("!-;W5S92!T;R`H-2D`3&UB(&1I<V%B;&4L(%)M
M8B!Q=6%L:69I97(L($%C=&EV871E(&1I<V%B;&4L($ME>2!C;V1E("8@475A
M;``H9&5F875L="!%4T,]-#4L(&QE9G0M06UI9V$]-#`I+"!#;VUM86YD('1O
M(')U;@!.;W1E.B!,34(H:&]L9"DK4DU"(#T@5VEN9&]W5&]"86-K`&EN<'5T
M+F1E=FEC90!(YS#*809,WU,,3G5.50``2.<(,$ZY```,V"1M`!!@``*^<``0
M*@`$8``"G"`J``[0N0````(CP````OX@*@`.T+D````&(\````,"2CD```+\
M9PI(>/__3KH"EEA/2CD```+]9PI(>/_]3KH"A%A/0CD```+]0CD```+\#'D`
M`0````!G>#@J``IG-DI$;Q@P!$C`4X`R.0````!(P4ZY```7GE*`8!8P!$C`
M4H`R.0````!(P4ZY```7GE.`-4``"C@J``QG-DI$;Q@P!$C`4X`R.0````!(
MP4ZY```7GE*`8!8P!$C`4H`R.0````!(P4ZY```7GE.`-4``#$HY````%68*
M2CD````49P``U$ZY```:,DZZ`AHF0$HY````%&=.#&H`:0`&9D8P*@`(P'D`
M```.9SH@"V<42JL`*&<.+RL`*$ZY```;9EA/8!X@>0```PY*J``\9Q(@>0``
M`PXO*``\3KD``!M:6$]"*@`$(`MG9DJK`"AG8$HY````%&<B#&H`:``&9AI*
MJP`(9Q0@:P`(2I!G#"\K`"A.N0``&W)83THY````%6<N#&H`_P`&9B8P*@`(
MP'QP`&8<('D```,.(FL`*+/H`#1G#"\K`"A.N0``&S983TZY```:JF```/0@
M*@`.T+D````"(\````+^2CD```+\9PI(>/__3KH`[%A/0CD```+\,"H`!K!Y
M````"F8:,BH`"+)Y````#&8.2'C_^TZZ`,183T(J``1@``"B2KD````"9SY*
M.0```OQF-B`J``ZPN0```OYO*DJY```"_F82("H`#M"Y`````B/````"_F!J
M$_P``0```OQ(>/_^87183TJY````!F<^2CD```+]9C8@*@`.L+D```,";RI*
MN0```P)F$B`J``[0N0````8CP````P)@)!/\``$```+]2'C__&$N6$]@$E.`
M9P#_'%.`9P#]7%F`9P#_8B!M`!`D4"`*9@#]0"`M`!!,WPP03EU.=4Y5```O
M"DAX``%(>``43KD``!GZ4$\D0"`*9R`E;0`(``I"J@`.-7P`%``2+PHO.0``
M`U).N0``&K)03R1?3EU.=4Y5``!(YP@P)'D```,.E\LH*@`\*"H`/&!*,"H`
M1$C`XH`@1#(H`$I(P9"!+P`T*@!&2,(O`B)$2&D`X$ZY```;?D_O``PF0$J`
M9APP*@!$2,#B@"!$,B@`2DC!L(%L""!$*!!*A&:R(`M,WPP03EU.=4Y5``!(
MYPP@)&T`"'@`&A)G-NF$NCP`,&T6NCP`.6X0$`5(@$C`P+P````/B(!@%!`%
M2(!(P,"\````#]"\````"8B`4HI@QB`$3-\$,$Y=3G5.50``2.<((#@M``I!
M^0```#8D2&`F"`0``&<<(&H`!$J09Q0@:@`$+Q!.N0``&%A83R!J``1"D.),
M4(I*1&<$2I)FTDS?!!!.74YU9W)A<&AI8W,`:6YT=6ET:6]N`&5X<&%N<VEO
M;@!D:7-K9F]N=`!T<F%N<VQA=&]R`&EC;VX`;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8D$*H``0A2``(3G4@;P`$3.\"`0`((B\`$"QL
M@QA.[OY$3OH``BQL@Q@B;P`$("\`"$[N_=@L;(,83N[_=DSO`P``!"QL@QA.
M[OZ2(F\`!"QL@QA.[OZ8(F\`!"QL@QA.[OZ&3.\``P`$+&R#&$[N_LX@+P`$
M+&R#&$[N_L(@;P`$+&R#&$[N_H`@;P`$3.\`#P`(+&R##$[N_N!,[P,```0L
M;(-D3N[_H"!O``0L;(-D3N[_IB!O``0L;(-D3N[_LB!O``0L;(,03N[^/B!O
M``0L;(,03N[_OB!O``0L;(,03N[_.B!O``0L;(,03N[_"B!O``0L;(,03N[^
MSB!O``0L;(,03N[^R"!O``1,[P`#``@L;(-X3N[_?````^P````X````````
M`#````#(````[@```0P```$F```!3````6@```&$```!D````9P```&H```!
MM````<````',```"-````E0```)F```">@```HH```*V```"Z````P8```,P
M```#5@```W(```.0```$*```!&8```28```$I```!+(```30```$Y```!2(`
M``4N```%.@``!4H```:D```'+@``!T8```=J```'@@``!Z````?6```']@``
M""X```AD```(;```"8X```FT```)_@``"K````N$```+E```"ZH```O6````
M2@````$```!.````6````&(```!L````@@```(P```"B````N````10```$@
M```!.````48```%B```"7````FX```)T```"D@```O````,2```#*@```VP`
M``.D```#V```!"(```2L```$\@``!1P```;````&Q@``!M````;6```&W```
M!NX```<````'!@``!PX```<F```'/@``!V(```=Z```'C@``!Y8```>L```'
MP```!^````?L```(#```"#8```A0```(>@``"(````B&```(F```"*(```BN
M```(R```"-````C<```(Y```"/````CV```)````"0X```D6```)(@``"2H`
M``DV```)/```"48```FN```)R@``"I(```ML```,V@````````/R```#Z@``
M`+\``P```2P````%`$6`0$``````!`$!``````!`__\``?__```!#P``````
M``````````````````K0```#"@``"MD```,.```*XP```U8```KM```#6@``
M"O8```->```+`0```V(```L&```#9@``"PX```-J```+&````VX```LH```#
M<@``"S@```-V```+/P```WH```M%```#?@``"TL```."```+40```X8```M5
M```#B@```````````"`@("`@("`@(#`P,#`P("`@("`@("`@("`@("`@("`@
MD$!`0$!`0$!`0$!`0$!`0`P,#`P,#`P,#`Q`0$!`0$!`"0D)"0D)`0$!`0$!
M`0$!`0$!`0$!`0$!`0%`0$!`0$`*"@H*"@H"`@("`@("`@("`@("`@("`@("
M`D!`0$`@``````````````````$``````0`````````````````````!`0``
M``$``````````````````````0(````!````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````!0`
M`````^P````0`````0```#H```!"````2@```%(```!:````8@```&H```!R
M````>@```((```"*````D@```)H```"B````J@```+(````1`````````!``
M```V````/@```$8```!.````5@```%X```!F````;@```'8```!^````A@``
F`(X```"6````G@```*8```"N`````````_(```/K`````0```_)^
`
end
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'dmouse.c'" '(9888 characters)'
if test -f 'dmouse.c'
then
	echo shar: "will not over-write existing file 'dmouse.c'"
else
cat << \!Funky!Stuff! > 'dmouse.c'

/*
 *  DMOUSE.C
 *
 *  DMOUSE -a# -s# -m# -L0 -Rqqqq -A0 -Kcccc -Qqqqq -C cmd
 *
 *  -a#     # = acceleration, default 3.	1 to disable
 *  -s#     # = screen timeout, default 5min,	0 to disable
 *  -m#     # = pointer timeout, default 5 secs,0 to disable	(NI)
 *  -L0     Disable LeftMouseButton->WindowToFront (LMB+RMB->ToBack)
 *  -Rqqqq  Set qualifier + RMB for Window/ScreenToBack (default LMB)
 *  -A0     Disable Auto-Activate window on mouse move
 *  -Kcccc  Set key code in hex that activates cmd, def is escape
 *  -Qqqqq  Set key qualifier in hex for keycode, def is left-amiga
 *  -C cmd  Set command (must be last option on command line), def NewCli
 *
 *	Note:	Qualifiers usually must be or'd with x8000
 *
 *  To remove, BREAK the CLI it ran under.
 *
 *  TODO:   mouse timeout
 *	    multiple screens
 *	    everything else
 */

#asm
	    FAR DATA
	    FAR CODE
#endasm

#include <xmisc.h>

#define REQ_SCREENON	-1
#define REQ_SCREENOFF	-2
#define REQ_MOUSEON	-3
#define REQ_MOUSEOFF	-4
#define REQ_DOCMD	-5

#define SBF_C	SIGBREAKF_CTRL_C
#define SBF_D	SIGBREAKF_CTRL_D
#define SBF_E	SIGBREAKF_CTRL_E
#define SBF_F	SIGBREAKF_CTRL_F

typedef unsigned short	    uword;
typedef unsigned long	    ulong;

typedef struct copinit	    COPINIT;
typedef struct Message	    MSG;
typedef struct Custom	    CUST;
typedef struct Preferences  PREFS;
typedef struct InputEvent   IE;
typedef struct MsgPort	    PORT;
typedef struct IOStdReq     IOR;
typedef struct Interrupt    INT;
typedef struct Screen	    SCR;
typedef struct Window	    WIN;
typedef struct Layer	    LAYER;
typedef struct NewScreen    NS;
typedef struct Task	    TASK;
typedef void		    (*FPTR)();

extern IOR *CreateStdIO();
extern SCR *OpenScreen();
extern void *AllocMem();
extern void *malloc();
extern void *GetMsg();
extern PORT *CreatePort();
extern TASK *FindTask();
extern LAYER *WhichMouseLayer();
extern LAYER *WhichLayer();
extern struct IntuitionBase *IntuitionBase;
extern struct GfxBase	    *GfxBase;

#define IBASE IntuitionBase

int	Enable_Abort;	    /*	CLI break enable	*/

short	Acc = 3;	    /*	Accelleration		*/
long	STo = 5*60;	    /*	screen timeout		*/
long	MTo = 5;	    /*	pointer timeout 	*/
uword	Code = 0x45;	    /*	CLI command activation	*/
uword	Qual = 0x8040;	    /*	LAmiga-ESC		*/
uword	RQual= 0x4000;	    /*	LMB (with RMB)          */
char	*Cmd = "newcli";
char	LMBEnable = 1;	    /*	enable left mouse but.	*/
char	AAEnable  = 1;	    /*	enable auto activate	*/

TASK	*Task;
WIN	*LastWin;
PORT	*Port;

NS	Ns = {	0, 0, 64, -1, 1, -1, -1, 0, CUSTOMSCREEN|SCREENQUIET };

IE *handler();

main(ac, av)
char *av[];
{
    IOR  *ior;
    INT addhand;
    uword *NoSprData;

    {
	register short i, j, len;
	register long val;
	register char *ptr;

	for (i = 1; i < ac; ++i) {
	    ptr = av[i];
	    val = atoi(ptr+2);
	    if (*ptr == '-') {
		switch(ptr[1]) {
		case 'a':
		    Acc = val;
		    break;
		case 's':
		    STo = val;
		    break;
		case 'm':
		    MTo = val;
		    break;
		case 'L':
		    LMBEnable = val;
		    break;
		case 'R':
		    RQual = ahtoi(ptr+2);
		    break;
		case 'A':
		    AAEnable = val;
		    break;
		case 'K':
		    Code = ahtoi(ptr+2);
		    break;
		case 'Q':
		    Qual = ahtoi(ptr+2);
		    break;
		case 'C':
		    for (len = strlen(ptr+2) + 2, j = i + 1; j < ac; ++j)
			len += strlen(av[j]) + 1;
		    Cmd = malloc(len);
		    strcpy(Cmd, ptr + 2);
		    for (j = i + 1; j < ac; ++j) {
			if (Cmd[0])
			    strcat(Cmd, " ");
			strcat(Cmd, av[j]);
		    }
		    break;
		default:
		    puts("DMOUSE -a# -s# -m# -L0 -Rqqqq -A0 -Kcccc -Qqqqq -C cmd");
		    puts("V1.00 PUBLIC DOMAIN, Matthew Dillon, May 1988\n");
		    puts("Acceleration (3)  Screen to (300)  Mouse to (5)");
		    puts("Lmb disable, Rmb qualifier, Activate disable, Key code & Qual");
		    puts("(default ESC=45, left-Amiga=40), Command to run");
		    puts("Note: LMB(hold)+RMB = WindowToBack");
		    exit(1);
		}
	    }
	}
    }

    NoSprData = AllocMem(8, MEMF_PUBLIC|MEMF_CHIP|MEMF_CLEAR);
    NoSprData[0] = 0xFE00;
    NoSprData[1] = 0xFF00;

    Task = FindTask(NULL);
    Port = CreatePort(NULL, 0);
    ior = CreateStdIO(Port);
    openlibs(INTUITION_LIB|GRAPHICS_LIB|LAYERS_LIB);
    Enable_Abort = 0;
    addhand.is_Node.ln_Pri = 51;
    addhand.is_Code = (FPTR)handler;
    addhand.is_Data = NULL;

    if (!OpenDevice("input.device", 0, ior, 0)) {
	SCR *scr = NULL;
	uword *SprSavePtr = NULL;


	ior->io_Command = IND_ADDHANDLER;
	ior->io_Data = (APTR)&addhand;
	DoIO(ior);
	for (;;) {
	    register long sigs = Wait(SBF_C|(1<<Port->mp_SigBit));
	    if (sigs & (1 << Port->mp_SigBit)) {
		MSG *msg;
		while (msg = GetMsg(Port)) {
		    switch((long)msg->mn_Node.ln_Name) {
		    case REQ_SCREENON:
			if (scr)
			    CloseScreen(scr);
			scr = NULL;
			break;
		    case REQ_SCREENOFF:
			if (!scr && (scr = OpenScreen(&Ns)))
			    SetRGB4(&scr->ViewPort, 0, 0, 0, 0);
			break;
		    case REQ_MOUSEON:
			if (SprSavePtr) {
			    register COPINIT *ci = GfxBase->copinit;
			    /*
			    printf("mon %08lx %08lx\n", GfxBase, ci);
			    */
			    ci->sprstrtup[1] = (ulong)SprSavePtr >> 16;
			    ci->sprstrtup[3] = (uword)(long)SprSavePtr;
			    SprSavePtr = NULL;
			}
			break;
		    case REQ_MOUSEOFF:
			if (!SprSavePtr) {
			    register COPINIT *ci = GfxBase->copinit;
			    /*
			    printf("moff %08lx %08lx\n", GfxBase, ci);
			    printf("cl: %04lx %04lx %04lx %04lx %04lx %04lx %04lx %04lx %04lx\n",
				ci->sprstrtup[0],
				ci->sprstrtup[1],
				ci->sprstrtup[2],
				ci->sprstrtup[3],
				ci->sprstrtup[4],
				ci->sprstrtup[5],
				ci->sprstrtup[6],
				ci->sprstrtup[7]
			    );
			    */
			    SprSavePtr = (uword *)((ci->sprstrtup[1] << 16) | ci->sprstrtup[3]);
			    ci->sprstrtup[1] = (ulong)NoSprData >> 16;
			    ci->sprstrtup[3] = (uword)(long)NoSprData;
			}
			break;
		    case REQ_DOCMD:
			Execute(Cmd, NULL, NULL);
			break;
		    }
		    FreeMem(msg, msg->mn_Length);
		}
	    }
	    if (sigs & SBF_C)
		break;
	}
	ior->io_Command = IND_REMHANDLER;
	ior->io_Data = (APTR)&addhand;
	DoIO(ior);
	CloseDevice(ior);
	{
	    MSG *msg;
	    while (msg = GetMsg(Port))
		FreeMem(msg, msg->mn_Length);
	}
	if (scr)
	    CloseScreen(scr);
	if (SprSavePtr) {
	    register COPINIT *ci = GfxBase->copinit;
	    ci->sprstrtup[1] = (ulong)SprSavePtr >> 16;
	    ci->sprstrtup[3] = (uword)(long)SprSavePtr;
	    SprSavePtr = NULL;
	}
    }
    DeletePort(Port);
    DeleteStdIO(ior);
    closelibs(-1);
    FreeMem(NoSprData, 8);
}


#asm
	    ;	A0 = pointer to event linked list
	    ;	A1 = pointer to my data segment
	    ;	return new event linked list in D0

	    public  _CHandler

_handler:
	    movem.l D2/D3/A0/A1/A4/A6,-(sp)
	    jsr     _CHandler
	    movem.l (sp)+,D2/D3/A0/A1/A4/A6
	    rts

#endasm

/*
 *  (1) Accellerate mouse movements.
 *  (2) Auto-Select window
 */

IE *
CHandler(scr0, scr1, Ev)
IE *Ev;
{
    register IE *ev;
    static char STimedout;
    static char MTimedout;
    static long STime, MTime;

    geta4();
    for (ev = Ev; ev; ev = Ev->ie_NextEvent) {
	switch(ev->ie_Class) {
	case IECLASS_RAWMOUSE:
	    STime = ev->ie_TimeStamp.tv_secs + STo;
	    MTime = ev->ie_TimeStamp.tv_secs + MTo;
	    if (STimedout)
		sendrequest(REQ_SCREENON);
	    if (MTimedout)
		sendrequest(REQ_MOUSEON);
	    STimedout = MTimedout = 0;
	    {
		register short n;

		if (Acc != 1) {
		    if (n = ev->ie_X)
			ev->ie_X = (n>0)? (n-1)*Acc+1 : (n+1)*Acc-1;
		    if (n = ev->ie_Y)
			ev->ie_Y = (n>0)? (n-1)*Acc+1 : (n+1)*Acc-1;
		}
	    }
	    if (AAEnable || LMBEnable) {
		register LAYER *layer;

		Forbid();
		layer = WhichMouseLayer();
		if (LMBEnable && ev->ie_Code == IECODE_RBUTTON && (ev->ie_Qualifier & RQual)) {
		    if (layer && layer->Window)
			WindowToBack(layer->Window);
		    else if (IBASE->FirstScreen)
			ScreenToBack(IBASE->FirstScreen);
		    ev->ie_Class = IECLASS_NULL;    /*	remove event	*/
		}
		if (layer && layer->Window) {
		    if (LMBEnable && ev->ie_Code == IECODE_LBUTTON && layer->ClipRect && layer->ClipRect->Next)
			WindowToFront(layer->Window);
		    if (AAEnable && ev->ie_Code == IECODE_NOBUTTON && !(ev->ie_Qualifier & 0x7000) && layer->Window != IBASE->ActiveWindow)
			ActivateWindow(layer->Window);
		}
		Permit();
	    }
	    break;
	case IECLASS_RAWKEY:
	    STime = ev->ie_TimeStamp.tv_secs + STo;
	    if (STimedout)
		sendrequest(REQ_SCREENON);
	    STimedout = 0;
	    if (ev->ie_Code == Code && ev->ie_Qualifier == Qual) {
		sendrequest(REQ_DOCMD);
		ev->ie_Class = IECLASS_NULL;	/*  remove event    */
	    }
	    break;
	case IECLASS_TIMER:
	    if (STo && !STimedout && (long)ev->ie_TimeStamp.tv_secs > STime) {
		if (STime == 0) {
		    STime = ev->ie_TimeStamp.tv_secs + STo;
		    break;
		}
		STimedout = 1;
		sendrequest(REQ_SCREENOFF);
	    }
	    if (MTo && !MTimedout && (long)ev->ie_TimeStamp.tv_secs > MTime) {
		if (MTime == 0) {
		    MTime = ev->ie_TimeStamp.tv_secs + MTo;
		    break;
		}
		MTimedout = 1;
		sendrequest(REQ_MOUSEOFF);
	    }
	    break;
	}
    }
    return(Ev);
}


sendrequest(req)
long req;
{
    register MSG *msg = AllocMem(sizeof(MSG), MEMF_PUBLIC);

    if (msg) {
	msg->mn_Node.ln_Name = (char *)req;
	msg->mn_ReplyPort = NULL;
	msg->mn_Length = sizeof(MSG);
	PutMsg(Port, msg);
    }
}

LAYER *
WhichMouseLayer()
{
    register struct IntuitionBase *ib = IBASE;
    register LAYER *layer = NULL;
    register SCR *scr = ib->FirstScreen;

    for (scr = ib->FirstScreen; scr; scr = scr->NextScreen) {
	if (layer = WhichLayer(&scr->LayerInfo, ib->MouseX, (ib->MouseY>>1)-scr->ViewPort.DyOffset))
	    break;
	if (ib->MouseY>>1 >= scr->ViewPort.DyOffset)
	    break;
    }
    return(layer);
}

ahtoi(str)
register char *str;
{
    register long val = 0;
    register char c;
    while (c = *str) {
	val <<= 4;
	if (c >= '0' && c <= '9')
	    val |= (c & 15);
	else
	    val |= (c & 15) + 9;
	++str;
    }
    return(val);
}

!Funky!Stuff!
fi  # end of overwriting check
exit 0
#	End of shell archive

ejkst@cisunx.UUCP (Eric J. Kennedy) (05/11/88)

In article <8805091849.AA11920@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>
>	Please report any bugs!
>
>					-Matt

Ok.  

  1)  If the mouse has been blanked, and a new screen opens, or the front
      screen is closed, the mouse reappears and does not blank again
      (until 5 seconds after you move it again, of course.)

  2)  Sometimes when the mouse is blanked, some extraneous garbage
      appears on the screen.  When it happens, the garbage is the same
      garbage in the same place every time, but it is different (and usually
      absent) in different invocations of dmouse.  I suspect it has
      something to do with morerows, since I am morerowed to the max 232 lines
      that my monitor can display, and the garbage is always near the
      very bottom of the screen.  The junk did not display on a 200 line
      screen.

  3)  Not a bug, but just a strong preference:  The window under the
      mouse pointer is only activated on mouse movements.  It would be handier
      if the window were activated on any keyboard input as well.  Okay, I'm
      used to heliosmouse and that's how that works.  But heliosmouse + wKeys
      is great because you can change windows and screens without reaching 
      for the mouse, and the window under the mouse always comes up active.

  4)  When I used
        dmouse -a500
      my mouse pointer stayed on the borders all the time!  What gives? :-)



Heh, heh, now there's room for a mouse even on _my_ desk.  After all,
with dmouse running, all you need is 3 square inches...

And finally...the only good feature of TextCraft (mouse blanking) put
into a _real_ program!  (I've been trying to figure out a way to do that
for quite awhile.)


-- 
------------
Eric Kennedy
ejkst@cisunx.UUCP

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/11/88)

:  1)  If the mouse has been blanked, and a new screen opens, or the front
:      screen is closed, the mouse reappears and does not blank again
:      (until 5 seconds after you move it again, of course.)

	I think I can safely ignore that one.  It's because the mouse
	will reappear when intuition calls ChangeSprite()... which can
	occur for reasons other than mouse movement.  But, since the
	screen blanker comes on after 5 min, this will not cause a
	problem (I'll just stick in another mouse-blank routine when the
	screen blanks). 

>  2)  Sometimes when the mouse is blanked, some extraneous garbage
>      appears on the screen.  When it happens, the garbage is the same
>      garbage in the same place every time, but it is different (and usually
>      absent) in different invocations of dmouse.  I suspect it has
>      something to do with morerows, since I am morerowed to the max 232 lines
>      that my monitor can display, and the garbage is always near the
>      very bottom of the screen.  The junk did not display on a 200 line
>      screen.
>

	I'll see what I can do.

>  3)  Not a bug, but just a strong preference:  The window under the
>      mouse pointer is only activated on mouse movements.  It would be handier
>      if the window were activated on any keyboard input as well.  Okay, I'm
>      used to heliosmouse and that's how that works.  But heliosmouse + wKeys
>      is great because you can change windows and screens without reaching 
>      for the mouse, and the window under the mouse always comes up active.

	Good point.  I'll put in a check when you type as well.

>  4)  When I used
>        dmouse -a500
>      my mouse pointer stayed on the borders all the time!  What gives? :-)

	You deserve it!  500?  Woooa.

>Heh, heh, now there's room for a mouse even on _my_ desk.  After all,
>with dmouse running, all you need is 3 square inches...
>
>And finally...the only good feature of TextCraft (mouse blanking) put
>into a _real_ program!  (I've been trying to figure out a way to do that
>for quite awhile.)

	Get ready for the next installment (due to many people's input)
Major fix:  You will be able to endcli from your workbench startup script!

				-Matt