Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the Escape key not working outside of the application (#241) #242

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

andro404-MC
Copy link
Contributor

Fixing #241

but required removing for causing infinite recursion :

globalShortcut.register('Esc', async () => {
    var window = BrowserWindow.getAllWindows()[0];

    window.webContents.sendInputEvent({
      type: 'keyDown',
      keyCode: 'Esc'
    });
    window.webContents.sendInputEvent({
      type: 'char',
      keyCode: 'Esc'
    });
    window.webContents.sendInputEvent({
      type: 'keyUp',
      keyCode: 'Esc'
    });

    window.webContents.sendInputEvent({
      type: 'keyDown',
      keyCode: 'Esc'
    });
    window.webContents.sendInputEvent({
      type: 'char',
      keyCode: 'Esc'
    });
    window.webContents.sendInputEvent({
      type: 'keyUp',
      keyCode: 'Esc'
    });
  });

I don't understand the purpose of that code, can you explain ??

@lleyton
Copy link
Collaborator

lleyton commented Jun 5, 2024

It looks great! I'm unsure what that commented out block does, any idea @hmlendea?

@hmlendea hmlendea changed the title fixing #241 Fixed the Escape key not working outside of the application (#241) Jun 7, 2024
@hmlendea
Copy link
Owner

hmlendea commented Jun 7, 2024

It looks great! I'm unsure what that commented out block does, any idea @hmlendea?

It was an old dirty fix for the Escape key not working the first time it was pressed - meaning that it required it being pressed twice in order to e.g. open the main menu.

@hmlendea
Copy link
Owner

hmlendea commented Jun 7, 2024

@andro404-MC could you please remove the commented code altogether? If not I can remove it later in a separate clean-up PR.

Otherwise it looks good. Thanks!

@hmlendea hmlendea merged commit feb0846 into hmlendea:master Jun 7, 2024
3 checks passed
@andro404-MC andro404-MC mentioned this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants