Hiding non-keys from Razer keymaps

+ Setting matrix map key value if not found in defined layout
+ Correcting layout for `blackwidow_chroma_te_keymap` to include missing keys
This commit is contained in:
Chris
2022-07-21 12:14:37 +10:00
parent 16effbe35b
commit 942a842a32
3 changed files with 16 additions and 3 deletions

View File

@@ -183,6 +183,8 @@ void RGBController_Razer::SetupZones()
if(device_list[device_index]->keymap != NULL)
{
bool not_found = true;
for(unsigned int i = 0; i < device_list[device_index]->keymap_size; i++)
{
if(zone_id == device_list[device_index]->keymap[i].zone &&
@@ -190,8 +192,15 @@ void RGBController_Razer::SetupZones()
col_id == device_list[device_index]->keymap[i].col)
{
new_led->name = device_list[device_index]->keymap[i].name;
not_found = false;
break;
}
}
if(not_found)
{
zones[zone_id].matrix_map->map[row_id * zones[zone_id].matrix_map->width + col_id] = NA;
}
}
leds.push_back(*new_led);

View File

@@ -10,6 +10,8 @@
#include "RGBController.h"
#include "RazerController.h"
#define NA 0xFFFFFFFF
enum
{
RAZER_MODE_DIRECT,
@@ -30,7 +32,7 @@ public:
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);

View File

@@ -432,7 +432,9 @@ static const razer_key blackwidow_chroma_te_keymap[] =
{ 0, 5, 1, KEY_EN_LEFT_CONTROL },
{ 0, 5, 2, KEY_EN_LEFT_WINDOWS },
{ 0, 5, 3, KEY_EN_LEFT_ALT },
{ 0, 5, 7, KEY_EN_SPACE },
{ 0, 5, 11, KEY_EN_RIGHT_ALT },
{ 0, 5, 12, KEY_EN_RIGHT_FUNCTION },
{ 0, 5, 13, KEY_EN_MENU },
{ 0, 5, 14, KEY_EN_RIGHT_CONTROL },
{ 0, 5, 15, KEY_EN_LEFT_ARROW },
@@ -3172,8 +3174,8 @@ static const razer_device blackwidow_x_chroma_te_device =
NULL,
NULL
},
NULL,
0
blackwidow_chroma_te_keymap,
BLACKWIDOW_CHROMA_TE_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\