Skip to content

Fixing hotkey drops in Linux#367

Merged
CryZe merged 10 commits intoLiveSplit:masterfrom
mcdoll:master
Dec 13, 2020
Merged

Fixing hotkey drops in Linux#367
CryZe merged 10 commits intoLiveSplit:masterfrom
mcdoll:master

Conversation

@mcdoll
Copy link
Copy Markdown
Contributor

@mcdoll mcdoll commented Oct 30, 2020

This PR addresses issue #302 .
hotkey_system.rs was rewritten so that the activation and deactivation of the hotkey system registers and unregisters the grabbing of the keys. Moreover, I added an (private) enum Hotkey that makes it possible to reduce the large amount of copy&paste code.
In the livesplit-hotkey crate, the linux module was slightly modified: the old functions register and unregister were replaced by
grab_all and ungrab_all. Also the window number is now calculated in grab_all and ungrab_all, which simplifies the Hook methods slightly.

I think that we should get rid of the set_split(keycode), set_skip, etc methods and instead make enum Hotkey public and use set_hotkey(hotkey,keycode) instead.

…nd ungrab_all; this fixes the reactivating the same key issue
…this breaks the API since now (de-)activative returns Result<()>; we also have a private enum that reduces the amount of boilerplate code
Copy link
Copy Markdown
Collaborator

@CryZe CryZe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also some formatting problems, try to run cargo fmt.

@mcdoll mcdoll requested a review from CryZe October 30, 2020 22:41
@DarkRTA
Copy link
Copy Markdown
Contributor

DarkRTA commented Dec 13, 2020

I've tested this patch on my machine like I should have done ages ago, and it seems to be working.

@CryZe this should be good to merge provided there's nothing else wrong with this.

@CryZe CryZe added bug There is a bug. c api The issue or pull request is about the C API. enhancement An improvement for livesplit-core. hotkey This is about the hotkey implementation. labels Dec 13, 2020
@CryZe CryZe added this to the v0.12 milestone Dec 13, 2020
@CryZe CryZe merged commit bc1b46c into LiveSplit:master Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug There is a bug. c api The issue or pull request is about the C API. enhancement An improvement for livesplit-core. hotkey This is about the hotkey implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants