Fixed most of the various bugs preventing this libui from working. Woo! It even works from Go!
This commit is contained in:
parent
c529ba86cf
commit
6e88ab611a
|
@ -92,6 +92,7 @@ void uiUninit(void)
|
||||||
{
|
{
|
||||||
uninitWPF();
|
uninitWPF();
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
uninitTypes();
|
||||||
uninitAlloc();
|
uninitAlloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,12 @@ using namespace System::Runtime::InteropServices;
|
||||||
String ^fromUTF8(const char *str)
|
String ^fromUTF8(const char *str)
|
||||||
{
|
{
|
||||||
array<Byte> ^bytes;
|
array<Byte> ^bytes;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
len = strlen(str);
|
||||||
|
bytes = gcnew array<Byte>(len);
|
||||||
// TODO avoid the cast
|
// TODO avoid the cast
|
||||||
Marshal::Copy(IntPtr((char *) str), bytes, 0, strlen(str));
|
Marshal::Copy(IntPtr((char *) str), bytes, 0, len);
|
||||||
return Encoding::UTF8->GetString(bytes);
|
return Encoding::UTF8->GetString(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,11 @@ uiWindowsDefineControlWithOnDestroy(
|
||||||
|
|
||||||
void libuiWindow::onClosing(Object ^sender, CancelEventArgs ^e)
|
void libuiWindow::onClosing(Object ^sender, CancelEventArgs ^e)
|
||||||
{
|
{
|
||||||
e->Cancel = (*(this->w->onClosing))(this->w, this->w->onClosingData) == 0;
|
// TODO copy comments
|
||||||
|
if ((*(this->w->onClosing))(this->w, this->w->onClosingData))
|
||||||
|
// TODO this triggers another onClosing() when it's too late
|
||||||
|
uiControlDestroy(uiControl(this->w));
|
||||||
|
e->Cancel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int defaultOnClosing(uiWindow *w, void *data)
|
static int defaultOnClosing(uiWindow *w, void *data)
|
||||||
|
|
Loading…
Reference in New Issue