Restore old input method detection order

This fixes a regression in #320.
master
Quantum 6 years ago
parent 4f488e73ce
commit 6688abdc25
  1. 15
      config.c
  2. 2
      util.h

@ -1,4 +1,5 @@
#include "config.h" #include "config.h"
#include "util.h"
#include <ctype.h> #include <ctype.h>
#include <iniparser.h> #include <iniparser.h>
@ -9,6 +10,13 @@
double smoothDef[5] = {1, 1, 1, 1, 1}; double smoothDef[5] = {1, 1, 1, 1, 1};
enum input_method default_methods[] = {
INPUT_FIFO,
INPUT_PORTAUDIO,
INPUT_ALSA,
INPUT_PULSE,
};
char *outputMethod, *channels; char *outputMethod, *channels;
const char *input_method_names[] = { const char *input_method_names[] = {
@ -466,10 +474,11 @@ bool load_config(char configPath[255], struct config_params *p, bool colorsOnly,
free(p->audio_source); free(p->audio_source);
char *input_method_name; char *input_method_name;
for (int i = INPUT_MAX - 1; i >= 0; i--) { for (size_t i = 0; i < ARRAY_SIZE(default_methods); i++) {
if (has_input_method[i]) { enum input_method method = default_methods[i];
if (has_input_method[method]) {
input_method_name = input_method_name =
(char *)iniparser_getstring(ini, "input:method", input_method_names[i]); (char *)iniparser_getstring(ini, "input:method", input_method_names[method]);
} }
} }

@ -6,3 +6,5 @@
__typeof__(b) _b = (b); \ __typeof__(b) _b = (b); \
_a > _b ? _a : _b; \ _a > _b ? _a : _b; \
}) })
#define ARRAY_SIZE(x) ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))

Loading…
Cancel
Save