Hi Community,

In my cross-platform app I have processing of keybard input - simple
terminal for writing commands in real-time. This is same on Windows and
Linux (haven't tested it yet on Mac), but on Windows for example, you do
Alt-TAB to get some other window and get it back again, the keyboard events
are not processed anymore :-/. Seams like when osgViewer loses the focus it
is not gaining it back from the system call. On windows I managed to do
this - ( my background is Windows, on Linux I am new :-) ). Here is the
snippet how I managed it to work on Windows. Anyone to share a snippet for
Linux/Mac? As always, thanks a lot

<snip>
    while (!viewer->done())
    {
#if defined(_WIN32)
        MSG msg;
        if (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
        {
            ::GetMessage(&msg, NULL, 0, 0);
            osgViewer::CompositeViewer::Windows wins;
            viewer->getWindows(wins);

            if (wins.size())
            {
                osgViewer::GraphicsHandleWin32 *hdl =
dynamic_cast<osgViewer::GraphicsHandleWin32*>(wins.at(0));
                if(hdl)
                {
                    WNDPROC fWndProc =
(WNDPROC)::GetWindowLongPtr(hdl->getHWND(), GWLP_WNDPROC);
                    fWndProc(hdl->getHWND(), msg.message, msg.wParam,
msg.lParam);
                }
            }
        }
#endif
......
</snip>

Nick

-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to