Tao.Sdl and window input focus

Member
Posts: 63
Joined: 2005.12
Post: #1
I'm working on getting started with C# development, using OS X 10.5.2, Mono 1.9, MonoDevelop 1.5, Tao 2.0, and the binaries that come with the Tao framework.

The only problem I've run into so far is that when the application is run, the window is created successfully, but it never gains mouse or input focus. This is true whether the app is run from MonoDevelop or from the terminal. Also, I've tried some of the examples that come with Tao, and have gotten the same results.

Is there something in particular I need to do make the window focusable?

Thanks,
Jesse
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
The usual cause of this (and I know nothing about the specifics of Tao) is the lack of an application bundle. You can call TransformProcessType from C if you absolutely cannot have an application bundle (why?) but normally you should just create one.
Quote this message in a reply
Member
Posts: 63
Joined: 2005.12
Post: #3
Ah. I'm not sure how to create a Mono-based application bundle, so I'll have to look into that next. (If anyone has already done this, any tips or suggestions would be welcome.)

Thanks for your help, OSC.
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #4
You'll want to use macpack to create an application bundle. If you use nant, it might look like something like this:
Code:
<!-- create the Application Bundle -->
        <exec program="macpack">
            <arg value="-m:cocoa" />
            <arg value="-n:Game" />
            <arg value="-a:Game.exe" />
        </exec>
        <!-- copy our Assemblies -->
        <copy todir="Game.app/Contents/Resources" flatten="true">
            <fileset>
                <include name="Assemblies/*.dll" />
                <include name="Assemblies/*.config" />
            </fileset>
        </copy>
        <!-- copy our Frameworks -->
        <exec program="cp">
            <arg value="-r" />
            <arg value="Frameworks" />
            <arg value="Game.app/Contents" />
        </exec>
        <!-- copy our Libraries (may not be working) -->
        <exec program="cp">
            <arg value="-r" />
            <arg value="Libraries" />
            <arg value="Game.app/Contents" />
        </exec>
        <delete file="Game.exe" />

Or, from command line/makefile...
Code:
macpack -m:2 -o:. -r:./lib/Tao.OpenGl.dll -r:./lib/Tao.OpenGl.dll.config -r:./lib/Tao.Glfw.dll -r:./lib/Tao.Glfw.dll.config -r:/usr/local/lib/libglfw.a -n:Game -a:./obj/Game.exe

Note, I don't use SDL, so you'd need to change thing appropriately.
Quote this message in a reply
Member
Posts: 63
Joined: 2005.12
Post: #5
bronxbomber92 Wrote:You'll want to use macpack to create an application bundle. If you use nant, it might look like something like this:

*** code ***

Or, from command line/makefile...
Code:
macpack -m:2 -o:. -r:./lib/Tao.OpenGl.dll -r:./lib/Tao.OpenGl.dll.config -r:./lib/Tao.Glfw.dll -r:./lib/Tao.Glfw.dll.config -r:/usr/local/lib/libglfw.a -n:Game -a:./obj/Game.exe

Note, I don't use SDL, so you'd need to change thing appropriately.
Great, thanks for the suggestion (and for the examples). I will give it a try.
Quote this message in a reply
Member
Posts: 63
Joined: 2005.12
Post: #6
Thank you both for your help. MacPack works perfectly, and running the program as an application bundle does indeed fix the input focus problem.

Just out of curiosity, is anyone else here working with this particular toolset (C#/MonoDevelop/Tao)?

As things are now, once I've compiled the project I have to switch to the terminal and use MacPack to create a bundle. This is a bit awkward though - it seems there must be a way to do everything (including bundling and executing the application) directly from MonoDevelop.

Currently, I'm executing the following from the terminal:

Code:
macpack -m:2 -o:.
    -r:/Users/jyk/Documents/C#/Mono/tao-2.0.0/bin/assemblies/Tao.Sdl.dll
    -r:/Users/jyk/Documents/C#/Mono/tao-2.0.0/bin/assemblies/Tao.OpenGl.dll
    -n:"Sdl Test" -a:"Tao.Sdl Test.exe"

This works fine. I then tried adding this as a post-build custom command in MonoDevelop, with ${TargetDir} as the working directory, but got this:

Code:
Performing main compilation...
Build complete -- 0 errors, 0 warnings
Executing: macpack -m:2 -o:.
    -r:/Users/jyk/Documents/C#/Mono/tao-2.0.0/bin/assemblies/Tao.Sdl.dll
    -r:/Users/jyk/Documents/C#/Mono/tao-2.0.0/bin/assemblies/Tao.OpenGl.dll    
    -n:"Sdl Test" -a:"Tao.Sdl Test.exe"
Error: No assembly to macpack was specified

Somehow, the same command that works from the terminal fails as a custom command in MonoDevelop, and I have yet to figure out why.

I realize there probably aren't too many folks here who are using this particular toolset, but if anyone has any tips on establishing a smooth workflow in MonoDevelop, they would be appreciated.

In any case, thanks for your help so far - I'm certainly farther along than I was before.
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #7
I was never able to get tao working with my linux box, so I just gave up on it, but I'm glad to see you managed it! Grin

It's not magic, it's Ruby.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Continuous Mouse Input and Keeping Focus Nevada 4 3,172 Aug 30, 2007 05:09 PM
Last Post: AnotherJake
  xCode see when the windows looses focus guvidu 1 2,428 Mar 23, 2007 04:25 AM
Last Post: OneSadCookie
  Cocoa window focus Dan Potter 2 3,338 Apr 30, 2005 08:57 AM
Last Post: Dan Potter