consistency: use _proc everywhere instead of _function or _callback in procedure typedefs. Also remove unused oc_live_resize_callback

This commit is contained in:
Martin Fouilleul 2023-09-14 10:31:12 +02:00
parent 73717b5dd8
commit 0e680c989b
8 changed files with 79 additions and 100 deletions

View File

@ -316,9 +316,6 @@ ORCA_API void oc_set_cursor(oc_mouse_cursor cursor);
ORCA_API void oc_pump_events(f64 timeout); ORCA_API void oc_pump_events(f64 timeout);
ORCA_API oc_event* oc_next_event(oc_arena* arena); ORCA_API oc_event* oc_next_event(oc_arena* arena);
typedef void (*oc_live_resize_callback)(oc_event event, void* data);
ORCA_API void oc_set_live_resize_callback(oc_live_resize_callback callback, void* data);
ORCA_API oc_key_code oc_scancode_to_keycode(oc_scan_code scanCode); ORCA_API oc_key_code oc_scancode_to_keycode(oc_scan_code scanCode);
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View File

@ -73,9 +73,6 @@ typedef struct oc_app
oc_window_data windowPool[OC_APP_MAX_WINDOWS]; oc_window_data windowPool[OC_APP_MAX_WINDOWS];
oc_list windowFreeList; oc_list windowFreeList;
oc_live_resize_callback liveResizeCallback;
void* liveResizeData;
oc_scan_code scanCodes[OC_SCANCODE_COUNT]; // native virtual key code to oc_scan_code oc_scan_code scanCodes[OC_SCANCODE_COUNT]; // native virtual key code to oc_scan_code
oc_key_code keyMap[OC_SCANCODE_COUNT]; // oc_scan_code to oc_key_code, as per current keyboard layout oc_key_code keyMap[OC_SCANCODE_COUNT]; // oc_scan_code to oc_key_code, as per current keyboard layout

View File

@ -687,11 +687,6 @@ void oc_install_keyboard_layout_listener()
event.move.content.w = contentRect.size.width; event.move.content.w = contentRect.size.width;
event.move.content.h = contentRect.size.height; event.move.content.h = contentRect.size.height;
if(oc_appData.liveResizeCallback)
{
oc_appData.liveResizeCallback(event, oc_appData.liveResizeData);
}
//TODO: also ensure we don't overflow the queue during live resize... //TODO: also ensure we don't overflow the queue during live resize...
oc_queue_event(&event); oc_queue_event(&event);
} }
@ -1874,12 +1869,6 @@ void oc_surface_init_for_window(oc_surface_data* surface, oc_window_data* window
// Events handling // Events handling
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void oc_set_live_resize_callback(oc_live_resize_callback callback, void* data)
{
oc_appData.liveResizeCallback = callback;
oc_appData.liveResizeData = data;
}
void oc_pump_events(f64 timeout) void oc_pump_events(f64 timeout)
{ {
@autoreleasepool @autoreleasepool

View File

@ -134,8 +134,6 @@ ORCA_API void oc_surface_send_to_back(oc_surface surface); //DOC: puts surface
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
#if !defined(OC_PLATFORM_ORCA) || !OC_PLATFORM_ORCA #if !defined(OC_PLATFORM_ORCA) || !OC_PLATFORM_ORCA
typedef void (*oc_vsync_callback)(void* data);
ORCA_API void oc_vsync_init(void); ORCA_API void oc_vsync_init(void);
ORCA_API void oc_vsync_wait(oc_window window); ORCA_API void oc_vsync_wait(oc_window window);

View File

@ -12,8 +12,7 @@
#include "util/typedefs.h" #include "util/typedefs.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@ -21,15 +20,15 @@ extern "C"
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
typedef struct oc_base_allocator oc_base_allocator; typedef struct oc_base_allocator oc_base_allocator;
typedef void* (*oc_mem_reserve_function)(oc_base_allocator* context, u64 size); typedef void* (*oc_mem_reserve_proc)(oc_base_allocator* context, u64 size);
typedef void (*oc_mem_modify_function)(oc_base_allocator* context, void* ptr, u64 size); typedef void (*oc_mem_modify_proc)(oc_base_allocator* context, void* ptr, u64 size);
typedef struct oc_base_allocator typedef struct oc_base_allocator
{ {
oc_mem_reserve_function reserve; oc_mem_reserve_proc reserve;
oc_mem_modify_function commit; oc_mem_modify_proc commit;
oc_mem_modify_function decommit; oc_mem_modify_proc decommit;
oc_mem_modify_function release; oc_mem_modify_proc release;
} oc_base_allocator; } oc_base_allocator;

View File

@ -18,8 +18,7 @@
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif // __cplusplus #endif // __cplusplus
//--------------------------------------------------------------- //---------------------------------------------------------------
@ -33,10 +32,10 @@ extern "C"
typedef struct oc_thread oc_thread; typedef struct oc_thread oc_thread;
typedef i32 (*oc_thread_start_function)(void* userPointer); typedef i32 (*oc_thread_start_proc)(void* userPointer);
ORCA_API oc_thread* oc_thread_create(oc_thread_start_function start, void* userPointer); ORCA_API oc_thread* oc_thread_create(oc_thread_start_proc start, void* userPointer);
ORCA_API oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* userPointer, oc_str8 name); ORCA_API oc_thread* oc_thread_create_with_name(oc_thread_start_proc start, void* userPointer, oc_str8 name);
ORCA_API oc_str8 oc_thread_get_name(oc_thread* thread); ORCA_API oc_str8 oc_thread_get_name(oc_thread* thread);
ORCA_API u64 oc_thread_unique_id(oc_thread* thread); ORCA_API u64 oc_thread_unique_id(oc_thread* thread);
ORCA_API u64 oc_thread_self_id(); ORCA_API u64 oc_thread_self_id();

View File

@ -18,7 +18,7 @@ struct oc_thread
{ {
bool valid; bool valid;
pthread_t pthread; pthread_t pthread;
oc_thread_start_function start; oc_thread_start_proc start;
void* userPointer; void* userPointer;
oc_str8 name; oc_str8 name;
char nameBuffer[OC_THREAD_NAME_MAX_SIZE]; char nameBuffer[OC_THREAD_NAME_MAX_SIZE];
@ -35,7 +35,7 @@ static void* oc_thread_bootstrap(void* data)
return ((void*)(ptrdiff_t)exitCode); return ((void*)(ptrdiff_t)exitCode);
} }
oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* userPointer, oc_str8 name) oc_thread* oc_thread_create_with_name(oc_thread_start_proc start, void* userPointer, oc_str8 name)
{ {
oc_thread* thread = (oc_thread*)malloc(sizeof(oc_thread)); oc_thread* thread = (oc_thread*)malloc(sizeof(oc_thread));
if(!thread) if(!thread)
@ -69,7 +69,7 @@ oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* user
} }
} }
oc_thread* oc_thread_create(oc_thread_start_function start, void* userPointer) oc_thread* oc_thread_create(oc_thread_start_proc start, void* userPointer)
{ {
return (oc_thread_create_with_name(start, userPointer, (oc_str8){ 0 })); return (oc_thread_create_with_name(start, userPointer, (oc_str8){ 0 }));
} }

View File

@ -14,7 +14,7 @@
struct oc_thread struct oc_thread
{ {
oc_thread_start_function start; oc_thread_start_proc start;
HANDLE handle; HANDLE handle;
DWORD threadId; DWORD threadId;
void* userPointer; void* userPointer;
@ -29,7 +29,7 @@ static DWORD WINAPI oc_thread_bootstrap(LPVOID lpParameter)
return (exitCode); return (exitCode);
} }
oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* userPointer, oc_str8 name) oc_thread* oc_thread_create_with_name(oc_thread_start_proc start, void* userPointer, oc_str8 name)
{ {
oc_thread* thread = (oc_thread*)malloc(sizeof(oc_thread)); oc_thread* thread = (oc_thread*)malloc(sizeof(oc_thread));
thread->start = start; thread->start = start;
@ -75,7 +75,7 @@ oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* user
return (thread); return (thread);
} }
oc_thread* oc_thread_create(oc_thread_start_function start, void* userPointer) oc_thread* oc_thread_create(oc_thread_start_proc start, void* userPointer)
{ {
return (oc_thread_create_with_name(start, userPointer, (oc_str8){ 0 })); return (oc_thread_create_with_name(start, userPointer, (oc_str8){ 0 }));
} }