Skip to content

Commit

Permalink
misc: print better versions
Browse files Browse the repository at this point in the history
Print both git revision and version number, not just one of either.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed Aug 29, 2024
1 parent bf8d326 commit 7ddbea6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/build_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@

#mesondefine PICOM_COMMIT_HASH_SHORT
#define PICOM_VERSION "v@version@"

#ifdef PICOM_COMMIT_HASH_SHORT
#define PICOM_FULL_VERSION PICOM_VERSION " (git: " PICOM_COMMIT_HASH_SHORT ")"
#else
#define PICOM_FULL_VERSION PICOM_VERSION
#endif
2 changes: 1 addition & 1 deletion src/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBus
return DBUS_HANDLER_RESULT_HANDLED;
}

append(version, string, PICOM_VERSION);
append(version, string, PICOM_FULL_VERSION);
append(pid, int32, getpid());
append(display, string, DisplayString(ps->c.dpy));
append(config_file, string, "Unknown");
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostic.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "picom.h"

void print_diagnostics(session_t *ps, const char *config_file, bool compositor_running) {
printf("**Version:** " PICOM_VERSION "\n");
printf("**Version:** " PICOM_FULL_VERSION "\n");
// printf("**CFLAGS:** %s\n", "??");
printf("\n### Extensions:\n\n");
printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No");
Expand Down
4 changes: 2 additions & 2 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ void print_help(const char *help, size_t indent, size_t curr_indent, size_t line
*/
static void usage(const char *argv0, int ret) {
FILE *f = (ret ? stderr : stdout);
fprintf(f, "picom (%s)\n", PICOM_VERSION);
fprintf(f, "picom " PICOM_FULL_VERSION "\n");
fprintf(f, "Standalone X11 compositor\n");
fprintf(f, "Please report bugs to https://github.com/yshui/picom\n\n");

Expand Down Expand Up @@ -777,7 +777,7 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
} else if (o == 314) {
*all_xerrors = true;
} else if (o == 318) {
printf("%s\n", PICOM_VERSION);
printf(PICOM_FULL_VERSION "\n");
return true;
} else if (o == 307) {
// --plugin
Expand Down

0 comments on commit 7ddbea6

Please sign in to comment.