From 12cf55d4fc9da34da8138a89fa10b899ebb9e3f5 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 27 Feb 2026 23:08:49 -0500 Subject: [PATCH] build: Replace WINAPI_CARBON with Q_OS_MAC --- cmake/Libraries.cmake | 2 -- src/lib/deskflow/App.cpp | 7 ++----- src/lib/deskflow/ClientApp.cpp | 23 ++++++++--------------- src/lib/deskflow/ServerApp.cpp | 15 ++++++--------- src/lib/deskflow/unix/AppUtilUnix.cpp | 6 +++--- src/lib/platform/OSXAutoTypes.h | 3 --- 6 files changed, 19 insertions(+), 37 deletions(-) diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index d97c46ca2..8d79e6898 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -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) diff --git a/src/lib/deskflow/App.cpp b/src/lib/deskflow/App.cpp index dd5a89c13..454896067 100644 --- a/src/lib/deskflow/App.cpp +++ b/src/lib/deskflow/App.cpp @@ -22,7 +22,7 @@ #include -#if WINAPI_CARBON +#if defined(Q_OS_MAC) #include "platform/OSXCocoaApp.h" #include #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 } diff --git a/src/lib/deskflow/ClientApp.cpp b/src/lib/deskflow/ClientApp.cpp index 1262f3123..250b313db 100644 --- a/src/lib/deskflow/ClientApp.cpp +++ b/src/lib/deskflow/ClientApp.cpp @@ -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(this, &ClientApp::runEventsLoop, nullptr)); // wait until carbon loop is ready diff --git a/src/lib/deskflow/ServerApp.cpp b/src/lib/deskflow/ServerApp.cpp index af4f15ccc..33d044f52 100644 --- a/src/lib/deskflow/ServerApp.cpp +++ b/src/lib/deskflow/ServerApp.cpp @@ -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(this, &ServerApp::runEventsLoop, nullptr)); diff --git a/src/lib/deskflow/unix/AppUtilUnix.cpp b/src/lib/deskflow/unix/AppUtilUnix.cpp index 226a18d0e..3a21aae63 100644 --- a/src/lib/deskflow/unix/AppUtilUnix.cpp +++ b/src/lib/deskflow/unix/AppUtilUnix.cpp @@ -12,7 +12,7 @@ #if WINAPI_XWINDOWS #include "deskflow/unix/X11LayoutsParser.h" #include -#elif WINAPI_CARBON +#elif defined(Q_OS_MAC) #include #include #endif @@ -50,7 +50,7 @@ std::vector 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}; diff --git a/src/lib/platform/OSXAutoTypes.h b/src/lib/platform/OSXAutoTypes.h index d730e18a8..2de172d5e 100644 --- a/src/lib/platform/OSXAutoTypes.h +++ b/src/lib/platform/OSXAutoTypes.h @@ -5,7 +5,6 @@ */ #pragma once -#if WINAPI_CARBON #include #include @@ -13,5 +12,3 @@ using CFDeallocator = decltype(&CFRelease); using AutoCFArray = std::unique_ptr; using AutoCFDictionary = std::unique_ptr; using AutoTISInputSourceRef = std::unique_ptr<__TISInputSource, CFDeallocator>; - -#endif