diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index b11114cf..0354e254 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -89,15 +89,6 @@ #include "core/memcheck.h" -#ifdef Q_OS_LINUX -#include -bool onboardIsAlreadyRunning = true; -#endif - -#ifdef Q_OS_OSX -#include -#endif - UBBoardController::UBBoardController(UBMainWindow* mainWindow) : UBDocumentContainer(mainWindow->centralWidget()) , mMainWindow(mainWindow) @@ -172,12 +163,6 @@ void UBBoardController::init() UBBoardController::~UBBoardController() { -#ifdef Q_OS_LINUX - if(!onboardIsAlreadyRunning){ - QProcess newProcess; - newProcess.startDetached("killall onboard"); - } -#endif delete mDisplayView; } @@ -836,36 +821,11 @@ void UBBoardController::showKeyboard(bool show) if(show) UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); -#ifdef Q_OS_LINUX - static bool isFirstTime = true; - if(isFirstTime){ - QProcess isAlreadyRunningProcess; - QString psAuxGrepC = "ps aux"; - isAlreadyRunningProcess.start(psAuxGrepC); - isAlreadyRunningProcess.waitForFinished(); - QString output(isAlreadyRunningProcess.readAll()); - if(output.count("onboard") != 0) - onboardIsAlreadyRunning = true; - else - onboardIsAlreadyRunning = false; - - isFirstTime = false; - } - if(UBSettings::settings()->useSystemOnScreenKeybard->get().toBool()){ - QProcess newProcess; - newProcess.startDetached("/usr/bin/onboard"); - } + if(UBSettings::settings()->useSystemOnScreenKeybard->get().toBool()) + UBPlatformUtils::showOSK(show); else mPaletteManager->showVirtualKeyboard(show); -#elif defined(Q_OS_OSX) - if(UBSettings::settings()->useSystemOnScreenKeybard->get().toBool()) - UBPlatformUtils::showOSK(); - -#else - mPaletteManager->showVirtualKeyboard(show); -#endif - } diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index 368ae84a..af5578de 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -30,6 +30,7 @@ #include #include +#include class QMainWindow; @@ -205,10 +206,10 @@ public: static QStringList availableTranslations(); static void setFrontProcess(); static void showFullScreen(QWidget * pWidget); + static void showOSK(bool show); #ifdef Q_OS_OSX static void SetMacLocaleByIdentifier(const QString& id); - static void showOSK(); #endif }; diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index d4b4f690..e74bc76f 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -440,3 +440,10 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget) pWidget->showFullScreen(); } +void UBPlatformUtils::showOSK(bool show) +{ + if (show) { + QProcess newProcess; + newProcess.startDetached("/usr/bin/env onboard"); + } +} diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index a9bbbe57..ef946428 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -610,15 +610,19 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget) } -void UBPlatformUtils::showOSK() +void UBPlatformUtils::showOSK(bool show) { - [[NSAutoreleasePool alloc] init]; + // TODO: enable hiding OSK - CFDictionaryRef properties = - (CFDictionaryRef)[NSDictionary - dictionaryWithObject: @"com.apple.KeyboardViewer" - forKey: (NSString *)kTISPropertyInputSourceID]; - NSArray *sources = (NSArray *)TISCreateInputSourceList(properties, false); + if (show) { + [[NSAutoreleasePool alloc] init]; - TISSelectInputSource((TISInputSourceRef)[sources objectAtIndex: 0]); + CFDictionaryRef properties = + (CFDictionaryRef)[NSDictionary + dictionaryWithObject: @"com.apple.KeyboardViewer" + forKey: (NSString *)kTISPropertyInputSourceID]; + NSArray *sources = (NSArray *)TISCreateInputSourceList(properties, false); + + TISSelectInputSource((TISInputSourceRef)[sources objectAtIndex: 0]); + } } diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index b4f25c67..07dfc348 100644 --- a/src/frameworks/UBPlatformUtils_win.cpp +++ b/src/frameworks/UBPlatformUtils_win.cpp @@ -436,3 +436,9 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget) { pWidget->showFullScreen(); } + +void UBPlatformUtils::showOSK(bool show) +{ + Q_UNUSED(show); + // No system OSK support yet +}