Fixed most of the various bugs preventing this libui from working. Woo! It even works from Go!

This commit is contained in:
Pietro Gagliardi 2015-11-25 17:42:25 -05:00
parent c529ba86cf
commit 6e88ab611a
3 changed files with 10 additions and 2 deletions

View File

@ -92,6 +92,7 @@ void uiUninit(void)
{
uninitWPF();
CoUninitialize();
uninitTypes();
uninitAlloc();
}

View File

@ -9,9 +9,12 @@ using namespace System::Runtime::InteropServices;
String ^fromUTF8(const char *str)
{
array<Byte> ^bytes;
size_t len;
len = strlen(str);
bytes = gcnew array<Byte>(len);
// 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);
}

View File

@ -28,7 +28,11 @@ uiWindowsDefineControlWithOnDestroy(
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)