Started a new Haiku port.
This commit is contained in:
parent
a8d082fa79
commit
d0edd9e738
|
@ -0,0 +1,53 @@
|
||||||
|
// 12 january 2020
|
||||||
|
#include "uipriv_haiku.hpp"
|
||||||
|
|
||||||
|
uiprivApplication *uiprivApp;
|
||||||
|
|
||||||
|
// TODO add format string warning detection to all these functions, where available
|
||||||
|
// TODO also see if we can convert this to a string, or use a known type for status_t instead of assuming it's int(32_t)
|
||||||
|
#define uiprivInitReturnStatus(err, msg, status) uiprivInitReturnErrorf(err, "%s: %d", msg, status)
|
||||||
|
|
||||||
|
static thread_id mainThread;
|
||||||
|
|
||||||
|
bool uiprivSysInit(void *options, uiInitError *err)
|
||||||
|
{
|
||||||
|
status_t status;
|
||||||
|
|
||||||
|
uiprivApp = new uiprivApplication("application/libui.TODO", &status);
|
||||||
|
if (status != B_OK)
|
||||||
|
return uiprivInitReturnStatus(err, "error creating BApplication", status);
|
||||||
|
mainThread = find_thread(NULL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiMain(void)
|
||||||
|
{
|
||||||
|
if (!uiprivCheckInitializedAndThread())
|
||||||
|
return;
|
||||||
|
uiprivApp->Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO if this is called beofre uiMain(), uiprivApp will be deleted; either ban doing this outright or catch this scenario
|
||||||
|
void uiQuit(void)
|
||||||
|
{
|
||||||
|
if (!uiprivCheckInitializedAndThread())
|
||||||
|
return;
|
||||||
|
uiprivApp->Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiprivSysQueueMain(void (*f)(void *data), void *data)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
bool uiprivSysCheckThread(void)
|
||||||
|
{
|
||||||
|
return find_thread(NULL) == mainThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiprivReportError(const char *prefix, const char *msg, const char *suffix, bool internal)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "*** %s: %s. %s\n", prefix, msg, suffix);
|
||||||
|
debugger("TODO");
|
||||||
|
abort(); // we shouldn't reach here
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
# 12 january 2020
|
||||||
|
|
||||||
|
libui_sources += [
|
||||||
|
'haiku/main.cpp',
|
||||||
|
]
|
||||||
|
|
||||||
|
libui_deps += [
|
||||||
|
meson.get_compiler('cpp').find_library('root',
|
||||||
|
required: true),
|
||||||
|
meson.get_compiler('cpp').find_library('be',
|
||||||
|
required: true),
|
||||||
|
]
|
|
@ -0,0 +1,12 @@
|
||||||
|
// 12 january 2020
|
||||||
|
#include <os/AppKit.h>
|
||||||
|
#include <os/InterfaceKit.h>
|
||||||
|
#include <os/KernelKit.h>
|
||||||
|
#include <os/SupportKit.h>
|
||||||
|
#define uiprivOSHeader "../ui_haiku.h"
|
||||||
|
#include "../common/uipriv.h"
|
||||||
|
|
||||||
|
// main.cpp
|
||||||
|
class uiprivApplication : public BApplication {
|
||||||
|
};
|
||||||
|
extern uiprivApplication *uiprivApp;
|
|
@ -152,6 +152,9 @@ if libui_OS == 'windows'
|
||||||
elif libui_OS == 'darwin'
|
elif libui_OS == 'darwin'
|
||||||
subdir('darwin')
|
subdir('darwin')
|
||||||
install_headers('ui_darwin.h')
|
install_headers('ui_darwin.h')
|
||||||
|
elif libui_OS == 'haiku'
|
||||||
|
subdir('haiku')
|
||||||
|
install_headers('ui_haiku.h')
|
||||||
else
|
else
|
||||||
subdir('unix')
|
subdir('unix')
|
||||||
install_headers('ui_unix.h')
|
install_headers('ui_unix.h')
|
||||||
|
|
|
@ -11,7 +11,7 @@ if libui_OS == 'windows'
|
||||||
'lib/thread_windows.c',
|
'lib/thread_windows.c',
|
||||||
'lib/timer_windows.c',
|
'lib/timer_windows.c',
|
||||||
]
|
]
|
||||||
else
|
else # including Haiku, since it's POSIX-compliant
|
||||||
libui_test_sources += [
|
libui_test_sources += [
|
||||||
'lib/thread_darwinunix.c',
|
'lib/thread_darwinunix.c',
|
||||||
'lib/timer_darwinunix.c'
|
'lib/timer_darwinunix.c'
|
||||||
|
|
|
@ -21,6 +21,8 @@ elif libui_OS == 'darwin'
|
||||||
'controls_darwin.m',
|
'controls_darwin.m',
|
||||||
'controls_darwin_errors.m',
|
'controls_darwin_errors.m',
|
||||||
]
|
]
|
||||||
|
elif libui_OS == 'haiku'
|
||||||
|
# TODO
|
||||||
else
|
else
|
||||||
libui_test_sources += [
|
libui_test_sources += [
|
||||||
'controls_unix.c',
|
'controls_unix.c',
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
// 12 january 2020
|
||||||
|
|
||||||
|
/*
|
||||||
|
This file assumes that you have included TODO_insert_appropriate_Haiku_headers and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls in Windows.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef uiprivIncludeGuard_ui_haiku_h
|
||||||
|
#define uiprivIncludeGuard_ui_haiku_h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct uiControlOSVtable {
|
||||||
|
size_t Size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue