[comp.sys.atari.st] Three questions to the gurus

kow@gmdzi.UUCP (Oliver [DKowalski) (05/25/87)

Hello to the outside networld,

a friend of mine has a couple of questions, and I have suggested him to post
these to the net, in hope that the ATARI ST gurus will know the answer and
will post it. So, here they are:



				NoWait Evnt_Multi
				-----------------

Is there a possibility to do a nowait Evnt_Multi call ?

I am looking for a function having the same effect as evnt_multi but is not
waiting for an event.  This means, if there is no event pending the function
return with a 'noEvent'-Event.  This would be useful in an application which
is looking for a keystroke.If there is none the application does other things
(flashing cursor...). 

I made some experiments using the timer.  But two difficulties arose:

	1.   Some keystrokes got lost (especially with short timer intervals)

	2.   Also the menu handling is interupted. The effect is that menus
	     are falling down, the evnt_multi terminates and the menus are
	     still visible. So parts of the screen are not redrawn and
	     contains trash.  

Is there anybody who can help?



				Ftruncate
				---------

Is there any possibility to truncate a file, create by the Fcreate command ? 
This should mean, can I shrink the logical size of a GEMDOS-file ( without
copying it) ?



			wind_set and WF_NEWDESK
			-----------------------

Using the wind_set command and the WF_NEWDESK attribute, one can change the
default desktop by giving an object to be drawn instead of the standard
desktop. But how can I 'undo' this ?
 
This problem ocurred when I was writing a shell for a TeX environment. In this
shell there was a Pexec call to other GEM-programs (editors, viewers,...).
When calling WordPlus e.g. some bombs exploded after returning to the my
shell. WordPlus (and other programs) do change the default desktop to a local
object, which vanishes (or better, becomes undefined) when WordPlus
terminates. But the pointer to this object still remains and causes the
described difficulty. My solution was to do a wind_set call by my own
immediately after the Pexec and define an object (a grey box) which looks like
the original desktop.

This works !

But is there a better way ? What does the GEM-Desktop program do to avoid this
problem ?



				Obscure Cursor
				--------------

How can I make a 'Obscure Cursor' in GEM? 

A Obscure Cursor is a cursor, invisible as long as the mouse isn't moved. When
moving the mouse the cursor becomes visible and remains visible until a
special call hides it. Normal program execution should not be influenced.

E.g. WordPlus has this feature implemented.




That's all for the moment. Thanks in advance for the bunch of answers. Just
to mention, the callers address is :

	Udo Borkowski
	Endenicher Str. 277
	D-5300 Bonn 1
	West Germany

and my name & address

	Oliver Kowalski
	usenet : {...,seismo}!mcvax!unido!gmdzi!kow

uace0@uhnix2.UUCP (05/30/87)

In article <341@gmdzi.UUCP>, kow@gmdzi.UUCP (Oliver [DKowalski) writes:
> 
> Is there a possibility to do a nowait Evnt_Multi call ?
> 
> I made some experiments using the timer.  But two difficulties arose:
> 
> 	1.   Some keystrokes got lost (especially with short timer intervals)
> 
> 	2.   Also the menu handling is interupted. The effect is that menus
> 	     are falling down, the evnt_multi terminates and the menus are
> 	     still visible. So parts of the screen are not redrawn and
> 	     contains trash.  
> 
> Is there anybody who can help?
> 
You must make sure that the evnt_multi is inside a loop which only terminates
when the proper event occurs.  Sounds to me like you call evnt_multi once
then go on.  You should have it in a while loop like

.
.
.

while (event) {

event=evnt_multi (MU_TIMER|MU_MESAG|MU_whatever,...., lo_time, hi_time, ...);

switch (event) {

	case MU_TIMER:
	break;
	
	case MU_MESAG:
	do_message();
	break

	case ...:
.
.
.
	}
}

in any case, event will at least equal MU_TIMER.
The problems you describe about dropping characters doesn't sound related to
this, or perhaps it is if you use too long a delay, and the keyboard chip is
overrun with data.  But a time of 0 or 1 in lo_time *does* work for
sampling.

> 
> How can I make a 'Obscure Cursor' in GEM? 
> 
> A Obscure Cursor is a cursor, invisible as long as the mouse isn't moved. When
> moving the mouse the cursor becomes visible and remains visible until a
> special call hides it. Normal program execution should not be influenced.
> 
> E.g. WordPlus has this feature implemented.
> 
Again, you can use the evnt_multi call, but you need to sample the present
x and y of the mouse before calling it, as well as hiding the mouse, perhaps:

while (event) {

vq_mouse(handle, &button, &mx, &my);
if (Cconis()) /* a character is waiting from the console */
graf_mouse(M_OFF,0);   /* hide mouse; remembers level of calls, beware */

/* the five parameters 1,mx,my,1,1, are the ev_mm1flags,ev_mm1x,ev_mmy, etc
	parameters needed for detection of a mouse event, in this case
	exitting a certain rectangle  */

event = evnt_multi(MU_M1|MU_TIMER|MU_MESAG|...,...,1,mx,my,1,1,...);

switch (event) {

	case MU_M1:
		graf_mouse(M_ON,0);
	break;

	...
} /* switch */

} /* while */

Maybe this will help.

- Mike Vederman

> 
> That's all for the moment. Thanks in advance for the bunch of answers. Just
> to mention, the callers address is :
> 
> 	Udo Borkowski
> 	Endenicher Str. 277
> 	D-5300 Bonn 1
> 	West Germany
> 
> and my name & address
> 
> 	Oliver Kowalski
> 	usenet : {...,seismo}!mcvax!unido!gmdzi!kow


-- 
>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<
+  And to think, I don't get paid for this!   +
>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<