Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Missing input in mac fullscreen  (Read 3216 times)

wally

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
Missing input in mac fullscreen
« on: November 26, 2008, 07:34:31 PM »

I have an app using Ogre 1.6, OIS (latest), CEGUI 0.6.1.
It works fine in windowed mode on the mac, and in both windowed and fullscreen on Windows.

Running it in fullscreen on the mac, most of the input seems to be lost:
- I get no keypress events
- I get no mouse move events UNLESS I am holding down a mouse button.

The first odd thing is that the lost keypresses are apparently going through to the operating system:
I usually launch by double clicking the app in Finder. My tests for keypresses include pressing Escape (which are having no effect in my app). But when I exit, my Finder window has gone "up" a number of levels equal to the number of times I pressed Escape within my app (this is the usual behavior pressing Esc in Finder).

The really odd thing is that the same built app, in fullscreen, gets all input correctly if I "Run" from XCode (no debugger): no keypresses are lost and mouse moves work as normal.

Initially I was using the OIS version that ships with Ogre dependencies (no idea what version that is). I then downloaded the latest OIS source (1.2), built locally, and tried using the framework produced. Same result with both versions.

I've seen other posts mentioning that "exclusive mode" can be better for fullscreen, but the mac port doesn't seem to support that.

Any ideas how I can fix this, or what might be different when I run from XCode?
I'm pretty new to Mac development.

I'm using buffered input, single threaded app.
OSX 10.5.5, PowerPC, Xcode 3.1.

Thanks - Wally
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +4/-1
  • Posts: 2672
    • http://www.wreckedgames.com
Re: Missing input in mac fullscreen
« Reply #1 on: November 26, 2008, 10:40:43 PM »

Hmm, I can't say I've tried that many fullscreen apps on OSX. Do the Ogre demos work in fullscreen there (I can't really recall if they even go full screen on Mac). Make sure you are pumping mouse messages (via Ogre's methods - should be handled automatically if you have an Ogre autocreated window - but safe to verify). Besides that, I can't really say for sure.

Would be great if you could duplicate this with the OIS Console demo (ie make it go full screen similiar to how Ogre does) and post the modified code here. I could then easily find the problem and work around. Without a demo to try to fix, I don't think I will have time to reproduce the issue.
Logged

wally

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
Re: Missing input in mac fullscreen
« Reply #2 on: November 26, 2008, 11:02:00 PM »

Good question, I haven't tried this in the Ogre demos. I'll give that a try, maybe the console demo too. Though I'll be away for the next 2 weeks.
I guess I'm assuming that people play at least some OSX games fullscreen.
Logged

wally

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
Re: Missing input in mac fullscreen
« Reply #3 on: December 14, 2008, 04:22:18 PM »

Back from my holiday...

I forced an Ogre demo to go fullscreen (using the option in the ogre config file).
The same problem occurs there: no keypresses are received ever, and mouse motion is only received when the left button is also held.

It might take me some time to figure out how to make the console demo fullscreen. I'm fairly new to Macs.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +4/-1
  • Posts: 2672
    • http://www.wreckedgames.com
Re: Missing input in mac fullscreen
« Reply #4 on: December 14, 2008, 05:08:14 PM »

Sounds like it might be a capturing/grab problem then. Where the mouse is not really given to the window in its full screen mode. OIS Linux/X11 version suffered a similar problem in the past (long ago), which is why it 'grab's the mouse and keyboard there by default... Even when fullscreen, it would loose focus/control of the devices. Maybe OSX has a similar grab API method.
Logged

Llarlen

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 1
Re: Missing input in mac fullscreen
« Reply #5 on: February 20, 2009, 03:18:41 PM »

I had the exact same problem and found an easy/slightly dirty way to fix it:
1. Hook up a timer which fires once and immediately, linking to a 'launcher' function.
2. In this launcher function call QuitApplicationEventLoop() to exit the default run loop and then start your Ogre application.
3. Call RunApplicationEventLoop() to start the default run loop.

The problem is not in OIS, it's in Ogre. Some needed initialisation is missing which gets covered by calling the default run loop. I'm not exactly sure what, so I guess I'll stick to this hack until someone gets a better solution. I did try to force the application to the front instead, but this didn't do the trick.
Logged