Skip to content

Static state is required? #95

@NWoodsman

Description

@NWoodsman

This might be better suited as a discussion thread on a social media platform but I wanted to ask the users of this project.

Since the callbacks are static implemented, the only way to maintain some kind of state is... how? Should I keep some state in an unsafe struct? I think this probably has wider implications for the hooks being called from different threads, so maybe not a good idea... any thoughts?

Basically I want to implement a hotkey system by holding space bar. I will only send a space key press on the key-up so that it will get sent during normal typing, but if space is held down, a timeout will trigger after _ milliseconds (the average time it takes during normal typing for the spacebar to raise) and enter hotkey mode until space is released.

Therefore in pseudo-speak I need an enum "hotkey layer enabled" or "disabled" with a state struct stored in a global variable (current thinking) but looking for ideas to avoid that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions