From 0283189070f577e77d8f6a41c00d7cd69709ce14 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Mon, 25 Nov 2024 04:53:27 +0100 Subject: Port eizoctl build to CMake The GNU Makefile approach has its limits. --- eizoctl.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'eizoctl.c') diff --git a/eizoctl.c b/eizoctl.c index 6a335cb..a1e5da5 100644 --- a/eizoctl.c +++ b/eizoctl.c @@ -33,7 +33,9 @@ #include #include -#define PROJECT_NAME "eizoctl" +#include "config.h" +#undef PROGRAM_NAME +#define PROGRAM_NAME "eizoctl" #if defined __GNUC__ #define ATTRIBUTE_PRINTF(x, y) __attribute__((format(printf, x, y))) @@ -966,6 +968,7 @@ run(int argc, char *argv[], print_fn output, print_fn error, bool verbose) {"restart", no_argument, NULL, 'r'}, {"events", no_argument, NULL, 'e'}, {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, {} }; @@ -994,6 +997,9 @@ run(int argc, char *argv[], print_fn output, print_fn error, bool verbose) case 'h': output(usage, name); return 0; + case 'V': + output(PROGRAM_NAME " " PROGRAM_VERSION "\n"); + return 0; default: error("Unknown option\n"); error(usage, name); @@ -1397,14 +1403,14 @@ wWinMain( .hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(1)), .hCursor = LoadCursor(NULL, IDC_ARROW), .hbrBackground = GetSysColorBrush(COLOR_3DFACE), - .lpszClassName = TEXT(PROJECT_NAME), + .lpszClassName = TEXT(PROGRAM_NAME), }; if (!RegisterClassEx(&wc)) return 1; // We need a window, but it can stay hidden. g.hwnd = CreateWindowEx(WS_EX_CONTROLPARENT, - wc.lpszClassName, TEXT(PROJECT_NAME), WS_OVERLAPPEDWINDOW, + wc.lpszClassName, TEXT(PROGRAM_NAME), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 600, 400, NULL, NULL, hInstance, NULL); NOTIFYICONDATA nid = { .cbSize = sizeof nid, @@ -1414,7 +1420,7 @@ wWinMain( .uCallbackMessage = WM_APP + 0, // TODO(p): LoadIconMetric is suggested for high-DPI displays. .hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(1)), - .szTip = TEXT(PROJECT_NAME), + .szTip = TEXT(PROGRAM_NAME), }; if (!Shell_NotifyIcon(NIM_ADD, &nid)) { message_error("Failed to add notification area icon."); -- cgit v1.2.3-70-g09d2