Re: window rotation
Re: window rotation
- Subject: Re: window rotation
- From: Wade Tregaskis <email@hidden>
- Date: Thu, 20 May 2004 13:22:55 +1000
I know a really easy way to transform the point, I just need a way to
transform it before it gets to the window. Can anyone help me out?
I've managed to capture sendEvent: on NSApplication (which isn't as
straightforward as you might think), and am transforming the events as
necessary now. There's a bit of distortion; I'm ignoring a step in the
transform, but that's easily enough fixed when I get some free time.
The problem is that not all events go through sendEvent: - drag's in
particular are taken straight from the incoming events before they get
to sendEvent:. This poses a problem, as certain window operations
consequently don't work - e.g. resizing, dragging by title-bar, etc.
I'm pretty sure I know how this is being done, so I'm thinking I might
be able to resolve this by overriding the relevant NSEvent methods
(and/or wherever else steals incoming events) but it then becomes a bit
of a witch hunt to find all the possible places where events can come
in.
Ultimately the transform needs to be done in the window server, since
it's the "bottleneck" for all relevant events. Unfortunately the
window server does not at present respect the transforms on the window,
which is pretty stupid [imho] because it has to translate points to
window co-ordinates anyway, and the easiest way to do that is to apply
the inverse transform (+ a few other minor modifications). It seems at
present to just be going off the window's frame origin and height. Nor
is there any apparent method for setting a distinct event transform -
although after 3 hours with otool my eyes were shot to heck anyway, so
perhaps I missed it.
A workaround would be to apply a simple 4-point mesh for the transform
(representing each corner of the rectangular window), as applied meshes
do translate mouse events [albeit roughly] - see the previous example
with the frozen genie effect. Unfortunately while methods exist to set
the window mesh, I don't know what the 5 int/pointer function arguments
are, and I'm not particularly inclined to go by trial and error since
undoubtedly at least one of those parameters is a pointer to the mesh
matrix, which could be of any of several possible formats anyway... and
so forth.
This is where some nice Apple engineer steps up and provides the
necessary info. ;)
As it stands I'm growing tired of staring at otool output and trying to
reverse engineer the window server. I'll fix the transform as it
stands, perhaps override those extra NSEvent methods so drag's work
properly, and then leave it. I should be able to put up the "finished"
example project by tomorrow, if anyone then wants to continue working
on it.
Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.