Merge pull request #1593 from Lazerbeak12345/move-carbon-events-core-stubs

fix(Carbon): move carbon events core stubs
This commit is contained in:
CuriousTommy 2025-05-23 15:22:25 -07:00 committed by GitHub
commit 994ad6e481
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 116 additions and 86 deletions

View File

@ -20,6 +20,7 @@ add_framework(HIToolbox
SOURCES
src/Keyboards.cpp
src/Events.cpp
src/CarbonEventsCore.c
src/MacWindows.cpp
src/TextInputSources.mm
src/IBCarbonRuntime.c

View File

@ -40,21 +40,21 @@ typedef UInt32 KeyMap[4];
OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b);
OSStatus CreateEvent(CFAllocatorRef a, UInt32 b, UInt32 c, EventTime d, EventAttributes e, EventRef * f);
UInt32 GetEventClass(EventRef a);
OSStatus CreateEvent(CFAllocatorRef a, OSType b, UInt32 c, EventTime d, EventAttributes e, EventRef* f);
OSType GetEventClass(EventRef a);
UInt32 GetEventKind(EventRef a);
OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType * d, UInt32 e, UInt32 * f, void * g);
OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType* d, ByteCount e, ByteCount* f, void* g);
OSStatus GetMainEventQueue();
OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, UInt32 c, const EventTypeSpec * d, void * e, EventHandlerRef * f);
EventQueueRef GetMainEventQueue();
OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, ItemCount c, const EventTypeSpec* d, void* e, EventHandlerRef* f);
EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a);
EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a);
OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c);
OSStatus ReceiveNextEvent(UInt32 a, const EventTypeSpec * b, EventTimeout c, Boolean d, EventRef * e);
OSStatus ReceiveNextEvent(ItemCount a, const EventTypeSpec* b, EventTimeout c, Boolean d, EventRef* e);
OSStatus ReleaseEvent(EventRef a);
void ReleaseEvent(EventRef a);
OSStatus RemoveEventHandler(EventHandlerRef a);
OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b);

View File

@ -0,0 +1,107 @@
/*
This file is part of Darling.
Copyright (C) 2025 Lubos Dolezel
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <HIToolbox/CarbonEventsCore.h>
#include <stdlib.h>
#include <stdio.h>
static int verbose = 0;
__attribute__((constructor))
static void initme(void) {
verbose = getenv("STUB_VERBOSE") != NULL;
}
OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b)
{
if (verbose) puts("STUB: CallNextEventHandler called");
return 0;
}
OSStatus CreateEvent(CFAllocatorRef a, OSType b, UInt32 c, EventTime d, EventAttributes e, EventRef* f)
{
if (verbose) puts("STUB: CreateEvent called");
return 0;
}
OSType GetEventClass(EventRef a)
{
if (verbose) puts("STUB: GetEventClass called");
return 0;
}
UInt32 GetEventKind(EventRef a)
{
if (verbose) puts("STUB: GetEventKind called");
return 0;
}
OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType* d, ByteCount e, ByteCount* f, void* g)
{
if (verbose) puts("STUB: GetEventParameter called");
return 0;
}
EventQueueRef GetMainEventQueue()
{
if (verbose) puts("STUB: GetMainEventQueue called");
return 0;
}
OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, ItemCount c, const EventTypeSpec* d, void* e, EventHandlerRef* f)
{
if (verbose) puts("STUB: InstallEventHandler called");
return 0;
}
EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a)
{
if (verbose) puts("STUB: NewEventHandlerUPP called");
return (EventHandlerUPP)0;
}
OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c)
{
if (verbose) puts("STUB: PostEventToQueue called");
return 0;
}
OSStatus ReceiveNextEvent(ItemCount a, const EventTypeSpec* b, EventTimeout c, Boolean d, EventRef* e)
{
if (verbose) puts("STUB: ReceiveNextEvent called");
return 0;
}
void ReleaseEvent(EventRef a)
{
if (verbose) puts("STUB: ReleaseEvent called");
}
OSStatus RemoveEventHandler(EventHandlerRef a)
{
if (verbose) puts("STUB: RemoveEventHandler called");
return 0;
}
OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b)
{
if (verbose) puts("STUB: SendEventToEventTarget called");
return 0;
}

View File

@ -45,18 +45,6 @@ OSErr DeactivateTSMDocument(TSMDocumentID a)
return 0;
}
OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b)
{
if (verbose) puts("STUB: CallNextEventHandler called");
return 0;
}
OSStatus CreateEvent(CFAllocatorRef a, UInt32 b, UInt32 c, EventTime d, EventAttributes e, EventRef * f)
{
if (verbose) puts("STUB: CreateEvent called");
return 0;
}
OSStatus CreateStandardAlert(AlertType a, CFStringRef b, CFStringRef c, const AlertStdCFStringAlertParamRec * d, DialogRef * e)
{
if (verbose) puts("STUB: CreateStandardAlert called");
@ -80,36 +68,12 @@ EventTargetRef GetApplicationEventTarget(void)
return (EventTargetRef)0;
}
UInt32 GetEventClass(EventRef a)
{
if (verbose) puts("STUB: GetEventClass called");
return 0;
}
OSStatus GetEventDispatcherTarget()
{
if (verbose) puts("STUB: GetEventDispatcherTarget called");
return 0;
}
UInt32 GetEventKind(EventRef a)
{
if (verbose) puts("STUB: GetEventKind called");
return 0;
}
OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType * d, UInt32 e, UInt32 * f, void * g)
{
if (verbose) puts("STUB: GetEventParameter called");
return 0;
}
OSStatus GetMainEventQueue()
{
if (verbose) puts("STUB: GetMainEventQueue called");
return 0;
}
OSStatus GetScrapByName(CFStringRef a, OptionBits b, ScrapRef * c)
{
if (verbose) puts("STUB: GetScrapByName called");
@ -140,36 +104,18 @@ void HideMenuBar(void)
}
OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, UInt32 c, const EventTypeSpec * d, void * e, EventHandlerRef * f)
{
if (verbose) puts("STUB: InstallEventHandler called");
return 0;
}
OSErr NMInstall(NMRecPtr a)
{
if (verbose) puts("STUB: NMInstall called");
return 0;
}
EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a)
{
if (verbose) puts("STUB: NewEventHandlerUPP called");
return (EventHandlerUPP)0;
}
OSErr NewTSMDocument(short a, InterfaceTypeList b, TSMDocumentID * c, long d)
{
if (verbose) puts("STUB: NewTSMDocument called");
return 0;
}
OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c)
{
if (verbose) puts("STUB: PostEventToQueue called");
return 0;
}
OSStatus ProcessHICommand(const HICommand * a)
{
if (verbose) puts("STUB: ProcessHICommand called");
@ -182,24 +128,6 @@ OSStatus PutScrapFlavor(ScrapRef a, ScrapFlavorType b, ScrapFlavorFlags c, Size
return 0;
}
OSStatus ReceiveNextEvent(UInt32 a, const EventTypeSpec * b, EventTimeout c, Boolean d, EventRef * e)
{
if (verbose) puts("STUB: ReceiveNextEvent called");
return 0;
}
OSStatus ReleaseEvent(EventRef a)
{
if (verbose) puts("STUB: ReleaseEvent called");
return 0;
}
OSStatus RemoveEventHandler(EventHandlerRef a)
{
if (verbose) puts("STUB: RemoveEventHandler called");
return 0;
}
void RunApplicationEventLoop(void)
{
if (verbose) puts("STUB: RunApplicationEventLoop called");
@ -212,12 +140,6 @@ OSStatus RunStandardAlert(DialogRef a, ModalFilterUPP b, DialogItemIndex * c)
return 0;
}
OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b)
{
if (verbose) puts("STUB: SendEventToEventTarget called");
return 0;
}
OSStatus SetEventMask(EventMask a)
{
if (verbose) puts("STUB: SetEventMask called");