REBOL Technologies

OSX Window Activation Problem (SelectWindow)

Carl Sassenrath, CTO
REBOL Technologies
22-Apr-2005 17:55 GMT

Article #0157
Main page || Index || Prior Article [0156] || Next Article [0158] || 2 Comments || Send feedback

The REBOL OSX port has been moving along... and we were hopeful to get some of you early testers a prototype by this weekend. However, we've run into a problem. Perhaps some of you OS X experts might know the solution. Here is a discussion of the problem:

Short description:
The REBOL windows never get the "focus".

Long description:
OS X uses the SelectWindow() function to make a window active, bringing it to the front (top window) and allowing it to become the focus of keyboard and other events. However, for some reason, we cannot get this to happen. We do see mouse events without a problem, but the window never moves to the front, nor does it ever receive keyboard events. We have searched far and wide in the OSX developer documentation, but have yet to find a solution. A general search of the web does not provide an answer either.

A short example:
Here is a small C file that shows the problem: osx-window-problem See comments at the top.

A few details:

  1. The program Carbon based.
  2. The program is run from the Terminal shell (which may factor in, we don't know).
  3. The program is not an OSX "app". It is only a GCC built executable program.
  4. Adding a SetUserFocusWindow() does not fix the problem.
  5. The program contains no menus or other Carbon GUI elements (which should not matter, but again we don't know that for sure).
Solution Update:

Please read the solution we ended up using (at least for now). It does not totally meet our requirements, but at least it gets us most of what we need.

2 Comments

Updated 20-Nov-2024   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code