Hi all

There is something strange (feature or bug?) in the way the
osgViewer::CompositeViewer dispatches events to the windows. When
there are multiple windows, each containing a single view to a single
scene, the events do not seem to be routed to the proper view. I found
what I guess is the guilty: the CompositeViewer::eventTraversal()
method. There is a concept of "master view", which seems to be related
to the "view having the focus", and this view gets all events,
whatever the actual GraphicsContext that generated it.

In GraphicsWindowWin32, the events are handled in a per-HWND basis and
put in the window's EventQueue. Then the CompositeViewer takes all
these events and remaps them (through the viewEventsMap). They are
then sent to the remapped window instead of the original window.

I'm sure there is a good reason why this remapping takes place, but in
practice this causes problems as shown in the attached example. It
creates two windows and attaches an event handler that catches RESIZE
events, printing the name of the window ("small" or "big") and the
size (200x200 or 400x400). If you move the windows around (WM_MOVE and
WM_SIZE both generate RESIZE events), you will sometimes see
- correct output, i.e. "small resized to 200x200" or "big resized to 400x400"
- and incorrect output, e.g. "small resized to 400x400"
When I move the big window around, the output is correct the first
time, incorrect the second time - the OSG's internal focus might have
changed.

I haved used the CompositeViewer in the past, but embedded in
wxWidgets, and I would get the RESIZE events from wxWidgets, not from
the OSG so this behaviour went unnoticed for me until now. If it is a
bug, I don't want to start modifying anything since I don't have all
CompositeViewer usage scenarii in mind. If it is a feature, do you
know what I am doing wrong ?

I'm working on the latest SVN, Win32, VC9.

Cheers

Thibault

Attachment: osg_compositeviewer_events_bug.cpp
Description: Binary data

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to