Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Canvas resize event is sent only once #66
This port detects if the canvas is CSS-resized by assigning it dimensions and checking right after if the effective dimensions are the same. If not, this sets window->external_size forever and resize events are emitted.
When the test is run for the second time, the canvas was already resized once and the initial and CSS-resized dimensions match. window->external_size is then reset to 0 and resize events are not emitted anymore.
We could either try to find a better detection algorithm (fixing both cases), or avoid zero-ing window->external_size if it was already to 1 (fixing the second case).
What do you think?
Yeah, the window gets destroyed.
It's for HiDPI where we need to set the CSS size of the canvas to the window size and the canvas size to the window size * pixel ratio, but not if the user has already set a size through CSS. I guess we could always set it to 1 if the
Your idea appears to work without graphical artifact :)
Incidentally SDL_RecreateWindow is also called when using SDL_CreateWindowAndRenderer combo function.