build: Replace WINAPI_CARBON with Q_OS_MAC

This commit is contained in:
sithlord48
2026-02-27 23:08:49 -05:00
committed by Chris Rizzitello
parent e4cf1392c9
commit 12cf55d4fc
6 changed files with 19 additions and 37 deletions

View File

@ -141,8 +141,6 @@ macro(configure_unix_libs)
${lib_ScreenSaver} ${lib_IOKit} ${lib_ApplicationServices}
${lib_Foundation} ${lib_Carbon} ${lib_UserNotifications}
)
add_definitions(-DWINAPI_CARBON=1)
else()
if (BUILD_X11_SUPPORT)

View File

@ -22,7 +22,7 @@
#include <stdexcept>
#if WINAPI_CARBON
#if defined(Q_OS_MAC)
#include "platform/OSXCocoaApp.h"
#include <ApplicationServices/ApplicationServices.h>
#endif
@ -151,10 +151,7 @@ void App::handleScreenError() const
void App::runEventsLoop(const void *)
{
m_events->loop();
#if WINAPI_CARBON
#if defined(Q_OS_MAC)
stopCocoaLoop();
#endif
}

View File

@ -36,7 +36,7 @@
#include "platform/EiScreen.h"
#endif
#if WINAPI_CARBON
#if defined(Q_OS_MAC)
#include "base/TMethodJob.h"
#include "mt/Thread.h"
#include "platform/OSXCocoaApp.h"
@ -112,9 +112,11 @@ deskflow::Screen *ClientApp::createScreen()
),
getEvents()
);
#endif
#if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI)
#elif defined(Q_OS_MAC)
return new deskflow::Screen(
new OSXScreen(getEvents(), false, Settings::value(Settings::Client::LanguageSync).toBool()), getEvents()
);
#else
if (deskflow::platform::isWayland()) {
#if WINAPI_LIBEI
LOG_INFO("using ei screen for wayland");
@ -123,22 +125,14 @@ deskflow::Screen *ClientApp::createScreen()
throw XNoEiSupport();
#endif
}
#endif
#if WINAPI_XWINDOWS
LOG_INFO("using legacy x windows screen");
return new deskflow::Screen(
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), false, getEvents()),
getEvents()
);
#endif
#if WINAPI_CARBON
return new deskflow::Screen(
new OSXScreen(getEvents(), false, Settings::value(Settings::Client::LanguageSync).toBool()), getEvents()
);
#endif
#endif // end os check
}
deskflow::Screen *ClientApp::openClientScreen()
@ -332,8 +326,7 @@ int ClientApp::mainLoop()
// later. the timer installed by startClient() will take care of
// that.
#if WINAPI_CARBON
#if defined(Q_OS_MAC)
Thread thread(new TMethodJob<ClientApp>(this, &ClientApp::runEventsLoop, nullptr));
// wait until carbon loop is ready

View File

@ -42,7 +42,7 @@
#include "platform/EiScreen.h"
#endif
#if WINAPI_CARBON
#if defined(Q_OS_MAC)
#include "base/TMethodJob.h"
#include "mt/Thread.h"
#include "platform/OSXCocoaApp.h"
@ -396,9 +396,9 @@ deskflow::Screen *ServerApp::createScreen()
return new deskflow::Screen(
new MSWindowsScreen(true, Settings::value(Settings::Core::UseHooks).toBool(), getEvents()), getEvents()
);
#endif
#if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI)
#elif defined(Q_OS_MAC)
return new deskflow::Screen(new OSXScreen(getEvents(), true), getEvents());
#else
if (deskflow::platform::isWayland()) {
#if WINAPI_LIBEI
LOG_INFO("using ei screen for wayland");
@ -407,17 +407,14 @@ deskflow::Screen *ServerApp::createScreen()
throw XNoEiSupport();
#endif
}
#endif
#if WINAPI_XWINDOWS
LOG_INFO("using legacy x windows screen");
return new deskflow::Screen(
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), true, getEvents()),
getEvents()
);
#elif WINAPI_CARBON
return new deskflow::Screen(new OSXScreen(getEvents(), true), getEvents());
#endif
#endif // end os check
}
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
// that.
#if WINAPI_CARBON
#if defined(Q_OS_MAC)
Thread thread(new TMethodJob<ServerApp>(this, &ServerApp::runEventsLoop, nullptr));

View File

@ -12,7 +12,7 @@
#if WINAPI_XWINDOWS
#include "deskflow/unix/X11LayoutsParser.h"
#include <X11/XKBlib.h>
#elif WINAPI_CARBON
#elif defined(Q_OS_MAC)
#include <Carbon/Carbon.h>
#include <platform/OSXAutoTypes.h>
#endif
@ -50,7 +50,7 @@ std::vector<std::string> AppUtilUnix::getKeyboardLayoutList()
m_evdev = "/usr/share/X11/xkb/rules/evdev.xml";
layoutLangCodes = X11LayoutsParser::getX11LanguageList(m_evdev);
#elif WINAPI_CARBON
#elif defined(Q_OS_MAC)
CFStringRef keys[] = {kTISPropertyInputSourceCategory};
CFStringRef values[] = {kTISCategoryKeyboardInputSource};
AutoCFDictionary dict(
@ -134,7 +134,7 @@ std::string AppUtilUnix::getCurrentLanguageCode()
result = X11LayoutsParser::convertLayoutToISO(m_evdev, result);
#elif WINAPI_CARBON
#elif defined(Q_OS_MAC)
auto layoutLanguages =
(CFArrayRef)TISGetInputSourceProperty(TISCopyCurrentKeyboardInputSource(), kTISPropertyInputSourceLanguages);
char temporaryCString[128] = {0};

View File

@ -5,7 +5,6 @@
*/
#pragma once
#if WINAPI_CARBON
#include <Carbon/Carbon.h>
#include <memory>
@ -13,5 +12,3 @@ using CFDeallocator = decltype(&CFRelease);
using AutoCFArray = std::unique_ptr<const __CFArray, CFDeallocator>;
using AutoCFDictionary = std::unique_ptr<const __CFDictionary, CFDeallocator>;
using AutoTISInputSourceRef = std::unique_ptr<__TISInputSource, CFDeallocator>;
#endif