Re: [osg-users] keyboard events not processed after osgviewer lose focus and get it back

2015-04-05 Thread Robert Osfield
Hi Nick,

This behaviour is probably down to the window manager requiring a click to
focus by default.  I don't recall a setting off the top of my head for
controlling this.

Robert.

On 5 April 2015 at 04:18, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com
 wrote:

 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_castosgViewer::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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] keyboard events not processed after osgviewer lose focus and get it back

2015-04-04 Thread Trajce Nikolov NICK
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_castosgViewer::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


[osg-users] Keyboard Events

2010-01-09 Thread George Forest
Hi,

I am executing a frame loop such as

while (!viewer.done())
{
//get pressed key
viewer.frame();
}

Within this code I want to get pressed arrow keys but I could not find any 
comprehensible example or source.

Thank you!

Cheers,
George

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22325#22325





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Keyboard Events

2010-01-09 Thread Trajce Nikolov
Hi George,

this is handled by EventHandlers. There are plenty of them for different
purposes. Have a look at osgViewer/ViewerEventHandlers

Nick

http://www.linkedin.com/in/tnick
Sent from Izmit, 41, Turkey

On Sat, Jan 9, 2010 at 7:53 PM, George Forest gfc...@hotmail.com wrote:

 Hi,

 I am executing a frame loop such as

 while (!viewer.done())
 {
 //get pressed key
 viewer.frame();
 }

 Within this code I want to get pressed arrow keys but I could not find any
 comprehensible example or source.

 Thank you!

 Cheers,
 George

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=22325#22325





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org