Lionel Lecoq wrote:
> 
> X and most (all) GUI for that matter don't use vectors: your screen is a matrix of 
>pixel and X
> uses the address of the position of the cursor (I believe the 0,0 point is 
>officially at the
> bottom left but some environments use a relative position to achieve something more 
>convenient)

(0, 0) is the northwest corner under X11, upper left as you face the
display.  IIRC, back when I studied vector calculus (I didn't do too
well) any ordered n-tuple was a vector, so a position on the display
described as (x, y) would be considered a vector.

As I understand it (and I haven't really studied it) each window on the
display (icons are included in the category windows) occupies a
rectangle on the display, defined by two vectors, its northwest corner
and its x and y size.  This is probably complicated somewhat by the
SHAPE extension, I don't know the details of that.  The X server gets
from the mouse the x and y distances it has moved.  It scales those
motions into terms of pixels and adds that vector to the vector of the
previous position of the cursor to generate a new cursor position
vector.

All these vectors are in a finite 2-dimensional field of discrete
points.  Clearly, it's pretty easy to tell which window (if any) the
cursor is in by comparing the cursor position vector to the window
position and size.  Of course, it's complicated a little by windows that
are partially hidden behind others, and I'm sure it's complicated a bit
more by the SHAPE extension.  I believe the SHAPE extension involves a
2-dimensional array of booleans that maps over the rectangle that
encloses the SHAPEd window and so tells for each pixel whether or not
that pixel should be "in the window" or not.  So once you determined
that the cursor was in the rectangle of the shaped window you would
subtract the position vector of the window from the position vector of
the cursor and use the result to find which boolean in the array applies
to the cursor position.

Can anyone point us to a document that tells whether I'm right about all
this, or is the code the best reference?

-- 
Remember, more computing power was thrown away last week than existed in
the world in 1982.  -- http://www.tom.womack.net/computing/prices.html
_______________________________________________
Newbie mailing list
[EMAIL PROTECTED]
*** To unsubscribe , or change message options, see:
http://XFree86.Org/mailman/listinfo/newbie

Reply via email to