mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-21 23:08:08 +00:00
[client] overlay: move keybinds and config into the overlays
This adds a new `earlyInit` call which allows the overlay to register options before actually being intialized. Also the keybind handling and state tracking for each overlay has been moved internal to the overlay itself.
This commit is contained in:
@@ -70,7 +70,7 @@ static LGThread *t_spice = NULL;
|
||||
static LGThread *t_render = NULL;
|
||||
static LGThread *t_cursor = NULL;
|
||||
|
||||
struct AppState g_state;
|
||||
struct AppState g_state = { 0 };
|
||||
struct CursorState g_cursor;
|
||||
|
||||
// this structure is initialized in config.c
|
||||
@@ -798,14 +798,10 @@ static bool tryRenderer(const int index, const LG_RendererParams lgrParams,
|
||||
|
||||
static int lg_run(void)
|
||||
{
|
||||
memset(&g_state, 0, sizeof(g_state));
|
||||
|
||||
g_cursor.sens = g_params.mouseSens;
|
||||
if (g_cursor.sens < -9) g_cursor.sens = -9;
|
||||
else if (g_cursor.sens > 9) g_cursor.sens = 9;
|
||||
|
||||
g_state.showFPS = g_params.showFPS;
|
||||
|
||||
/* setup imgui */
|
||||
igCreateContext(NULL);
|
||||
g_state.io = igGetIO();
|
||||
@@ -819,12 +815,7 @@ static int lg_run(void)
|
||||
g_state.fontName = util_getUIFont(g_params.uiFont);
|
||||
DEBUG_INFO("Using font: %s", g_state.fontName);
|
||||
|
||||
g_state.overlays = ll_new();
|
||||
app_registerOverlay(&LGOverlayConfig, NULL);
|
||||
app_registerOverlay(&LGOverlayAlert , NULL);
|
||||
app_registerOverlay(&LGOverlayFPS , NULL);
|
||||
app_registerOverlay(&LGOverlayGraphs, NULL);
|
||||
app_registerOverlay(&LGOverlayHelp , NULL);
|
||||
app_initOverlays();
|
||||
|
||||
// initialize metrics ringbuffers
|
||||
g_state.renderTimings = ringbuffer_new(256, sizeof(float));
|
||||
@@ -1277,6 +1268,13 @@ int main(int argc, char * argv[])
|
||||
for(unsigned int i = 0; i < LG_DISPLAYSERVER_COUNT; ++i)
|
||||
LG_DisplayServers[i]->setup();
|
||||
|
||||
g_state.overlays = ll_new();
|
||||
app_registerOverlay(&LGOverlayConfig, NULL);
|
||||
app_registerOverlay(&LGOverlayAlert , NULL);
|
||||
app_registerOverlay(&LGOverlayFPS , NULL);
|
||||
app_registerOverlay(&LGOverlayGraphs, NULL);
|
||||
app_registerOverlay(&LGOverlayHelp , NULL);
|
||||
|
||||
if (!config_load(argc, argv))
|
||||
return -1;
|
||||
|
||||
|
Reference in New Issue
Block a user