Filled up more of the Haiku port, enough to build the library itself.
This commit is contained in:
parent
0748d05a19
commit
4c33e0fb83
|
@ -0,0 +1,20 @@
|
||||||
|
// 18 january 2020
|
||||||
|
#include "uipriv_haiku.hpp"
|
||||||
|
|
||||||
|
bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func)
|
||||||
|
{
|
||||||
|
if (osVtable->Size != sizeof (uiControlOSVtable)) {
|
||||||
|
uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable)
|
||||||
|
{
|
||||||
|
uiControlOSVtable *v2;
|
||||||
|
|
||||||
|
v2 = uiprivNew(uiControlOSVtable);
|
||||||
|
*v2 = *osVtable;
|
||||||
|
return v2;
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ uiprivApplication *uiprivApp;
|
||||||
|
|
||||||
// TODO add format string warning detection to all these functions, where available
|
// 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)
|
// 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)
|
#define uiprivInitReturnStatus(err, msg, status) uiprivInitReturnErrorf(err, "%s: %ld", msg, status)
|
||||||
|
|
||||||
static thread_id mainThread;
|
static thread_id mainThread;
|
||||||
|
|
||||||
|
@ -35,9 +35,49 @@ void uiQuit(void)
|
||||||
uiprivApp->Quit();
|
uiprivApp->Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct queueMainArgs {
|
||||||
|
void (*f)(void *data);
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
void uiprivApplication::MessageReceived(BMessage *msg)
|
||||||
|
{
|
||||||
|
const void *data;
|
||||||
|
const struct queueMainArgs *args;
|
||||||
|
ssize_t size;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
|
switch (msg->what) {
|
||||||
|
case uiprivMsgQueueMain:
|
||||||
|
status = msg->FindData("args", B_ANY_TYPE,
|
||||||
|
&data, &size);
|
||||||
|
if (status != B_OK)
|
||||||
|
uiprivInternalError("BMessage::FindData() failed in uiprivApplication::MessageReceived() for uiQueueMain(): %ld", status);
|
||||||
|
args = (const struct queueMainArgs *) data;
|
||||||
|
(*(args->f))(args->data);
|
||||||
|
delete msg;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BApplication::MessageReceived(msg);
|
||||||
|
}
|
||||||
|
|
||||||
void uiprivSysQueueMain(void (*f)(void *data), void *data)
|
void uiprivSysQueueMain(void (*f)(void *data), void *data)
|
||||||
{
|
{
|
||||||
// TODO
|
BMessage *msg;
|
||||||
|
struct queueMainArgs args;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
|
args.f = f;
|
||||||
|
args.data = data;
|
||||||
|
msg = new BMessage(uiprivMsgQueueMain);
|
||||||
|
status = msg->AddData("args", B_RAW_TYPE,
|
||||||
|
&args, sizeof (struct queueMainArgs), true, 1);
|
||||||
|
if (status != B_OK)
|
||||||
|
// TODO decide if we should just give up in this case like we do with user errors
|
||||||
|
uiprivInternalError("BMessage::AddData() failed in uiQueueMain(): %ld", status);
|
||||||
|
status = uiprivApp->PostMessage(msg);
|
||||||
|
if (status != B_OK)
|
||||||
|
uiprivInternalError("BApplication::PostMessage() failed in uiQueueMain(): %ld", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uiprivSysCheckThread(void)
|
bool uiprivSysCheckThread(void)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# 12 january 2020
|
# 12 january 2020
|
||||||
|
|
||||||
libui_sources += [
|
libui_sources += [
|
||||||
|
'haiku/controls.cpp',
|
||||||
'haiku/main.cpp',
|
'haiku/main.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,12 @@
|
||||||
#define uiprivOSHeader "../ui_haiku.h"
|
#define uiprivOSHeader "../ui_haiku.h"
|
||||||
#include "../common/uipriv.h"
|
#include "../common/uipriv.h"
|
||||||
|
|
||||||
|
constexpr uint32 uiprivMsgQueueMain = 'uiQM';
|
||||||
|
|
||||||
// main.cpp
|
// main.cpp
|
||||||
class uiprivApplication : public BApplication {
|
class uiprivApplication : public BApplication {
|
||||||
|
public:
|
||||||
|
using BApplication::BApplication;
|
||||||
|
virtual void MessageReceived(BMessage *msg) override;
|
||||||
};
|
};
|
||||||
extern uiprivApplication *uiprivApp;
|
extern uiprivApplication *uiprivApp;
|
||||||
|
|
Loading…
Reference in New Issue