File 3631-Using-WX_APP_TITLE-for-wxEntry.patch of Package erlang
From 55b3521285bad7ba24cbae9e556c7e2417ff1e1c Mon Sep 17 00:00:00 2001
From: Dominic Letz <dominic@diode.io>
Date: Sun, 18 Oct 2020 23:51:51 +0200
Subject: [PATCH] Using WX_APP_TITLE for wxEntry()
---
lib/wx/c_src/wxe_main.cpp | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/wx/c_src/wxe_main.cpp b/lib/wx/c_src/wxe_main.cpp
index 5b65d8a59b..fdee1fb1c0 100644
--- a/lib/wx/c_src/wxe_main.cpp
+++ b/lib/wx/c_src/wxe_main.cpp
@@ -118,7 +118,20 @@ void *wxe_main_loop(void *vpdl)
{
int result;
int argc = 1;
- const wxChar temp[10] = L"Erlang";
+ wxChar temp[128] = L"Erlang";
+
+ size_t app_len = 127;
+ char app_title_buf[128];
+ int res = erl_drv_getenv("WX_APP_TITLE", app_title_buf, &app_len);
+ if (res == 0) {
+ wxString title = wxString::FromUTF8(app_title_buf);
+ int size = title.Length() < 127 ? title.Length() : 126;
+ for(int i = 0; i < size; i++) {
+ temp[i] = title[i];
+ }
+ temp[size] = 0;
+ }
+
wxChar * argv[] = {(wxChar *)temp, NULL};
ErlDrvPDL pdl = (ErlDrvPDL) vpdl;
--
2.26.2