How can I check whether Exposé is being activated or not?

Posted by yangumi on Stack Overflow See other posts from Stack Overflow or by yangumi
Published on 2010-04-13T03:36:36Z Indexed on 2010/04/13 3:43 UTC
Read the original article Hit count: 392

Filed under:
|
|
|
|

Hi,

I'm creating an application that emulates MacBook's multi-touch Trackpad. As you may know, on MacBook's trackpad

  • if you swipe 4 fingers up, it triggers the Show Desktop.
  • if you swipe 4 fingers down, it shows the Exposé.

However, if the Show Desktop is being activated and you swipe 4 fingers down, it will come back to the normal mode. The same goes with the Exposé: if the Exposé is being activated and you swipe 4 fingers up, it will also come back to the normal mode.

Here is the problem: I use the keyboard shortcut F3 to show the Exposé and F11 to show the Show Desktop. The problem is, when the Show Desktop is being activated, if I press F3, it will go straight to the Exposé. And when the Exposé is being activated, if I press F11 it will go straight to the Show Desktop. But I want it to behave like Trackpad, which I guess its code may look like this

- FourFingersDidSwipeUp {
    if (isExposeBeingActivated() || isShowDesktopBeingActivated()) {
        pressKey("Esc");
    } else {
        pressKey("F11");
    }
}

But I don't know how to implement the "isExposeBeingActivated()" and "isShowDesktopBeingActivated()" methods. I've tried creating a window and check whether its size has changed (on assumption that if the Expose is being activated, its size should be smaller), but the system always returns the same size. I tried monitoring the background processes during the Expose, but nothing happened. Does anyknow have any suggestions on this?

(I'm sorry if my English sounds weird.)

© Stack Overflow or respective owner

Related posts about mac

Related posts about cocoa