Fix SWAP_HANDS for multimatrix
This commit is contained in:
		
							parent
							
								
									9ddb678fd0
								
							
						
					
					
						commit
						32028cfc43
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -106,13 +106,14 @@ bool swap_held = false;
 | 
				
			||||||
void process_hand_swap(keyevent_t *event) {
 | 
					void process_hand_swap(keyevent_t *event) {
 | 
				
			||||||
    static swap_state_row_t swap_state[MATRIX_ROWS];
 | 
					    static swap_state_row_t swap_state[MATRIX_ROWS];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    keypos_t pos = event->key;
 | 
					    // TODO: Properly support multimatrices, currenty this only works for single-matrix keyboards
 | 
				
			||||||
 | 
					    keypos_t pos = event->key.pos;
 | 
				
			||||||
    swap_state_row_t col_bit = (swap_state_row_t)1<<pos.col;
 | 
					    swap_state_row_t col_bit = (swap_state_row_t)1<<pos.col;
 | 
				
			||||||
    bool do_swap = event->pressed ? swap_hands :
 | 
					    bool do_swap = event->pressed ? swap_hands :
 | 
				
			||||||
                                    swap_state[pos.row] & (col_bit);
 | 
					                                    swap_state[pos.row] & (col_bit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (do_swap) {
 | 
					    if (do_swap) {
 | 
				
			||||||
        event->key = hand_swap_config[pos.row][pos.col];
 | 
					        event->key.pos = hand_swap_config[pos.row][pos.col];
 | 
				
			||||||
        swap_state[pos.row] |= col_bit;
 | 
					        swap_state[pos.row] |= col_bit;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        swap_state[pos.row] &= ~(col_bit);
 | 
					        swap_state[pos.row] &= ~(col_bit);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue