Keybind params for toggle hud and log

This commit is contained in:
FlightlessMango 2020-02-09 12:10:41 +01:00
parent 4d2f3876d5
commit 1a523a735f
2 changed files with 24 additions and 1 deletions

View File

@ -27,6 +27,8 @@
#include <string.h>
#include <errno.h>
#include <sys/sysinfo.h>
#include <X11/Xlib.h>
#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;

View File

@ -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[];