Revert "Remove Carbon from Mac Auto-Type (#3347)"
This reverts commit ce1f19cacc.
This commit is contained in:
committed by
Janek Bevendorff
parent
035823e414
commit
440331d319
@@ -20,7 +20,7 @@
|
||||
#define KEEPASSX_APPKIT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <CoreGraphics/CGEvent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class AppKit : public QObject
|
||||
{
|
||||
@@ -37,8 +37,6 @@ public:
|
||||
bool hideProcess(pid_t pid);
|
||||
bool isHidden(pid_t pid);
|
||||
bool isDarkMode();
|
||||
void* addGlobalMonitor(CGKeyCode keycode, CGEventFlags modifier, void* userData, void (*handler)(void*));
|
||||
void removeGlobalMonitor(void* monitor);
|
||||
bool enableAccessibility();
|
||||
|
||||
signals:
|
||||
@@ -48,4 +46,4 @@ private:
|
||||
void* self;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_APPKIT_H
|
||||
#endif // KEEPASSX_APPKIT_H
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#import "AppKit.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/NSEvent.h>
|
||||
#import <AppKit/NSRunningApplication.h>
|
||||
|
||||
@interface AppKitImpl : NSObject
|
||||
@@ -37,8 +36,6 @@
|
||||
- (bool) isHidden:(pid_t) pid;
|
||||
- (bool) isDarkMode;
|
||||
- (void) userSwitchHandler:(NSNotification*) notification;
|
||||
- (id) addGlobalMonitor:(NSEventMask) mask handler:(void (^)(NSEvent*)) handler;
|
||||
- (void) removeGlobalMonitor:(id) monitor;
|
||||
- (bool) enableAccessibility;
|
||||
|
||||
@end
|
||||
|
||||
@@ -123,22 +123,6 @@ static const NSEventMask NSEventMaskKeyDown = NSKeyDownMask;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add global event monitor
|
||||
//
|
||||
- (id) addGlobalMonitor:(NSEventMask) mask handler:(void (^)(NSEvent*)) handler
|
||||
{
|
||||
return [NSEvent addGlobalMonitorForEventsMatchingMask:mask handler:handler];
|
||||
}
|
||||
|
||||
//
|
||||
// Remove global event monitor
|
||||
//
|
||||
- (void) removeGlobalMonitor:(id) monitor
|
||||
{
|
||||
[NSEvent removeMonitor:monitor];
|
||||
}
|
||||
|
||||
//
|
||||
// Check if accessibility is enabled, may show an popup asking for permissions
|
||||
//
|
||||
@@ -211,21 +195,7 @@ bool AppKit::isDarkMode()
|
||||
return [static_cast<id>(self) isDarkMode];
|
||||
}
|
||||
|
||||
void* AppKit::addGlobalMonitor(CGKeyCode keycode, CGEventFlags modifier, void* userData, void (*handler)(void*))
|
||||
{
|
||||
return [static_cast<id>(self) addGlobalMonitor:NSEventMaskKeyDown handler:^(NSEvent* event) {
|
||||
if (event.keyCode == keycode && (event.modifierFlags & modifier) == modifier) {
|
||||
handler(userData);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
void AppKit::removeGlobalMonitor(void* monitor)
|
||||
{
|
||||
[static_cast<id>(self) removeGlobalMonitor:static_cast<id>(monitor)];
|
||||
}
|
||||
|
||||
bool AppKit::enableAccessibility()
|
||||
{
|
||||
return [static_cast<id>(self) enableAccessibility];
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
MacUtils* MacUtils::m_instance = nullptr;
|
||||
|
||||
MacUtils::MacUtils(QObject* parent) : QObject(parent)
|
||||
MacUtils::MacUtils(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_appkit(new AppKit())
|
||||
{
|
||||
connect(m_appkit.data(), SIGNAL(lockDatabases()), SIGNAL(lockDatabases()));
|
||||
@@ -29,7 +30,6 @@ MacUtils::MacUtils(QObject* parent) : QObject(parent)
|
||||
|
||||
MacUtils::~MacUtils()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MacUtils* MacUtils::instance()
|
||||
@@ -76,16 +76,6 @@ bool MacUtils::isDarkMode()
|
||||
return m_appkit->isDarkMode();
|
||||
}
|
||||
|
||||
void* MacUtils::addGlobalMonitor(CGKeyCode keycode, CGEventFlags modifier, void* userData, void (*handler)(void*))
|
||||
{
|
||||
return m_appkit->addGlobalMonitor(keycode, modifier, userData, handler);
|
||||
}
|
||||
|
||||
void MacUtils::removeGlobalMonitor(void* monitor)
|
||||
{
|
||||
m_appkit->removeGlobalMonitor(monitor);
|
||||
}
|
||||
|
||||
bool MacUtils::enableAccessibility()
|
||||
{
|
||||
return m_appkit->enableAccessibility();
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#ifndef KEEPASSXC_MACUTILS_H
|
||||
#define KEEPASSXC_MACUTILS_H
|
||||
|
||||
#include "AppKit.h"
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include "AppKit.h"
|
||||
|
||||
class MacUtils : public QObject
|
||||
{
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
bool hideOwnWindow();
|
||||
bool isHidden();
|
||||
bool isDarkMode();
|
||||
void* addGlobalMonitor(CGKeyCode keycode, CGEventFlags modifier, void* userData, void (*handler)(void*));
|
||||
void removeGlobalMonitor(void* monitor);
|
||||
bool enableAccessibility();
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user