diff --git a/include/QF/input.h b/include/QF/input.h index aa7c07a5b..1c492efec 100644 --- a/include/QF/input.h +++ b/include/QF/input.h @@ -52,6 +52,7 @@ typedef struct in_buttoninfo_s { struct qf_fd_set; typedef struct in_driver_s { + void (*init_cvars) (void *data); void (*init) (void *data); void (*shutdown) (void *data); diff --git a/libs/input/in_common.c b/libs/input/in_common.c index 0d57b4e76..f9d18a07c 100644 --- a/libs/input/in_common.c +++ b/libs/input/in_common.c @@ -456,6 +456,12 @@ IN_Init_Cvars (void) "mouse in_mouse_pre_amp multiplier"); lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL, "when mlook/klook on player will strafe"); + for (size_t i = 0; i < in_drivers.size; i++) { + in_regdriver_t *rd = &in_drivers.a[i]; + if (rd->driver.init_cvars) { + rd->driver.init_cvars (rd->data); + } + } } void diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index 1898a2482..5e2a93745 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -1059,7 +1059,7 @@ in_x11_get_device_event_data (void *device, void *data) } static void -in_x11_init_cvars (void) +in_x11_init_cvars (void *data) { in_snd_block = Cvar_Get ("in_snd_block", "0", CVAR_ARCHIVE, NULL, "block sound output on window focus loss"); @@ -1091,8 +1091,6 @@ in_x11_init (void *data) if (!x_win) Sys_Error ("IN: No window!!"); - in_x11_init_cvars (); - X11_OpenDisplay (); // call to increment the reference counter x11_fd = ConnectionNumber (x_disp); @@ -1140,6 +1138,7 @@ in_x11_clear_states (void *data) } static in_driver_t in_x11_driver = { + .init_cvars = in_x11_init_cvars, .init = in_x11_init, .shutdown = in_x11_shutdown, .set_device_event_data = in_x11_set_device_event_data,