I can do what I think you want by adding a single line to the following file in the OpenCV distribution:
modules/highgui/src/window_cocoa.mm
It is around line 568, and is the single line after the word SETCHELL
in the code below:
[window setFrameTopLeftPoint:initContentRect.origin];
[window setFirstContent:YES];
[window setContentView:[[CVView alloc] init]];
[window setHasShadow:YES];
[window setAcceptsMouseMovedEvents:YES];
[window useOptimizedDrawing:YES];
[window setTitle:windowName];
[window makeKeyAndOrderFront:nil];
// SETCHELL - raise window to top of stacking order
[window setLevel:CGWindowLevelForKey(kCGMaximumWindowLevelKey)];
[window setAutosize:(flags == CV_WINDOW_AUTOSIZE)];
[windows setValue:window forKey:windowName];
[localpool drain];
return [windows count]-1;
}
CV_IMPL int cvWaitKey (int maxWait)
{