osx: fix annoying focus behaviour (@anticat)

https://github.com/Proxmark/proxmark3/pull/689

OS X has a global menu bar and a per app dock icon. Therefore, all
GUI applications launched from a terminal will become focused - even
if they don’t show any windows. Thereby the terminal loses focus.

Since is it very annoying to re-focus the terminal after each proxmark
client launch, this change makes the client unfocusable during launch
and restores the regular behaviour when a window is created.
This commit is contained in:
Chris 2018-10-07 09:01:24 +02:00
commit 1fb121474e
4 changed files with 35 additions and 3 deletions

View file

@ -27,6 +27,10 @@
#include "proxgui.h"
#include <QtGui>
extern "C" {
#include "util_darwin.h"
}
bool g_useOverlays = false;
int g_absVMax = 0;
int startMax;
@ -53,9 +57,14 @@ void ProxGuiQT::_ShowGraphWindow(void) {
if(!plotapp)
return;
if (!plotwidget)
if (!plotwidget) {
#if defined(__MACH__) && defined(__APPLE__)
makeFocusable();
#endif
plotwidget = new ProxWidget();
}
plotwidget->show();
}
@ -100,6 +109,12 @@ void ProxGuiQT::MainLoop()
//start proxmark thread after starting event loop
QTimer::singleShot(200, this, SLOT(_StartProxmarkThread()));
#if defined(__MACH__) && defined(__APPLE__)
//Prevent the terminal from loosing focus during launch by making the client unfocusable
makeUnfocusable();
#endif
plotapp->exec();
}