Yowkees / keyball

keyball is split keyboard has 100% track ball
GNU General Public License v3.0
576 stars 405 forks source link

`MO({AML})` is canceled by `AML_*` keys #525

Closed koron closed 6 months ago

koron commented 6 months ago

When set MO() with the layer which set as auto mouse layer, When holding the key then pressing AML_*, it turn off (disable) the layer.

koron commented 6 months ago

https://docs.qmk.fm/#/feature_layers

MO(layer) - momentarily activates layer. As soon as you let go of the key, the layer is deactivated.

koron commented 6 months ago

AML_* keys call set_auto_mouse_xxx() (where xxx is enable or timeout). set_auto_mouse_xxx() calls auto_mouse_reset(). auto_mouse_reset() clears the context's status and timer.

https://github.com/qmk/qmk_firmware/blob/ca4541699915b37cd1f253bbed51854627efd2ce/quantum/pointing_device/pointing_device_auto_mouse.c#L107-L110

the cotext status is cleared, therefore no reasons to keep layer fo auto mouse ON. the layer will be off.

koron commented 6 months ago

I dought auto_mouse_context.status.mouse_key_tracker

koron commented 6 months ago

I tried changing auto_mouse_reset() as follows. It keeps mouse_key_tracker beyond auto_mouse_reset().

Then this problem is fixed.

It is difficult to fix it with the Keyball alone. It requires modification of the QMK.

static void auto_mouse_reset(void) {
    int8_t tmp = auto_mouse_context.status.mouse_key_tracker;
    memset(&auto_mouse_context.status, 0, sizeof(auto_mouse_context.status));
    memset(&auto_mouse_context.timer, 0, sizeof(auto_mouse_context.timer));
    auto_mouse_context.status.mouse_key_tracker = tmp;
}
koron commented 6 months ago

Give up!