diff options
author | Juan Facorro <[email protected]> | 2019-01-12 11:46:03 +0100 |
---|---|---|
committer | Juan Facorro <[email protected]> | 2019-01-23 19:51:39 +0100 |
commit | 0589cf1e48df6efa72b4f9c41cecde73d17fe4e9 (patch) | |
tree | 95d3cb83077794a87777e29cbbec40864634d348 /lib/wx/c_src/wxe_ps_init.c | |
parent | 34bce104ec297dd092f0c2b356c8533ba29c30fc (diff) | |
download | otp-0589cf1e48df6efa72b4f9c41cecde73d17fe4e9.tar.gz otp-0589cf1e48df6efa72b4f9c41cecde73d17fe4e9.tar.bz2 otp-0589cf1e48df6efa72b4f9c41cecde73d17fe4e9.zip |
Enable setting custom application icon for Mac OS X through environment variable
Diffstat (limited to 'lib/wx/c_src/wxe_ps_init.c')
-rw-r--r-- | lib/wx/c_src/wxe_ps_init.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/wx/c_src/wxe_ps_init.c b/lib/wx/c_src/wxe_ps_init.c index a01d12647e..62c7c51c13 100644 --- a/lib/wx/c_src/wxe_ps_init.c +++ b/lib/wx/c_src/wxe_ps_init.c @@ -64,6 +64,10 @@ void * wxe_ps_init2() { size_t app_len = 127; char app_title_buf[128]; char * app_title; + size_t app_icon_len = 1023; + char app_icon_buf[1024]; + char * app_icon; + // Setup and enable gui pool = [[NSAutoreleasePool alloc] init]; @@ -78,9 +82,15 @@ void * wxe_ps_init2() { if(!GetCurrentProcess(&psn)) { CPSSetProcessName(&psn, app_title?app_title:"Erlang"); } - // Load and set icon + // Enable setting custom application icon for Mac OS X + res = erl_drv_getenv("WX_APP_ICON", app_icon_buf, &app_icon_len); NSMutableString *file = [[NSMutableString alloc] init]; - [file appendFormat:@"%s/%s", erl_wx_privdir, "erlang-logo128.png"]; + if (res >= 0) { + [file appendFormat:@"%s", app_icon_buf]; + } else { + [file appendFormat:@"%s/%s", erl_wx_privdir, "erlang-logo128.png"]; + } + // Load and set icon NSImage *icon = [[NSImage alloc] initWithContentsOfFile: file]; [NSApp setApplicationIconImage: icon]; }; |