/* We figure this out by seeing if we have two or more keys in the same column, as well as two or more keys in the same row. */
static int has_ghosting(struct key_matrix *config, struct key_matrix_key *keys, int valid)
/* We figure this out by seeing if we have two or more keys in the same column, as well as two or more keys in the same row. */
static int has_ghosting(struct key_matrix *config, struct key_matrix_key *keys, int valid)
{
	int key_in_same_col = 0, key_in_same_row = 0;
	int i, j;
	if (!config->ghost_filter || valid < 3)
		return 0;
	for (i = 0; i < valid; i++) {
		for (j = i + 1; j < valid; j++) {
			if (keys[j].col == keys[i].col)
				key_in_same_col = 1;
			if (keys[j].row == keys[i].row)
				key_in_same_row = 1;
		}
	}
	if (key_in_same_col && key_in_same_row)
		return 1;
	else
		return 0;
}