Initial Mouse layer layout

This sets up the `Mouse` layer to have all the keys in their right place, even
if they do nothing for now. A number of enums were introduced to make it easier
to describe mouse key behaviour.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
Gergely Nagy
2016-12-14 16:57:52 +01:00
parent 10feafdb8b
commit 03b73b052d
2 changed files with 41 additions and 15 deletions
+14 -14
View File
@@ -312,23 +312,23 @@ uhk_key_t CurrentKeymap[LAYER_COUNT][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = {
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
// Row 2 // Row 2
{ .type = UHK_KEY_NONE }, // TODO: Mouse button 4 { .type = UHK_KEY_MOUSE, .mouse = { .buttonActions = UHK_MOUSE_BUTTON_4 }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse up { .type = UHK_KEY_MOUSE, .mouse = { .moveActions = UHK_MOUSE_MOVE_UP }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse button 5 { .type = UHK_KEY_MOUSE, .mouse = { .buttonActions = UHK_MOUSE_BUTTON_5 }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse button 6 { .type = UHK_KEY_MOUSE, .mouse = { .buttonActions = UHK_MOUSE_BUTTON_6 }},
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, // TODO: Mouse Wheel Up { .type = UHK_KEY_MOUSE, .mouse = { .scrollActions = UHK_MOUSE_SCROLL_UP }},
// Row 3 // Row 3
{ .type = UHK_KEY_NONE }, // TODO: Mouse left { .type = UHK_KEY_MOUSE, .mouse = { .moveActions = UHK_MOUSE_MOVE_LEFT }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse down { .type = UHK_KEY_MOUSE, .mouse = { .moveActions = UHK_MOUSE_MOVE_DOWN }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse right { .type = UHK_KEY_MOUSE, .mouse = { .moveActions = UHK_MOUSE_MOVE_RIGHT }},
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, // TODO: Mouse Wheel down { .type = UHK_KEY_MOUSE, .mouse = { .scrollActions = UHK_MOUSE_SCROLL_DOWN }},
// Row 4 // Row 4
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
@@ -371,9 +371,9 @@ uhk_key_t CurrentKeymap[LAYER_COUNT][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = {
// Row 3 // Row 3
{ .type = UHK_KEY_LAYER, .layer = { .target = LAYER_ID_MOUSE }}, { .type = UHK_KEY_LAYER, .layer = { .target = LAYER_ID_MOUSE }},
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, // TODO: Mouse left click { .type = UHK_KEY_MOUSE, .mouse = { .buttonActions = UHK_MOUSE_BUTTON_LEFT }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse middle click { .type = UHK_KEY_MOUSE, .mouse = { .buttonActions = UHK_MOUSE_BUTTON_MIDDLE }},
{ .type = UHK_KEY_NONE }, // TODO: Mouse right click { .type = UHK_KEY_MOUSE, .mouse = { .buttonActions = UHK_MOUSE_BUTTON_RIGHT }},
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
@@ -391,8 +391,8 @@ uhk_key_t CurrentKeymap[LAYER_COUNT][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] = {
{ .type = UHK_KEY_SIMPLE, .simple = { .key = HID_KEYBOARD_SC_LEFT_GUI }}, { .type = UHK_KEY_SIMPLE, .simple = { .key = HID_KEYBOARD_SC_LEFT_GUI }},
{ .type = UHK_KEY_SIMPLE, .simple = { .key = HID_KEYBOARD_SC_LEFT_ALT }}, { .type = UHK_KEY_SIMPLE, .simple = { .key = HID_KEYBOARD_SC_LEFT_ALT }},
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
{ .type = UHK_KEY_NONE }, // TODO: mouse decelerate { .type = UHK_KEY_MOUSE, .mouse = { .moveActions = UHK_MOUSE_DECELERATE }},
{ .type = UHK_KEY_NONE }, // TODO: mouse accelerate { .type = UHK_KEY_MOUSE, .mouse = { .moveActions = UHK_MOUSE_ACCELERATE }},
{ .type = UHK_KEY_NONE }, { .type = UHK_KEY_NONE },
} }
}, },
+27 -1
View File
@@ -33,6 +33,32 @@ typedef enum {
UHK_KEY_LPRESSLAYER, UHK_KEY_LPRESSLAYER,
} uhk_key_type_t; } uhk_key_type_t;
enum {
UHK_MOUSE_BUTTON_LEFT = (1 << 0),
UHK_MOUSE_BUTTON_RIGHT = (1 << 1),
UHK_MOUSE_BUTTON_MIDDLE = (1 << 2),
UHK_MOUSE_BUTTON_4 = (1 << 3),
UHK_MOUSE_BUTTON_5 = (1 << 4),
UHK_MOUSE_BUTTON_6 = (1 << 5),
};
enum {
UHK_MOUSE_MOVE_UP = (1 << 0),
UHK_MOUSE_MOVE_DOWN = (1 << 1),
UHK_MOUSE_MOVE_LEFT = (1 << 2),
UHK_MOUSE_MOVE_RIGHT = (1 << 3),
UHK_MOUSE_ACCELERATE = (1 << 4),
UHK_MOUSE_DECELERATE = (1 << 5),
};
enum {
UHK_MOUSE_SCROLL_UP = (1 << 0),
UHK_MOUSE_SCROLL_DOWN = (1 << 1),
UHK_MOUSE_SCROLL_LEFT = (1 << 2),
UHK_MOUSE_SCROLL_RIGHT = (1 << 3),
};
typedef struct { typedef struct {
uint8_t type; uint8_t type;
union { union {
@@ -42,7 +68,7 @@ typedef struct {
uint8_t key; uint8_t key;
} __attribute__ ((packed)) simple; } __attribute__ ((packed)) simple;
struct { struct {
uint8_t __unused_bits; uint8_t buttonActions; // bitfield
uint8_t scrollActions; // bitfield uint8_t scrollActions; // bitfield
uint8_t moveActions; // bitfield uint8_t moveActions; // bitfield
} __attribute__ ((packed)) mouse; } __attribute__ ((packed)) mouse;