Re: mouse_init_return_fd

Search this archive.

From: Dr. Michael Weller (eowmob@exp-math.uni-essen.de)
Date: Tue 09 Apr 2002 - 13:20:52 IDT


On Mon, 8 Apr 2002, Karel Kulhavy wrote:

> I have notices that mouse_init_return_fd returns __svgalib_mouse_fd if the mouse
> is already open and does no changes to mouse initialization.
> 
> Is this behaviour guaranteed? If yes, why isn't it written in man mouse_init_return_fd?
Well, you answered this question already.

> There is written that "
>        These  routines can be used to open the mouse manually, ignoring the mouse types or devices specified in the
>               config file.
> 
> 	      "
> This says nothing about what the function really does. I think there should be:"
> mouse_init_return_fd initializes mouse if it isn't already initialized. And in any case,
> returns the mouse fd."

Well, I won't go this far. I won't say it doesn't say what the function
really does. It initializes the mouse and returns the file handle.
That's what the doc says and what it does.

The doc doesn't say what happens if the mouse is already initialized, so
this behaviour is undefined. Which means in turn, you shouldn't use it. 

Now, there are different ideas of what can be done if the mouse is already
initialized. One can just return the handle, which, as you found out, is
apparently an undocumented feature or, one could close the mouse and
reinitilize it. Note that this somewhat contradicts the svgalib
philosophy. You have the mouse configured right in your config file, so
there is no need to change it's type on the fly.

In the same scheme its pretty odd the mousetype can be specified in the
config file but the application can just set something else or break
heavily if a mouse type is added after the application was compiled. Thus
there is an option to simply ignore the (somewhat historical) arguments
of mouse_init.

Admittedly, guaranteeing the current behaviour shouldn't be a problem.
I doubt anyone will object if you suggest/submit a corresponding doc
change.

Michael.

--

Michael Weller: eowmob@exp-math.uni-essen.de, eowmob@ms.exp-math.uni-essen.de,
or even mat42b@spi.power.uni-essen.de. If you encounter an eowmob account on
any machine in the net, it's very likely it's me.


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST