From 1a523a735f5c686a562b22195285d610e0215f4a Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Sun, 9 Feb 2020 12:10:41 +0100 Subject: [PATCH] Keybind params for toggle hud and log --- src/overlay_params.c | 21 ++++++++++++++++++++- src/overlay_params.h | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/overlay_params.c b/src/overlay_params.c index 14272ea..c907b80 100644 --- a/src/overlay_params.c +++ b/src/overlay_params.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include "X11/keysym.h" #include "overlay_params.h" @@ -73,6 +75,18 @@ parse_font_size(const char *str) return strtof(str, NULL); } +static KeySym +parse_toggle_hud(const char *str) +{ + return XStringToKeysym(str); +} + +static KeySym +parse_toggle_logging(const char *str) +{ + return XStringToKeysym(str); +} + static uint32_t parse_fps_sampling_period(const char *str) { @@ -183,6 +197,8 @@ parse_overlay_env(struct overlay_params *params, params->width = 280; params->height = 140; params->control = -1; + params->toggle_hud = 65481; + params->toggle_logging = 65471; if (!env) return; @@ -208,8 +224,11 @@ parse_overlay_env(struct overlay_params *params, } // if font_size is used and height has not been changed from default // increase height as needed based on font_size - bool heightChanged = false; + // params->toggle_hud = "F12"; + + bool heightChanged = false; + if (params->height != 140) heightChanged = true; diff --git a/src/overlay_params.h b/src/overlay_params.h index fbcfe80..fb16380 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -53,6 +53,8 @@ extern "C" { OVERLAY_PARAM_CUSTOM(no_display) \ OVERLAY_PARAM_CUSTOM(control) \ OVERLAY_PARAM_CUSTOM(font_size) \ + OVERLAY_PARAM_CUSTOM(toggle_hud) \ + OVERLAY_PARAM_CUSTOM(toggle_logging) \ OVERLAY_PARAM_CUSTOM(help) enum overlay_param_position { @@ -82,6 +84,8 @@ struct overlay_params { unsigned width; unsigned height; float font_size; + int toggle_hud; + int toggle_logging; }; const extern char *overlay_param_names[];