Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic key focus stealing (query windows) #2275

Closed
DorpsGek opened this issue Sep 6, 2008 · 8 comments
Closed

Dynamic key focus stealing (query windows) #2275

DorpsGek opened this issue Sep 6, 2008 · 8 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Sep 6, 2008

Zuu opened the ticket and wrote:

This patch let windows on runtime tell the key input loop if the window is a query window or not and need to have the key input stolen from other windows that otherwise might grab the input before.

As it is now this property is set per window statically in window.cpp. With this patch you override the virtual function bool IsQueryWindow() in the Window class if you need to mark a window as query window.

Benefits:
* Possible for a window to dynamic change if it want to steal key input or not. This I plan to use in my sign list search patch to hide the search box by default so global hotkeys can be used as usual unless the user decides to use the search function.
* Removes enumeration of query windows in window.cpp and replaces it with loop structure.

Drawbacks:
* Makes the code overall sightly longer as each query window .cpp file is extended a few rows.
* Introduces two calls to a virtual function every key input loop per window instance. (2*n calls, where n = number of window instances)

I think the benefits justifies the drawbacks and the extra calls are not a problem as the number of window instances are not that high. From functionality point the virtual function could be replaced by a public member variable to possible improve speed.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/2275
@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 6, 2008

Zuu wrote:

Corrected "if(" to "if (" at one spot.

Else I think the patch should comply with the coding style now.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment4696

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 7, 2008

Zuu wrote:

* Updated to current trunk

* Added function to delete (close) all query windows.

Currently in trunk: Just before SaveLoad or sign edit window is opened all query windows are closed (except for console and network message) so that only one of them are open at each time. And most important so that _no_scroll is not reseted when there still is a query window left.

Currently this is done explicit by enumerating the windows to be closed.

What I do is to add a function that closes/deletes all windows that say that they are a query window except for console and network message window. This function I call instead of explicit closing WC_QUERY_STRING and WC_SAVELOAD where that is done currently in trunk.

This is also preparation for the search in sign list patch which will add one more query window. So making closing query windows generic would be good I think.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment4712

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 8, 2008

Zuu wrote:

For reference, the sign list filter/search patch mentioned above is found at the following address:
http://www.tt-forums.net/viewtopic.php?f=33&t=38715


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment4713

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 8, 2008

Zuu wrote:

Just to let you know, I just found out one inconsistency between the behavior comparing with or without this patch applied.

If you first click on a patch setting in the patch window that open an edit box and then on a sign, the first edit box is not closed with this patch, but in trunk. Which is something I need to fix. Hopefully the fix is not far away.

[edit: fixed in version 4]


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment4715

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 8, 2008

Zuu wrote:

Fixes:

Windows that wrongly was not marked as query windows: (because multiple windows shared the same WC_... enum constant and I just changed the first I found)
* Create scenario window
* String query window (used by patch window for example when you click on a numeric value)
* Add a newGRF window

This time I've searched through all usages of the WC_ constants that was checked for in the input loop when checking for query windows, to make sure ALL windows that previously was threated as query windows overrides the default IsQueryWindow with a function that returns true (the default one returns false).

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment4716

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Isn't this kinda superseded by #2297 and thus unnecessary?


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment5596

@DorpsGek
Copy link
Member Author

Zuu wrote:

Yes indeed, this task can be marked as obsolete. I wrote this patch first, before I wrote #2297.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275#comment5597

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Out of date

Obsoleted by #2297


This comment was imported from FlySpray: https://bugs.openttd.org/task/2275

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant