Board index FlightGear Support Flying

Chat Message

Controlling your aircraft, using the autopilot etc.

Re: Chat Message

Postby PINTO » Tue Aug 15, 2017 7:48 am

There was a bug (is it still around? haven't seen it in a while) where the chat window would not disappear, no matter what you did. Even pressing the escape key did nothing, and all keypresses were routed to it. You could not send the message either. The only fix was a restart.
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 966
Joined: Wed Oct 21, 2015 7:28 pm
Callsign: pinto
Version: stable
OS: Win10

Re: Chat Message

Postby wkitty42 » Tue Aug 15, 2017 10:02 pm

i've seen this ""bug"" in the past but since i don't use the chat stuff, i don't know if it is still there... when i saw it, it was in solo mode, not MP... if/when i want to chat in MP mode, i always open the chat dialog via the F10->MP menu... the other way opens a different box thing to chat with and not the normal chat dialog...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Chat Message

Postby condab » Wed Aug 16, 2017 1:40 am

Ah, my apologies. I had never come across this bug in any version of my FG but it could have been a very specific version xxxx.y.2 etc. which I missed, that or just not on my OS. Either way, at least this doesn't exist (or shouldn't now anyway) and there is a solution for users who just want to close the dialogue on a non-bug version :)
Callsign: DAL049 or AAL049
Aircraft I Fly: EC130, EC135, 777, 787, Grumman F-14B, Piper PA-34 Seneca II, Piper PA-32 Cherokee Six, Piper PA-28 Cherokee Warrior II, Piper PA-24 Comanche 250, Piper PA-18 Super Cub, Cessna 172P Skyhawk
User avatar
condab
 
Posts: 9
Joined: Wed Sep 10, 2014 12:49 am
Location: Sydney, Australia
Callsign: condab / DAL049
IRC name: condab / treefrog
Version: 2017.2.1
OS: Mac OS X 10.11.6

Re: Chat Message

Postby tdammers » Sun Mar 18, 2018 12:01 am

FWIW, the problem very much still exists in 2018.3.

For completeness, reproduce like this:

1. Open MP list

2. Click the "chat" thingie next to one of the players

3. A chat popup appears that doesn't go away, not even after pressing Enter or Esc. All subsequent keyboard input to the main 3D window goes into the popup, so things like switching views or controlling the aircraft using the keyboard are now impossible.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: Chat Message

Postby Richard » Sun Mar 18, 2018 12:06 am

condab wrote in Tue Aug 15, 2017 2:40 am:I'm shocked to see that some people here have classed this as a 'problem' of all things in FlightGear. It is not a problem, and the feature is implemented to increase chat efficiency with one keyboard shortcut.

The fact that it is FG's fault that you missed the '_' key and hit another one just astounds me...


Except that there was a bug that I fixed last year that would prevent the escape key (or any key from working with this chat menu. I think the fix is in 2017.3.
Richard
 
Posts: 810
Joined: Sun Nov 02, 2014 11:17 pm
Version: Git
OS: Win10

Re: Chat Message

Postby tdammers » Sun Mar 18, 2018 8:25 pm

I've done a bit of digging, and found that the entire MP pilot list, as well as the MP chat popups, are implemented in Nasal, and the relevant code is pretty much entirely in fgdata, not flightgear itself. Specifically, it's under fgdata/Nasal/multiplayer.nas.

And once you know where to look, it's really easy to figure out what goes wrong - it's a basic rookie mistake with this kind of callback-style code. In a nutshell: there is a global variable "kbdlistener" which is used to track the ID of the currently attached keyboard listener, and whenever the message composition function is ended, either by sending the message or by aborting, that listener is removed. So far, so good. Problem is, when you trigger message composition a second time, while the first message composition is still active, the "kbdlistener" variable gets overwritten, and now we have *two* keyboard listeners attached, and because we've overwritten the value of "kbdlistener", we can only ever unsubscribe the newer one, while the old one will keep capturing the keyboard forever, and trigger new popups with every keypress it captures.

The quick fix is pretty easy: just check whether "kbdlistener" is set before subscribing to keyboard events, and if it is, just skip the subscribing part. It's not pretty, because if two things try to start composing a chat message in parallel, one of them will win and inherit the preset contents from the other; a better solution would be to restructure this code so that the "kbdlistener" variable is no longer a global, and in fact it would probably be better to not abuse the popup system for this in the first place, but instead fire up a proper GUI dialog and auto-close it upon sending. However, I only just started using Nasal here, so I only implemented the quick-and-dirty fix. Testing so far however seems to confirm that this actually works.

Here's the patch: https://gist.github.com/tdammers/244490 ... a3da8dbb73

On a side note, the tone of this conversation seems unreasonably hostile and not very productive. People reported a bug, it is easy to reproduce, and evident from the code once you know where it is; in such a situation, denying the presence of a bug will not help people, will not make the bug go away, and pretty much just reflects badly on the project, which I think is a shame.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: Chat Message

Postby tdammers » Sun Mar 18, 2018 8:41 pm

Oh, nevermind, this doesn't seem to actually fix the problem after all. I'll dig deeper.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: Chat Message

Postby tdammers » Sun Mar 18, 2018 8:45 pm

Ah, here we go, I made a little typo. This one does work: https://gist.github.com/tdammers/d20739 ... d823ca8d32
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: Chat Message

Postby Octal450 » Sun Mar 18, 2018 9:05 pm

I suggest you bring that up on the dev list, get it integrated into the FGFS release?

https://sourceforge.net/p/flightgear/ma ... ear-devel/

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Chat Message

Postby cgdae » Mon Mar 19, 2018 12:04 am

I have a patch for fgdata that cancels the current Chat Message if we get Backspace on an empty message:

Code: Select all
    Cancel pilot-list chat if backspace on empty message.
   
    Without this patch, it's hard to cancel pilot-list chat - only way i've found
    is to press Escape repeatedly closing other windows until it reaches the
    pilot-list chat. Without easy cancelling, one cannot use keyboad shortcuts for
    things like flaps, gear etc.

diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas
index b58e35c..0427bf9 100644
--- a/Nasal/multiplayer.nas
+++ b/Nasal/multiplayer.nas
@@ -111,7 +111,15 @@ var handle_key = func(key)
   elsif (key == 8)
   {
     # backspace -> remove a character
-
+    if (size(input) == size(prefix))
+    {
+        # Backspace key with empty message - cancel. Otherwise the only way to
+        # cancel is <Escape> which can entail closing other windows before we
+        # get the <Escape> key.
+        removelistener(kbdlistener);
+        gui.popdown();
+        return 1;
+    }
     if (size(input) > size(prefix))
     {
       input = substr(input, 0, size(input) - 1);
cgdae
 
Posts: 117
Joined: Tue May 31, 2016 8:35 pm

Re: Chat Message

Postby tdammers » Mon Mar 19, 2018 7:45 am

I also considered this, but didn't add it, because it would mean that accidentally pressing the backspace key one too many times would trigger its "normal" behavior, which would be somewhat disruptive. IMO it would be best to pick some key(s) that aren't normally used for typing - Escape is good, except that, as you have stated, other (proper) dialogs will catch it first.

The whole "popup as chat message prompt" thing is a bit of a kludge anyway, hence my thought that it might be better to rewrite this as a proper GUI dialog, like a minified version of the chat dialog. Which, btw., would also benefit from a few small UX enhancements, such as sending on Enter, Up/Down to cycle through history, highlighting & copy-paste, etc. Fixing that bug where the chat window doesn't scroll far enough, and chat messages either disappear entirely, or visibly overflow the chat window, would also make things a lot more convenient.

What would be even cooler, IMO, would be if we could expose the chat functionality on some network socket, then you could hook it up with anything you like, using a minimal adapter to make it work with, idk, IRC or some other protocol, or hook it into Phi or a standalone web app, etc., getting a whole truckload of features for free. No idea if this is possible already.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: Chat Message

Postby tdammers » Mon Mar 19, 2018 7:51 am

Oh, and btw., there's a thread on the flightgear-devel mailing list for this, I think this one should go on there too.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: Chat Message

Postby KB7 » Sat May 19, 2018 6:58 pm

nvm. i might not be on the right version. wish there was a retrofit fix and I'll try implementing the code above.

Re-redit...

So, can anyone give me an easy instruction to suppress the function of this in multiplayer.nas? (Like I want to hack the file and snip out the code that allows for the listener to be active at all for the chat or initiate the chat window by shortcut or clicking on the player list button.) I like the pilot list and I like the main chat window and would still like that, but I don't want this popup ruining a multihour flight and I'm not going to use it ever. It almost blew the end of a 2 1/2 hour flight for me today, I'm just very lucky that I was focused on the right view at the right zoom level and managed to land using mouse and dash clicks which I never do.
KB7
 
Posts: 65
Joined: Sat Nov 29, 2014 6:11 am
Callsign: KB7
Version: 2017.3.1
OS: Win 10

Previous

Return to Flying

Who is online

Users browsing this forum: No registered users and 4 guests