At this point, we can hack in a fix to RenderSurface with an API to control key repeats.  Going forward, things will be refactored significantly, and I'd like to think about this a bit further.  It really doesn't fit the scope of RenderSurface to be controlling things like KeyRepeat events, etc, so in the future it will probably move somewhere else.

But lets get it in there for now.  I'll have a look see.  I'm trying to catch up on a bit of a back log of other items right now.

-don

On 11/13/06, Anders Backman <[EMAIL PROTECTED]> wrote:
Mm, it SOUNDS good.
IF you check the value, its actually 1 most of the times.

I added the code into RenderSurface_Win32.cpp

case WM_KEYDOWN:
        {
            int mask = 15;
            int repeat = lParam&mask;
            std::cerr << "Repeat: " << repeat << std::endl;


When running a producer based app while pressing a key down, I get:

Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 2
Repeat: 2
Repeat: 2
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1
Repeat: 1

So it looks like the repeat info we get is something else, anyway, its
nothing that helps here.

On the other hand, its actually bit 30 that is interesting, it
specifies wether the key comes from a up or a down state previously.
So in a perfect world we could do:

if (!getAutoRepeatMode() && (lParam & (1 << 30)))
  break;

The problem is that this code is in RenderSurface, and it knows
nothing about KeyboardMouse...

So Don, what can be done about it?

(sorry, I should have posted this on the Producer mailing-list, but
its a 3, closing into 4 year old OSG-topic, so I thought it should get
its final closure here to ;-)

/Anders

On 11/13/06, Chris Hanson <[EMAIL PROTECTED]> wrote:
> Anders Backman wrote:
> > Guess if I was happy to find the setAutoRepeat(bool) method in
> > Producer/KeyboardMouse
> > Equally sad when I spotted the implementation: setAutoRepeat(bool flag) {}
> > I mean there is a vad way of solving it outside producer/osgProducer
> > by creating a std::map<> and store all the keyboard events to see if
> > they have changed or not.
> > But I dont want to implement this just to find that a better solution
> > is already in the pipeline...
>
>    Under Windows, both WM_CHAR and WM_KEYDOWN:
> http://msdn.microsoft.com/library/default.asp?url=""
> http://msdn.microsoft.com/library/default.asp?url=""
>
>    offer a value masked into bits 0-15 of the lParam of the message event. I expect the
> Producer event handling could check this value and the state of an internal AutoRepeat
> variable (controlled by setAutoRepeat()) and discard repeated events.
>
>
>    I don't know anything special about Producer, this is just how I see it.
>
> > /Anders
>
> --
> Chris 'Xenon' Hanson aka Eric Hammil | http://www.3DNature.com/ eric at logrus
>   "I set the wheels in motion, turn up all the machines, activate the programs,
>    and run behind the scenes. I set the clouds in motion, turn up light and sound,
>    activate the window, and watch the world go 'round." -Prime Mover, Rush.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>


--


________________________________________________________________
Anders Backman               Email:    [EMAIL PROTECTED]
HPC2N/VRlab                  Phone:    +46 (0)90-786 9936
Umea university              Cellular: +46 (0)70-392 64 67
S-901 87 UMEA SWEDEN         Fax:      +46 90-786 6126
                               http://www.cs.umu.se/~andersb
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to