window created twice

Found a bug in R'n'D? Report it here!

Moderators: Flumminator, Zomis

Post Reply
filbo
Posts: 536
Joined: Fri Jun 20, 2014 10:06 am

window created twice

Post by filbo »

This happens to me approximately 100% of the time that I start RnD...

I start the game, then immediately drag its window to where I want it.

Moments later, the game closes that window and opens a new one -- at the previous location. I drag it again.

Can you please either:

- don't close and reopen the window
- or, notice if the first window has been dragged; open the new window in the dropped location

?

(First one is better because there's nothing sensible you can do if the window re-creation happens in mid-drag...)

Linux, SDL2, I don't think any details are needed...
User avatar
Holger
Site Admin
Posts: 3578
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: window created twice

Post by Holger »

Does this always happen, or only if you start R'n'D with a last played level set that has custom window dimensions?

I have tested this and was only able to reproduce this in the above mentioned latter case, like when starting R'n'D with one of the level sets from the EMC collection (which use a different windows size). What happens in this case is that R'n'D finds out that the last played level set has different window dimensions, and therefore reopens the window with these changed dimensions.

This also happens whenever you select another level set with window dimensions that differ from the current dimensions.

When implementing support for different window dimensions, I have though about these issues, but so far did not come up with a better solution. (Just resizing the window at its current position would be another solution, which has its own potentially nasty side effects.)
filbo
Posts: 536
Joined: Fri Jun 20, 2014 10:06 am

Re: window created twice

Post by filbo »

It happens 100% of the time when starting the same levelset over and over. It's an EMC levelset (emc_haunted_mine_3), and I have half-size graphics turned on.

If that isn't sufficient to reproduce it, I can send you my setup.conf...
User avatar
Holger
Site Admin
Posts: 3578
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: window created twice

Post by Holger »

OK, then it's perfectly clear: The game starts with default window size, finds out that it has to use a different window size, and re-creates the window with that different size. So this indeed happens every time you start the game.

If this is a "bug or feature" (when compared to resizing the existing windows instead of re-creating it) probably depends on what you're doing: If you like to have the game window centered on the screen, the current behaviour is probably what you want. If you like to have the game window in the lower right corner, both resizing and re-creating are probably not what you want.

Maybe I should really add a "-g" (geometry) style command line option, so the game could use (and keep) a specified x/y position in such cases... :-)

Or maybe you have a better idea to handle this problem?
filbo
Posts: 536
Joined: Fri Jun 20, 2014 10:06 am

Re: window created twice

Post by filbo »

For my purposes -- all I want is that if I had dragged the window to a different place, it stays there. When you tear down the 1st and open the 2nd window, can you read out its location beforehand? Either by reading it immediately before, or by having a 'window being dragged' handler? I don't know what facilities are available in SDL...
filbo
Posts: 536
Joined: Fri Jun 20, 2014 10:06 am

Re: window created twice

Post by filbo »

If the window's going to be a different size, I guess there is a question of what 'same place' means. Same upper left corner, or same center, I guess; and upper left makes more sense to me.
Post Reply