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

clickthrough secretly picks wrong connectivity manager. #2456

Closed
Dunbaratu opened this issue Mar 14, 2019 · 2 comments
Closed

clickthrough secretly picks wrong connectivity manager. #2456

Dunbaratu opened this issue Mar 14, 2019 · 2 comments

Comments

@Dunbaratu
Copy link
Member

Dunbaratu commented Mar 14, 2019

When starting a new savegame, kOS opens up a dialog box on the first KSC scene load. So does the Remote Tech mod. Both of these dialogs appear centered on the screen. It's a race condition which box ends up on top.

When the RT box ends up on top, it completely hides the kOS box, so the user doesn't even know it's there. (See screenshot 1 below).

These boxes are not click-through protected. When the user picks options in the RT box, they can be secretly also picking an answer to the question in the kOS box that they never even saw.

Because of this, I ended up starting a remote tech career with kOS's "PermitAll" connectivity manager chosen and I didn't even see it. Instead I kept wondering, "Why on earth didn't it ask me for connectivity manager? Isn't it supposed to?" I did some debugging before finding out that it was actually there, but I was clicking through to pick a button and making the kOS dialog box go away before I saw it.

The second screenshot below shows how that clickthrough happened (with my window shifted aside so you can see it).
screenshot56
Uploading screenshot57.png…

@Dunbaratu Dunbaratu changed the title clickthrough causes clickthrough when connectivity manager dialog hidden behind RT dialog secretly picks an option. Mar 14, 2019
@Dunbaratu Dunbaratu changed the title clickthrough when connectivity manager dialog hidden behind RT dialog secretly picks an option. clickthrough secretly picks wrong connectivity manager. Mar 14, 2019
@Dunbaratu
Copy link
Member Author

Github didn't like it when I tried to put two screenshots on the same comment, so here's the second screenshot, in a second comment:

screenshot57

@Dunbaratu
Copy link
Member Author

I tried dealing with this for a bit and found I was hitting a brick wall in that we are using KSP's high level dialog box API (i.e. calling:

                Module.kOSSettingsChecker.QueueDialog(
                    new MultiOptionDialog(
                  //... (etc...)

And this call isn't letting me easily move the box to somewhere else (it has a Rect parameter, but I can't use it to force the box to move - it seems to be getting ignored).

I suspect that fixing this would involve us having to use a home-grown dialog box, not the one KSP comes with.

Dunbaratu added a commit to Dunbaratu/KOS-1 that referenced this issue Mar 29, 2019
Fixes KSP-KOS#2456

The PopupDialog.SpawnPopupDialog() call from stock KSP's API
allows you to pass in some "anchor" coordinates to move
the window - but it took trial and error to work out what
those coordinates really meant.  They weren't intuitive
(see the comment in the PR for further explanation).

But in the end I finally managed to move the window.
Note that the same call is in a spot of our code used
by another dialog window, so I had to make a way to preserve
it's previous (centered) behavior, so I had to add a little
extra stuff to make it possible to pass in x,y values to
QueueDialog and remember them with the dialog box.

It's very hard to regression-test that I didn't break that
second dialog box (the "migration dialog") because it's
only triggered if you take a very old saved game and try
to migrate it to newer kOS.  It was years ago when that was
a relevant thing and it's nearly impossible to test now
without getting some old copies of KSP.  I'm happy leaving
that part untested, as I couldn't easily make it happen, and
anyone who thinks their 3-year old KSP saved game will still
work fine today is going to run into lots of other migration
issues besides just kOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant