hmlendea / gfn-electron

Linux Desktop client for Nvidia's GeForce NOW game streaming service
GNU General Public License v3.0
488 stars 61 forks source link

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

Closed andro404-MC closed 3 weeks ago

andro404-MC commented 1 month ago

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 commented 4 weeks ago

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

hmlendea commented 3 weeks ago

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 commented 3 weeks ago

@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!