rkusa / dcs-scratchpad

Resizable and movable DCS World ingame Scratchpad for quick notes - especially useful in VR.
MIT License
178 stars 32 forks source link

Issue with MP chat and keyboard focus #31

Closed Wamwod closed 1 year ago

Wamwod commented 2 years ago

Bug when opening the Multiplayer chat to type into chat with Shift-Tab, if you have scratchpad open the keyboard inputs get lost somewhere, I can't tell where and you can no longer close the chat box and you can't use the keyboard for any binds or to even open the menu to quit the server, this forces a full game restart annoyingly.

Steps to reproduce.

I think Scratchpad and DCS are typing to take keyboard inputs at the same time which is what causes this, I've noticed it really only works when you hit tab in scratch pad while scratch pad isn't actively being edited.

rkusa commented 2 years ago

Thanks for the report! That seems to be an interesting one. I am unable to reproduce it while sitting in an F16 or F/A-18, but can reproduce it in an Ka50. Which aircraft are you using when encountering the issue?

M00niebrav0 commented 2 years ago

Can be reproduced in A-10C II on Hoggit PAWG server. Thought I'd help out fix the issue.

Wamwod commented 2 years ago

Thanks for the report! That seems to be an interesting one. I am unable to reproduce it while sitting in an F16 or F/A-18, but can reproduce it in an Ka50. Which aircraft are you using when encountering the issue?

Apologies I was having the issue in the Uh1H and the F18.

rkusa commented 2 years ago

@M00niebrav0 thanks for jumping in and confirming that you also have the issue, that helps to know!

Steps to reproduce.

  • Have DCS Scratchpad open.
  • Have the Tab text chat open.
  • Press Shift-Tab to type into Multiplayer chat.

@Wamwod Do you press Shift-Tab while the Scratchpad has focus (the cursor is active in the Scratchpad)? Or does it happen for you regardless of whether the focus is in the Scratchpad or not?

Dragonius commented 2 years ago

i dont never had that kind problem., but i'm very interested what is your scratchpad problem

Berakdev commented 2 years ago

I've been able to speedrun replicate with scratchpad on DCS 2.8 and Scratchpad 0.6.1 Grayflag Syria with the mod Hercules with SRS installed, should be the same on any server and airframe and SRS should be irrelevant.
(having an SRS install provides evidence of how the keyboard interaction still can do some things though)

Steps to replicate Connect to any DCS multiplayer server with scratchpad installed Slot into an airframe, let normal F1 view load, or switch to an alternate view (doesn't matter what view mode you're in) Push CTRL-SHIFT-X once (or alternate keybind to load scratchpad) Still having the yellow + icon for cursor movement Pushing SHIFT-TAB here has no negative effect, it loads chat, push SHIFT-TAB again and ingameChat cycles away. Click into the Scratchpad Text UI (you will now have cursor visible)

Push SHIFT-TAB again, this will load Chat with keyboard focus whilst Scratchpad has a keyboard focus lock, this seems to be what breaks the keyboard/UI layer controls.

Pure-HOTAS commands will respond (on Hercules mod, having refuel/rearm bound to a single HOTAS key it will still respond, this is very useful to do if you've just done an hour long supply ferry flight and belly landed because keyboard flaps/gear controls don't respond)

Should be irrelevant but i have got Joy2key installed to send some keyboard commands from HOTAS inputs (logitech x52) to send LEFT-ALT and RIGHT-ALT modifiers from buttons on throttle/stick.

After locking the keys up, LEFTALT-F8 keybind won't work to open refuel/rearm screen, most/all keyboard controls won't interact with the aircraft or stock UI elements, CTRL-SHIFT-ESC will work to cycle the SRS overlay Stock CTRL-SHIFT-X will work to cycle the scratchpad overlay

HOTAS controls and clicky switch ingame controls work.

HOTAS controls to open UI elements such as rearm/refuel work without a keyboard modifier UI elements that have a "close window" button such as rearm/refuel will close with that UI button press.

Viable workarounds / lockup prevention steps at present Close Scratchpad with CTRL-SHIFT-X or alternate keymap on any occasion prior to cycling in-game chat with SHIFT-TAB this is the safest way of ensuring no conflict between the two UI layers

Recovery options are just to keep flying without being able to use keyboard shortcuts, ultimately only fix is to close DCS and restart and reconnect, this is problematic if you were quite far from any valid spawn points on starting a new login.

Possible fix options ED-side - if DCS had a close button in the corner of chat, this would likely solve the issue with this mod and anything else that's had UI/keyboard layer problem, this doesn't seem an exclusive issue to scratchpad, anything that interacts with chat ingame and runs LUA - DCS.lockKeyboardInput(keyboardEvents) or similar commands through DCS can cause this issue

Scratchpad-side, potentially an extra button or keymap that forces a lock/unlock cycle on KeyboardInput MAY work to disengage the lock that ingame chat has? tests of various changes to the scratchpad-hook.lua that i've done to add that sort of thing haven't had any success yet though, at least in 2.7, not re-tried editing that sort of function in DCS 2.8 with the 0.6.1 scratchpad release.

Scratchpad-side fix option 2, if scratchpad can surrender it's lock on ingameChat opening, this may prevent this from locking up?

Alternate runs through the replication steps in a hornet on Hoggit PGAW server produced the same effect, it's potentially an edge case that few pilots will trigger, but does seem to apply to any potential scratchpad user, that also uses ingame multiplayer chat.

rkusa commented 1 year ago

Thanks for the steps to reproduce, this helped debugging. I've made a potential fix. Anyone mind to give it a test?

Download

Berakdev commented 1 year ago

Hi, can do, trying rewriting my lua file with the commit changes to see if I can break that version :)

edit 5: self-edited change to add/remove/update the listed lines was a definite improvement but I did manage to replicate the glitch again, not entirely sure how, also noticed the clearly there download file and using your version next.

EDIT 6, after downloading the file you uploaded rather than trying to amend an old download of the 2.8 patched version, replacing the hook lua entirely and starting OBS to record what the steps were if it reproduces, not been able to replicate this issue with that file.