|
|
|
@ -31,6 +31,7 @@ |
|
|
|
|
#include "core/UBApplication.h" |
|
|
|
|
#include "core/UBSettings.h" |
|
|
|
|
#include "frameworks/UBFileSystemUtils.h" |
|
|
|
|
#include "gui/UBMainWindow.h" |
|
|
|
|
|
|
|
|
|
#include <QWidget> |
|
|
|
|
|
|
|
|
@ -621,10 +622,12 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBPlatformUtils::showOSK(bool show) |
|
|
|
|
{ |
|
|
|
|
if (QOperatingSystemVersion::current().majorVersion() == 10 && QOperatingSystemVersion::current().minorVersion() < 15) /* < Catalina */ |
|
|
|
|
{ |
|
|
|
|
@autoreleasepool { |
|
|
|
|
CFDictionaryRef properties = (CFDictionaryRef)[NSDictionary |
|
|
|
|
dictionaryWithObject: @"com.apple.KeyboardViewer" |
|
|
|
|
dictionaryWithObject: @"com.apple.keyboardViewer" |
|
|
|
|
forKey: (NSString *)kTISPropertyInputSourceID]; |
|
|
|
|
|
|
|
|
|
NSArray *sources = (NSArray *)TISCreateInputSourceList(properties, true); |
|
|
|
@ -654,3 +657,59 @@ void UBPlatformUtils::showOSK(bool show) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
NSString *source = |
|
|
|
|
@"tell application \"System Events\"\n\ |
|
|
|
|
if application process \"TextInputMenuAgent\" exists then\n\ |
|
|
|
|
tell application process \"TextInputMenuAgent\"\n\ |
|
|
|
|
tell menu bar item 1 of menu bar 2\n\ |
|
|
|
|
ignoring application responses\n\ |
|
|
|
|
click\n\ |
|
|
|
|
end ignoring\n\ |
|
|
|
|
end tell\n\ |
|
|
|
|
end tell\n\ |
|
|
|
|
end if\n\ |
|
|
|
|
end tell\n\ |
|
|
|
|
do shell script \"killall 'System Events'\"\n"; |
|
|
|
|
|
|
|
|
|
source = [source stringByAppendingString:@"if application \"Assistive Control\" is"]; |
|
|
|
|
|
|
|
|
|
if (show) |
|
|
|
|
{ |
|
|
|
|
source = [source stringByAppendingString:@" not"]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
source = [source stringByAppendingString:@" running then\n\ |
|
|
|
|
tell application \"System Events\"\n\ |
|
|
|
|
tell application process \"TextInputMenuAgent\"\n\ |
|
|
|
|
tell menu 1 of menu bar item 1 of menu bar 2\n\ |
|
|
|
|
click menu item 2\n\ |
|
|
|
|
end tell\n\ |
|
|
|
|
end tell\n\ |
|
|
|
|
end tell\n\ |
|
|
|
|
end if"]; |
|
|
|
|
|
|
|
|
|
NSAppleScript *script = [[[NSAppleScript alloc] initWithSource:source] autorelease]; |
|
|
|
|
NSDictionary *errorInfo = nil; |
|
|
|
|
[script executeAndReturnError:&errorInfo]; |
|
|
|
|
|
|
|
|
|
if(errorInfo!=nil) |
|
|
|
|
{ |
|
|
|
|
NSAlert *alert = [[NSAlert alloc] init]; |
|
|
|
|
|
|
|
|
|
if (alert != nil) |
|
|
|
|
{ |
|
|
|
|
alert.messageText = errorInfo.allValues[0]; |
|
|
|
|
[alert runModal]; |
|
|
|
|
[alert release]; |
|
|
|
|
|
|
|
|
|
//restore action state to previous one as it failed |
|
|
|
|
if (show) |
|
|
|
|
UBApplication::mainWindow->actionVirtualKeyboard->setChecked(false); |
|
|
|
|
else |
|
|
|
|
UBApplication::mainWindow->actionVirtualKeyboard->setChecked(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|