Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: OIS interfering with desktop events  (Read 889 times)

ArmchairArmada

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
OIS interfering with desktop events
« on: May 07, 2010, 01:54:14 PM »

Before implementing OIS for unbuffered keyboard input my desktop events worked correctly, but after adding OIS to my project some desktop input events don't behave properly.

Things that do not work while running my application:
* Moving windows
* Resizing windows
* Typing text
* Opening Menu bar items

Things that still work:
* Focusing on windows
* Closing windows
* Scrolling scrollbars
* Clicking some gui buttons

Things I noticed that do not work even after my application is closed:
* Keyboard doesn't repeat when I hold a button down

After closing my application my desktop returns to normal. What might be causing this interference, and how might it be remedied?

Application: Ogre, OIS
Operating System: Ubuntu 9.10

To be clear here, it interferes with my whole desktop, so I cannot interact properly with other applications while my application is running.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: OIS interfering with desktop events
« Reply #1 on: May 08, 2010, 07:14:18 PM »

If your app has focus, yes the mouse/keyboard will be captured. You can release the mouse with alt-tab. Or, you can turn off mouse capturing in OIS. Besides that, OIS does nothing to your X Window Session.

As for auto repeat, you can disable OIS's turning that off. However, if you shutdown OIS correctly, it will restore that setting when closing.
Logged

ArmchairArmada

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Re: OIS interfering with desktop events
« Reply #2 on: May 08, 2010, 08:23:30 PM »

You seemed to have misunderstood.  When my app does not have focus it interferes with my desktop and other applications.  Why should I not be able to click open menu items in other windows or type into text fields on other applications when those applications do have focus?

I was thinking about it a little more.  Is there something special that has to be done to check if an Ogre window has lost focus and then, perhaps, deactivate OIS?  Then, later, when the window regains focus OIS can be reactivated?

Also, at the moment I am only capturing Keyboard input.  My mouse is free to roam wherever I wish it.  The only OIS object I created was for the keyboard.  I understand what you are saying.  You claim that this is simply ordinary mouse/keyboard capturing, but I know how that is suppose to behave.  What I am experiencing allows me to interact with other windows in some ways but not in others.  If you read the original post you will see what works and what doesn't.  Thanks.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 35
    • View Profile
    • Opensource Game Studio
Re: OIS interfering with desktop events
« Reply #3 on: May 17, 2010, 04:23:08 AM »

Please tell me how to disable OIS touching key autorepeat?

Nimos

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: OIS interfering with desktop events
« Reply #4 on: May 17, 2010, 12:20:25 PM »

ArmchairArmada
Just a guess, but could you be running in input-exclusive mode?
I'm using Ubuntu and the actions you mention works for me when I'm in non-exclusive mode.

See the "Non-exclusive input" part on this page for how to disable exclusive mode.
http://www.ogre3d.org/wiki/index.php/Using_OIS

kornerr
Using
paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("false")));
in the param list (mentioned on the same page) works for me in linux.
Not sure how it is done in Windows though. :-\
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 35
    • View Profile
    • Opensource Game Studio
Re: OIS interfering with desktop events
« Reply #5 on: May 17, 2010, 08:17:16 PM »

This IS touching, because you DO set the repeat value. I want OIS not touch it at all.

Nimos

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: OIS interfering with desktop events
« Reply #6 on: May 18, 2010, 02:29:14 AM »

Okay, misunderstood your question.
From what I can see in the code, passing true for XAutoRepeatOn will result in OIS not touching the X key repeat.
paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 35
    • View Profile
    • Opensource Game Studio
Re: OIS interfering with desktop events
« Reply #7 on: May 18, 2010, 06:51:58 AM »

Won't it set the autorepeat on if it's off in the system?

Nimos

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: OIS interfering with desktop events
« Reply #8 on: May 18, 2010, 11:46:04 AM »

I thought so too. But you can look in LinuxKeyboard.cpp. I can only find one XAutoRepeatOn and that one is called in the destructor if auto repeat had previously been disabled.
Perhaps pjcast can confirm it, but I guess one should interpret a true value as OIS using auto repeat if it is on, in other words leaving it up to the system.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 35
    • View Profile
    • Opensource Game Studio
Re: OIS interfering with desktop events
« Reply #9 on: May 18, 2010, 08:27:11 PM »

You're right. OIS code is weird. I guess I'll have to look to SDL for not screwing the system then.