Air: How to put a NativeWindow over OSX menu bar? - macos

I'm developing a multi monitor fullscreen application with Adobe Air 2.6.
I can create a window for every monitor, and put those windows to fullscreen.
theWindow.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
The problem comes when interacting with those windows. If I click the window on the main monitor (the one with the dock and menu bar) no problem, but when I click any other window the system menu bar becomes visible.
I've tried resizing the main window to match the monitor size and moving it to a negative coordinate but it always stays behind the bar.
Is it possible to do this in Air?
Should I look for another solution?

I was able to go full FULL_SCREEN_INTERACTIVE using AIR 3.1 (Flex 4.6 SDK) on OSX using a terrible timer hack:
public function initializeView():void
{
var horridFullscreenTimer:Timer;
horridFullscreenTimer = new Timer(100,1);
horridFullscreenTimer.addEventListener(TimerEvent.TIMER,initializeViewForReal);
horridFullscreenTimer.start();
}
public function initializeViewForReal(event:TimerEvent=null):void
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, handleStageResize);
}
Solution was found in this thread: http://forums.adobe.com/thread/108170

Related

QML Mac fullscreen mode lose mouse focus

I'm using QML to build an OSX application with fullscreen mode support. My intention is to toggle fullscreen/normal mode by double-clicking the main area of the window, here is the minimal code:
import QtQuick 2.4
import QtQuick.Window 2.2
Window {
id: main
visible: true
width: 800; height: 480
flags: Qt.Window | Qt.WindowFullscreenButtonHint // for OSX native behavior support
MouseArea {
anchors.fill: parent
onDoubleClicked: {
if (main.visibility === Window.FullScreen) {
main.visibility = Window.AutomaticVisibility;
} else {
main.visibility = Window.FullScreen;
}
}
}
}
It's very simple, but the behavior is weird:
Whenever the visibility state of the application changes(enter or leave), the user must click in the window one more time before the window mode can change again, just like the application loses the mouse focus.
To validate what I'm thinking, I test something more, I add one more MouseArea(let's say mouseAreaTest) in the window, which split the window side by side and can receive onEntered and onExited event. Right after the application enter or exit fullscreen mode, mouseAreaTest will never receive any Enter or Exit event, unless you click on the window one more time, which is not what I want.
I know nothing about how OSX implement its own fullscreen mode, nor why QML on OSX has such a buggy problem. So I expect someone will tell me something about it.
Update
Later I doubted if this was only something about QML which related something about the Window System of QML, so I tried using traditional QtWidgets, and found the same result there.
Update
I tracked the mouse event of traditional widget, and found the problem: the double click event consisted of two click event(press-release-press-release), when the window state changd(fullscreen to normal or normal to fullscreen), the last RELEASE event will never be received UNLESS click one more time.
I also did more test: use a button to control window state, and the problem is gone, so I may probably consider this is a bug of mouse event handle.
By the way, post system info for a note:
OSX 10.10.1
Qt 5.4.1
This bug still exists in Qt 5.11. I found a workaround eventually.
The reason why the last mouse release event not received is that we toggled fullscreen immediately. Somehow the mouse release event was lost during transition to fullscreen.
So the fix was simple: we postpone toggling fullscreen till next mouse release event. i.e. when we need to toggle fullscreen, set a flag temporarily, then in mouseReleaseEvent, check the flag and do the real work.

How to show QDialog window over OSX Dock and OSX menu?

I'd like to show full screen QDialog on Mac OSX.
I tried to do that:
QDialog* d = new QDialog(nullptr, Qt::Window);
d->showFullScreen();
d->activateWindow();
It works, but this dialog creates new OSX screen:
I tried to do that:
QDialog* d = new QDialog(nullptr, Qt::SplashScreen | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
d->setWindowState(Qt::WindowFullScreen);
d-show();
It doesn't create new screen, but QDialog shows under OSX Dock and OSX menu:
How to solve my problem?
What you are seeing is the normal behaviour of OS X. If you want a full screen application, without the dock and menu bar, then having a separate Desktop Screen (space) is the accepted method.
An alternative would be to maximise the size of your dialog and set the dock to hide, but you'd still be left with the menu at the top and changing the user's preference for how the dock is displayed is not a good user experience.

How can I hide the dock and menubar in my fullscreen game?

I'm writing a game that will run in a fullscreen window. I'm using Xojo to code it (therefore any boolean window properties that might be availble in Xcode / Interface Builder are not an option).
Is there a plist key/value I can set in my app that will hide the application menubar and the dock when my window is set to full screen?
Needs to work on Yosemite.
Get the macoslib
It contains extensions for NSWindow that can do this. Just search the project for "fullscreen".
There is also a demo. If you run the project, open the menu bar: Examples -> Cocoa -> NSWindow. That window has a "Toggle Fullscreen" button for testing.
Here is what you need to place in the window Open event :
self.LiveResize = False
self.MenuBarVisible = false
self.FullScreen = true
First line turns off animation,
Second line turns off UI elements (dock and menu bar),
Third line makes the window full screen

How to use Mac OS X Lion fullscreen abilities in my Flex app?

How can I enable the nativ Mac OS X fullscreen feature (incl. the top right button) in my Flex application?
I believe this question has your answer:
Assuming you are referring to full screen as in 'use the whole
monitor':
Calling stage.displayState = StageDisplayState.FULL_SCREEN; will set
your flash movie to full screen mode (provided that the
allowFullScreen parameter has been set to true in the object/embed
tags of the embedding html page).
If you're building an AIR App; read this article on using FullScreen functionality. It also uses the same displayState property.
// Enter Fullscreen Interactive State
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
// Enter Standard Fullscreen State
stage.displayState = StageDisplayState.FULL_SCREEN;
// Enter Normal State
stage.displayState = StageDisplayState.NORMAL;

PropertySheet Full Screen

I'm porting an application from windows Pocket PC2003 to Windows Mobile 6.5.
On startup my application shows a PropertySheet with two Pages which I want
to show in full screen mode.
The problem is this:
What ever I do the Taskbar and the menubar will never disapear. Windows Button,
SIP-Button and all other Buttons stay in foreground.
I tried this:
CPropertySheet::OnInitDialog();
// Call SHInitDialog with flags for full screen.
SHINITDLGINFO shidi;
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_FULLSCREENNOMENUBAR;
shidi.hDlg = m_hWnd;
::SHInitDialog(&shidi);
// SHFullScreen fails if dialog box is not foreground.
SetForegroundWindow();
SHFullScreen(m_hWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
and in normal dialogs it will work with
m_bFullScreen = FALSE;
on top but m_bFullScreen is not available for CPropertySheet.
Has anyone any solution for this problem?

Resources