Page MenuHomeWildfire Games

Ingame Esc hotkey close dialogs not deselect when open dialogs
AbandonedPublic

Authored by ffffffff on Aug 31 2017, 12:57 AM.

Details

Reviewers
s0600204
elexis
Summary

Dont deselect selected unit/structure when dialogs are open, that has to be closed by cancel hotkey (esc)

this refers also especialy to D297 having open a detail page of a production unit/structure from production menu and then close page by hitting esc put then not loosing production menu cause deselection happens also (to further interact with production menu).

Test Plan

open game open dialog trade or chat or something hit esc

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

ffffffff updated this revision to Diff 3406.EditedAug 31 2017, 1:31 AM

this better now u see the double binding cancel being intelligent outputed

elexis requested changes to this revision.Aug 31 2017, 1:44 AM

The problem is that both of these hotkey events are triggered before the first one is processed:

hotkeys/misc.xml:	<object hotkey="cancel">
hotkeys/misc.xml-		<action on="Press">closeOpenDialogs();</action>
hotkeys/misc.xml-	</object>

hotkeys/misc.xml-	<object hotkey="selection.cancel">
hotkeys/misc.xml:		<action on="Press">clearSelection();</action>
hotkeys/misc.xml-	</object>

Was suspecting that its a source/gui bug, but I don't see a way to fix it in th engine if we don't get the feedback from misc.xml (and I'm not convinced that the engine should know what the GUI does with these events).

Sounds a lot like we might run into this issue in the future too.

Also not convinced that your patch is correct. clearSelection should clear the selection, not close dialogs. It's a mere coincidence that these hotkeys are on escape by default.

However what you could do is adding an early return to clearSelection if a dialog is open.

This revision now requires changes to proceed.Aug 31 2017, 1:44 AM
In D853#33461, @elexis wrote:

The problem is that both of these hotkey events are triggered before the first one is processed:

hotkeys/misc.xml:	<object hotkey="cancel">
hotkeys/misc.xml-		<action on="Press">closeOpenDialogs();</action>
hotkeys/misc.xml-	</object>

hotkeys/misc.xml-	<object hotkey="selection.cancel">
hotkeys/misc.xml:		<action on="Press">clearSelection();</action>
hotkeys/misc.xml-	</object>

Was suspecting that its a source/gui bug, but I don't see a way to fix it in th engine if we don't get the feedback from misc.xml (and I'm not convinced that the engine should know what the GUI does with these events).

Sounds a lot like we might run into this issue in the future too.

Also not convinced that your patch is correct. clearSelection should clear the selection, not close dialogs. It's a mere coincidence that these hotkeys are on escape by default.

However what you could do is adding an early return to clearSelection if a dialog is open.

cant follow

ther s a bug

double cancel

what my patch isnt doing?

There is no escape here. You have two different hotkeys, "clearselection" and "close". They happen to be on escape by default, but you can put them on F5 and F6.

If the user presses the "clear selection" hotkey, the selection should be cleared, not less, not more.
If the user presses the "close" hotkey, the current dialog should be closed, not more, not less.

So if you add "if dialog open return;" to clearSelection that would fix both the perceived bug and still allows the hotkeys to do what they should do by definition.

In D853#33465, @elexis wrote:

There is no escape here. You have two different hotkeys, "clearselection" and "close". They happen to be on escape by default, but you can put them on F5 and F6.

If the user presses the "clear selection" hotkey, the selection should be cleared, not less, not more.
If the user presses the "close" hotkey, the current dialog should be closed, not more, not less.

So if you add "if dialog open return;" to clearSelection that would fix both the perceived bug and still allows the hotkeys to do what they should do by definition.

what if not

ffffffff updated this revision to Diff 3407.Aug 31 2017, 2:00 AM

chat state missed

ffffffff updated this revision to Diff 3409.Aug 31 2017, 2:21 AM
ffffffff added a comment.EditedAug 31 2017, 2:25 AM

also push gui doesnt reset binded keys from previous gui. should be considerable. (options/manual)

also key bindings from pushed gui are doubled executed when poped to previous gui if same key, maybe because the pop is going to fast and the sdl hotkey handler cant distinguish between hotkey being pressed on pushed gui and poped back gui.

Unfortunately an early return if a dialog is open in clearSelection won't do, because first the cancel event arrives, closes the window, then the selection.cancel event arrives and the early return can't be triggered anymore.
The only clean way (without merging the two hotkeys) I see is that JS returns true if the hotkey event (and thus the key combination triggering that hotkey event) should be considered handled and thus should trigger no further hotkey events.
So either do something not so fun in the engine or merge two hotkeys that shouldn't be merged (at least it seems likesomeone might want to clear the unit selection with a key other than escape while keeping escape to close dialog boxes).

Bug acknowledged, but I don't see it being fixed soon.

ffffffff edited the summary of this revision. (Show Details)Aug 31 2017, 2:36 AM
In D853#33476, @elexis wrote:

Unfortunately an early return if a dialog is open in clearSelection won't do, because first the cancel event arrives, closes the window, then the selection.cancel event arrives and the early return can't be triggered anymore.
The only clean way (without merging the two hotkeys) I see is that JS returns true if the hotkey event (and thus the key combination triggering that hotkey event) should be considered handled and thus should trigger no further hotkey events.
So either do something not so fun in the engine or merge two hotkeys that shouldn't be merged (at least it seems likesomeone might want to clear the unit selection with a key other than escape while keeping escape to close dialog boxes).

Bug acknowledged, but I don't see it being fixed soon.

bools (as done before in code g_IsMenuOpen, g_IsDiplomacyOpen and so on..)

elexis resigned from this revision.Dec 12 2017, 8:36 PM
ffffffff abandoned this revision.Jan 22 2018, 6:07 PM

accidently new diff (as is to old i forgot) D1229