build: Replace WINAPI_CARBON with Q_OS_MAC
This commit is contained in:
parent
e4cf1392c9
commit
12cf55d4fc
6 changed files with 19 additions and 37 deletions
|
|
@ -141,8 +141,6 @@ macro(configure_unix_libs)
|
||||||
${lib_ScreenSaver} ${lib_IOKit} ${lib_ApplicationServices}
|
${lib_ScreenSaver} ${lib_IOKit} ${lib_ApplicationServices}
|
||||||
${lib_Foundation} ${lib_Carbon} ${lib_UserNotifications}
|
${lib_Foundation} ${lib_Carbon} ${lib_UserNotifications}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DWINAPI_CARBON=1)
|
|
||||||
else()
|
else()
|
||||||
|
|
||||||
if (BUILD_X11_SUPPORT)
|
if (BUILD_X11_SUPPORT)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
#if defined(Q_OS_MAC)
|
||||||
#include "platform/OSXCocoaApp.h"
|
#include "platform/OSXCocoaApp.h"
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -151,10 +151,7 @@ void App::handleScreenError() const
|
||||||
void App::runEventsLoop(const void *)
|
void App::runEventsLoop(const void *)
|
||||||
{
|
{
|
||||||
m_events->loop();
|
m_events->loop();
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
#if WINAPI_CARBON
|
|
||||||
|
|
||||||
stopCocoaLoop();
|
stopCocoaLoop();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#include "platform/EiScreen.h"
|
#include "platform/EiScreen.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
#if defined(Q_OS_MAC)
|
||||||
#include "base/TMethodJob.h"
|
#include "base/TMethodJob.h"
|
||||||
#include "mt/Thread.h"
|
#include "mt/Thread.h"
|
||||||
#include "platform/OSXCocoaApp.h"
|
#include "platform/OSXCocoaApp.h"
|
||||||
|
|
@ -112,9 +112,11 @@ deskflow::Screen *ClientApp::createScreen()
|
||||||
),
|
),
|
||||||
getEvents()
|
getEvents()
|
||||||
);
|
);
|
||||||
#endif
|
#elif defined(Q_OS_MAC)
|
||||||
|
return new deskflow::Screen(
|
||||||
#if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI)
|
new OSXScreen(getEvents(), false, Settings::value(Settings::Client::LanguageSync).toBool()), getEvents()
|
||||||
|
);
|
||||||
|
#else
|
||||||
if (deskflow::platform::isWayland()) {
|
if (deskflow::platform::isWayland()) {
|
||||||
#if WINAPI_LIBEI
|
#if WINAPI_LIBEI
|
||||||
LOG_INFO("using ei screen for wayland");
|
LOG_INFO("using ei screen for wayland");
|
||||||
|
|
@ -123,22 +125,14 @@ deskflow::Screen *ClientApp::createScreen()
|
||||||
throw XNoEiSupport();
|
throw XNoEiSupport();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WINAPI_XWINDOWS
|
#if WINAPI_XWINDOWS
|
||||||
LOG_INFO("using legacy x windows screen");
|
LOG_INFO("using legacy x windows screen");
|
||||||
return new deskflow::Screen(
|
return new deskflow::Screen(
|
||||||
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), false, getEvents()),
|
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), false, getEvents()),
|
||||||
getEvents()
|
getEvents()
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
|
||||||
return new deskflow::Screen(
|
|
||||||
new OSXScreen(getEvents(), false, Settings::value(Settings::Client::LanguageSync).toBool()), getEvents()
|
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif // end os check
|
||||||
}
|
}
|
||||||
|
|
||||||
deskflow::Screen *ClientApp::openClientScreen()
|
deskflow::Screen *ClientApp::openClientScreen()
|
||||||
|
|
@ -332,8 +326,7 @@ int ClientApp::mainLoop()
|
||||||
// later. the timer installed by startClient() will take care of
|
// later. the timer installed by startClient() will take care of
|
||||||
// that.
|
// that.
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
#if defined(Q_OS_MAC)
|
||||||
|
|
||||||
Thread thread(new TMethodJob<ClientApp>(this, &ClientApp::runEventsLoop, nullptr));
|
Thread thread(new TMethodJob<ClientApp>(this, &ClientApp::runEventsLoop, nullptr));
|
||||||
|
|
||||||
// wait until carbon loop is ready
|
// wait until carbon loop is ready
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
#include "platform/EiScreen.h"
|
#include "platform/EiScreen.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
#if defined(Q_OS_MAC)
|
||||||
#include "base/TMethodJob.h"
|
#include "base/TMethodJob.h"
|
||||||
#include "mt/Thread.h"
|
#include "mt/Thread.h"
|
||||||
#include "platform/OSXCocoaApp.h"
|
#include "platform/OSXCocoaApp.h"
|
||||||
|
|
@ -396,9 +396,9 @@ deskflow::Screen *ServerApp::createScreen()
|
||||||
return new deskflow::Screen(
|
return new deskflow::Screen(
|
||||||
new MSWindowsScreen(true, Settings::value(Settings::Core::UseHooks).toBool(), getEvents()), getEvents()
|
new MSWindowsScreen(true, Settings::value(Settings::Core::UseHooks).toBool(), getEvents()), getEvents()
|
||||||
);
|
);
|
||||||
#endif
|
#elif defined(Q_OS_MAC)
|
||||||
|
return new deskflow::Screen(new OSXScreen(getEvents(), true), getEvents());
|
||||||
#if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI)
|
#else
|
||||||
if (deskflow::platform::isWayland()) {
|
if (deskflow::platform::isWayland()) {
|
||||||
#if WINAPI_LIBEI
|
#if WINAPI_LIBEI
|
||||||
LOG_INFO("using ei screen for wayland");
|
LOG_INFO("using ei screen for wayland");
|
||||||
|
|
@ -407,17 +407,14 @@ deskflow::Screen *ServerApp::createScreen()
|
||||||
throw XNoEiSupport();
|
throw XNoEiSupport();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WINAPI_XWINDOWS
|
#if WINAPI_XWINDOWS
|
||||||
LOG_INFO("using legacy x windows screen");
|
LOG_INFO("using legacy x windows screen");
|
||||||
return new deskflow::Screen(
|
return new deskflow::Screen(
|
||||||
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), true, getEvents()),
|
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), true, getEvents()),
|
||||||
getEvents()
|
getEvents()
|
||||||
);
|
);
|
||||||
#elif WINAPI_CARBON
|
|
||||||
return new deskflow::Screen(new OSXScreen(getEvents(), true), getEvents());
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif // end os check
|
||||||
}
|
}
|
||||||
|
|
||||||
PrimaryClient *ServerApp::openPrimaryClient(const std::string &name, deskflow::Screen *screen)
|
PrimaryClient *ServerApp::openPrimaryClient(const std::string &name, deskflow::Screen *screen)
|
||||||
|
|
@ -546,7 +543,7 @@ int ServerApp::mainLoop()
|
||||||
// later. the timer installed by startServer() will take care of
|
// later. the timer installed by startServer() will take care of
|
||||||
// that.
|
// that.
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
#if defined(Q_OS_MAC)
|
||||||
|
|
||||||
Thread thread(new TMethodJob<ServerApp>(this, &ServerApp::runEventsLoop, nullptr));
|
Thread thread(new TMethodJob<ServerApp>(this, &ServerApp::runEventsLoop, nullptr));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#if WINAPI_XWINDOWS
|
#if WINAPI_XWINDOWS
|
||||||
#include "deskflow/unix/X11LayoutsParser.h"
|
#include "deskflow/unix/X11LayoutsParser.h"
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#elif WINAPI_CARBON
|
#elif defined(Q_OS_MAC)
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <platform/OSXAutoTypes.h>
|
#include <platform/OSXAutoTypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -50,7 +50,7 @@ std::vector<std::string> AppUtilUnix::getKeyboardLayoutList()
|
||||||
m_evdev = "/usr/share/X11/xkb/rules/evdev.xml";
|
m_evdev = "/usr/share/X11/xkb/rules/evdev.xml";
|
||||||
layoutLangCodes = X11LayoutsParser::getX11LanguageList(m_evdev);
|
layoutLangCodes = X11LayoutsParser::getX11LanguageList(m_evdev);
|
||||||
|
|
||||||
#elif WINAPI_CARBON
|
#elif defined(Q_OS_MAC)
|
||||||
CFStringRef keys[] = {kTISPropertyInputSourceCategory};
|
CFStringRef keys[] = {kTISPropertyInputSourceCategory};
|
||||||
CFStringRef values[] = {kTISCategoryKeyboardInputSource};
|
CFStringRef values[] = {kTISCategoryKeyboardInputSource};
|
||||||
AutoCFDictionary dict(
|
AutoCFDictionary dict(
|
||||||
|
|
@ -134,7 +134,7 @@ std::string AppUtilUnix::getCurrentLanguageCode()
|
||||||
|
|
||||||
result = X11LayoutsParser::convertLayoutToISO(m_evdev, result);
|
result = X11LayoutsParser::convertLayoutToISO(m_evdev, result);
|
||||||
|
|
||||||
#elif WINAPI_CARBON
|
#elif defined(Q_OS_MAC)
|
||||||
auto layoutLanguages =
|
auto layoutLanguages =
|
||||||
(CFArrayRef)TISGetInputSourceProperty(TISCopyCurrentKeyboardInputSource(), kTISPropertyInputSourceLanguages);
|
(CFArrayRef)TISGetInputSourceProperty(TISCopyCurrentKeyboardInputSource(), kTISPropertyInputSourceLanguages);
|
||||||
char temporaryCString[128] = {0};
|
char temporaryCString[128] = {0};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if WINAPI_CARBON
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
@ -13,5 +12,3 @@ using CFDeallocator = decltype(&CFRelease);
|
||||||
using AutoCFArray = std::unique_ptr<const __CFArray, CFDeallocator>;
|
using AutoCFArray = std::unique_ptr<const __CFArray, CFDeallocator>;
|
||||||
using AutoCFDictionary = std::unique_ptr<const __CFDictionary, CFDeallocator>;
|
using AutoCFDictionary = std::unique_ptr<const __CFDictionary, CFDeallocator>;
|
||||||
using AutoTISInputSourceRef = std::unique_ptr<__TISInputSource, CFDeallocator>;
|
using AutoTISInputSourceRef = std::unique_ptr<__TISInputSource, CFDeallocator>;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue