summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2a53731)
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.
ifeq ($(platform),Darwin)
LUAPLATFORM = macosx
OBJCSRCS = util_darwin.m
ifeq ($(platform),Darwin)
LUAPLATFORM = macosx
OBJCSRCS = util_darwin.m
- LDFLAGS += -framework Foundation
+ LDFLAGS += -framework Foundation -framework AppKit
else
LUALIB += -ldl
LDLIBS += -ltermcap -lncurses
else
LUALIB += -ldl
LDLIBS += -ltermcap -lncurses
#include <string.h>
#include "proxgui.h"
#include <QtGui>
#include <string.h>
#include "proxgui.h"
#include <QtGui>
+
+extern "C" {
+#include "util_darwin.h"
+}
//#include <ctime>
bool g_useOverlays = false;
//#include <ctime>
bool g_useOverlays = false;
+ {
+#if defined(__MACH__) && defined(__APPLE__)
+ makeFocusable();
+#endif
plotwidget = new ProxWidget();
plotwidget = new ProxWidget();
//start proxmark thread after starting event loop
QTimer::singleShot(200, this, SLOT(_StartProxmarkThread()));
//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
+
void disableAppNap(const char* reason);
void enableAppNap();
void disableAppNap(const char* reason);
void enableAppNap();
+void makeUnfocusable();
+void makeFocusable();
+
#endif
\ No newline at end of file
#endif
\ No newline at end of file
#import <Foundation/NSString.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import <Foundation/NSProcessInfo.h>
+#import <AppKit/NSApplication.h>
static id activity = nil;
static id activity = nil;
void disableAppNap(const char* reason) { }
void enableAppNap() { }
#endif
void disableAppNap(const char* reason) { }
void enableAppNap() { }
#endif
+
+//OS X Version 10.6 is defined in OS X 10.6 and later
+#if defined(MAC_OS_X_VERSION_10_6)
+void makeUnfocusable() {
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
+}
+
+void makeFocusable() {
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+}
+#else
+void makeUnfocusable() { }
+void makeFocusable() { }
+#endif