Is Mafia overly sensitive to the "Enter"-key?

Winterbay

Active member
I frequently launch several programs at once after starting my computer and then go through them in order to log in and other things. If the program before I get to Mafia requires me to log-in and I send the login-command via pressing "enter" Mafia will accept that "enter"-command and start logging in as well even though I have not actually activated the Mafia window.

Is this expected behaviour or is it perhaps a freakish thing that only happens on my two systems?
 

Bale

Minion
It is a freakish thing that only happens on your two systems.

For me, mafia will only accept enter if the mafia window is active. Since the login box is the active element, I certainly do expect it to login if I press enter while the mafia window is active.

I cannot imagine why the mafia would detect the enter key unless you got confused and didn't realize that the mafia window had just popped up.
 

Winterbay

Active member
Well, what happens is that as I press enter on the login-screen of that program the login-box disappears moving focus over to the Mafia window behind it which then piggy-backs on the previous key-press and logs in as well before I have a chance to choose which character it should log in as.
 

Catch-22

Active member
I'm going to go with this not being something wrong with you or your system, specifically. In my experience, programs which don't directly implement native Windows API calls, such as Java programs and Adobe AIR applications, are more prone to unforeseen glitches relating to window focus hooks and keyboard callback methods.

Without looking at the code, this is all guess work so far. I might take a look at the code to see if there's anything that doesn't seem quite right, but quite often these little nuisances can be difficult to weed out.
 

Bale

Minion
Well, what happens is that as I press enter on the login-screen of that program the login-box disappears moving focus over to the Mafia window behind it which then piggy-backs on the previous key-press and logs in as well before I have a chance to choose which character it should log in as.

Is "that" program always the same program? I'm wondering if "that" program could be the problem.
 

Catch-22

Active member
If you get the chance, try this build. If it fixes your problem, I'll upload the patch to the Bug Reports section and hopefully a dev will approve it for inclusion. If it doesn't fix the problem, then I guess it's back to the drawing board :)
 

Winterbay

Active member
Nope, that does the same thing. For the record it is two different programs (SAP at work and Thunderbird with the StartupMaster extension at home), currently tested it with Thunderbird.
 

Catch-22

Active member
I believe there's some issues with concurrency when the LoginFrame is being initialized but, as I said earlier, these can be pretty tricky to track down.

It's possible there's some thread unsafe stuff happening. I think the whole run() method could be placed in the java.awt.EventQueue, but maybe the setVisible override is already doing all that's needed. Unfortunately, I'm not entirely familiar with the GenericFrame class in KoLmafia.
 
Top