\ mouse server action
\ the whole screen is devided into 16x16 pixel sections. When pressing one
\ of the mouse keys, the apprpriate action is taken.
\ needs get-mouse-position lib.arm.mouseactio

create hotjobs

terminals also
task: mouse-server

[ifndef] hotjobs
: serve-hotspot
	mouse-server activate  single false locals| ?mouse-action |
	begin	100 ms	?mouse-action 0=
		if	true is ?mouse-action  mouse-help .help-text
			get-mouse-position  mouse-button
			if	at-xy? (fg) (bg) get-cursor-status
				mouse-xy? at-xy  mouse-field token@ ?execute single
				slow-mouse set-cursor-status set-font-colours  at-xy
			else	fast-mouse
			then
			false is ?mouse-action
		then
	again ;

[else]
queue: mouse-queue
: serve-hotspot
	mouse-server activate  single mouse-queue init-queue
	begin	100 ms get-mouse-position  mouse-help .help-text
		mouse-button
		if	mouse-field token@ ?dup
			if >r mouse-xy? 2 r> mouse-queue queue-job then
		then
	again ;
: ?excute-hotspot-job
	mouse-queue queued-job? 0= ?exit
	temp-single at-xy? (fg) (bg) get-cursor-status
	mouse-queue get-queue-job -rot at-xy ?execute single
	set-cursor-status set-font-colours  at-xy ;
[then]                                              