Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ else()
endif()
endif()

add_library(tray SHARED ${SRCS})
add_library(tray STATIC ${SRCS})
set_property(TARGET tray PROPERTY C_STANDARD 99)
target_compile_definitions(tray PRIVATE TRAY_EXPORTS)
target_include_directories(tray SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(tray PROPERTIES C_VISIBILITY_PRESET hidden)

if(WIN32)
Expand Down
14 changes: 1 addition & 13 deletions tray.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ extern "C"
{
#endif

#if WIN32
#ifdef TRAY_EXPORTS
#define TRAY_EXPORT __declspec(dllexport)
#else
#define TRAY_EXPORT __declspec(dllimport)
#endif
#else
#if __GNUC__ >= 4 || defined(__clang__)
#define TRAY_EXPORT extern __attribute__((visibility("default")))
#else
#define TRAY_EXPORT extern
#endif
#endif
#define TRAY_EXPORT

struct tray {
const char *icon_filepath;
Expand Down
3 changes: 2 additions & 1 deletion tray_darwin.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ int tray_loop(int blocking) {
void tray_update(struct tray *tray) {
tray_instance = tray;
double iconHeight = [[NSStatusBar systemStatusBar] thickness];
NSImage *image = [[NSImage alloc] initWithContentsOfFile:[NSString stringWithUTF8String:tray_instance->icon_filepath]];
NSImage *image = [NSImage imageNamed:[NSString stringWithUTF8String:tray_instance->icon_filepath]];
if (image == nil) image = [[NSImage alloc] initWithContentsOfFile:[NSString stringWithUTF8String:tray_instance->icon_filepath]];
double width = image.size.width * (iconHeight / image.size.height);
[image setSize:NSMakeSize(width, iconHeight)];
statusItem.button.image = image;
Expand Down