Qt & NSWorkspace bug

  • Hi all,



    I'm working on a Qt-based app that uses some Cocoa calls. I've
    discovered a bug such that any call to [NSWorkspace sharedWorkspace]
    results in the app getting into a state where the main app window
    doesn't have focus when the app becomes the active app. In other words:



    1.      Launch our app

    2.      Make a different app active in the Dock

    3.      Make our app active in the Dock

    4.      Notice that our app's main window does not have focus (it's
    still behind the last active app), but the menu bar correctly shows our
    app



    If I remove the call to [NSWorkspace sharedWorkspace], the bug goes
    away. I can't reproduce this in a native Cocoa app, only in my Qt-based
    app. Any suggestions?



    Thanks,

    -Ted


    Shoot Anything, Share Everything with Flip Video.
    http://theflip.com/store
  • Have you tried this in Leopard?
    Tiger had a few snags with mixing Carbon and Cocoa windows, but Leopard
    has improved some of the edge cases.

    Ted Barram wrote:
    >
    >
    > Hi all,
    >
    >
    >
    > I'm working on a Qt-based app that uses some Cocoa calls. I've
    > discovered a bug such that any call to [NSWorkspace sharedWorkspace]
    > results in the app getting into a state where the main app window
    > doesn't have focus when the app becomes the active app. In other words:
    >
    >
    >
    > 1.      Launch our app
    >
    > 2.      Make a different app active in the Dock
    >
    > 3.      Make our app active in the Dock
    >
    > 4.      Notice that our app's main window does not have focus (it's
    > still behind the last active app), but the menu bar correctly shows our
    > app
    >
    >
    >
    > If I remove the call to [NSWorkspace sharedWorkspace], the bug goes
    > away. I can't reproduce this in a native Cocoa app, only in my Qt-based
    > app. Any suggestions?
    >
    >
    >
    > Thanks,
    >
    > -Ted
    >
    >
    > Shoot Anything, Share Everything with Flip Video.
    > http://theflip.com/store
    >
  • On Jan 31, 2008 AD, at 10:31 AM, Ted Barram wrote:

    > If I remove the call to [NSWorkspace sharedWorkspace], the bug goes
    > away. I can't reproduce this in a native Cocoa app, only in my Qt-
    > based
    > app. Any suggestions?

    You must call NSApplicationLoad() before using NSWorkspace or else
    strange things will happen.

    Nick Zitzmann
    <http://www.chronosnet.com/>
  • >> You must call NSApplicationLoad() before using...

    Thanks Nick, that did the trick!

    -Ted

    -----Original Message-----
    From: Nick Zitzmann [mailto:<nick...>]
    Sent: Thursday, January 31, 2008 1:35 PM
    To: Ted Barram
    Cc: <cocoa-dev...>
    Subject: Re: Qt & NSWorkspace bug

    On Jan 31, 2008 AD, at 10:31 AM, Ted Barram wrote:

    > If I remove the call to [NSWorkspace sharedWorkspace], the bug goes
    > away. I can't reproduce this in a native Cocoa app, only in my Qt-
    > based
    > app. Any suggestions?

    You must call NSApplicationLoad() before using NSWorkspace or else
    strange things will happen.

    Nick Zitzmann
    <http://www.chronosnet.com/>
    Shoot Anything, Share Everything with Flip Video.
    http://theflip.com/store
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today