Added support for OSX on-screen keyboard

preferencesAboutTextFull
Craig Watson 9 years ago
parent 54214f93f0
commit 6f044afc49
  1. 9
      src/board/UBBoardController.cpp
  2. 1
      src/frameworks/UBPlatformUtils.h
  3. 13
      src/frameworks/UBPlatformUtils_mac.mm

@ -94,6 +94,10 @@
bool onboardIsAlreadyRunning = true; bool onboardIsAlreadyRunning = true;
#endif #endif
#ifdef Q_OS_OSX
#include <QProcess>
#endif
UBBoardController::UBBoardController(UBMainWindow* mainWindow) UBBoardController::UBBoardController(UBMainWindow* mainWindow)
: UBDocumentContainer(mainWindow->centralWidget()) : UBDocumentContainer(mainWindow->centralWidget())
, mMainWindow(mainWindow) , mMainWindow(mainWindow)
@ -853,6 +857,11 @@ void UBBoardController::showKeyboard(bool show)
} }
else else
mPaletteManager->showVirtualKeyboard(show); mPaletteManager->showVirtualKeyboard(show);
#elif defined(Q_OS_OSX)
if(UBSettings::settings()->useSystemOnScreenKeybard->get().toBool())
UBPlatformUtils::showOSK();
#else #else
mPaletteManager->showVirtualKeyboard(show); mPaletteManager->showVirtualKeyboard(show);
#endif #endif

@ -208,6 +208,7 @@ public:
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
static void SetMacLocaleByIdentifier(const QString& id); static void SetMacLocaleByIdentifier(const QString& id);
static void showOSK();
#endif #endif
}; };

@ -609,3 +609,16 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget)
} }
void UBPlatformUtils::showOSK()
{
[[NSAutoreleasePool alloc] init];
CFDictionaryRef properties =
(CFDictionaryRef)[NSDictionary
dictionaryWithObject: @"com.apple.KeyboardViewer"
forKey: (NSString *)kTISPropertyInputSourceID];
NSArray *sources = (NSArray *)TISCreateInputSourceList(properties, false);
TISSelectInputSource((TISInputSourceRef)[sources objectAtIndex: 0]);
}

Loading…
Cancel
Save