Sometimes when starting MicroEmulator the emulator window will cover the whole size but the map will only be drawn in a very small corner of the upper left screen (plus ImageCollector overscan). Resizing the emulator makes the map draw in the complete emulator window.
A similiar issue was previously solved with
http://gpsmid.git.sourceforge.net/git/gitweb.cgi?p=gpsmid/GpsMid;a=commit;h=7dd6be9c7127c7b7543f4519e27c7a5027b2304e
Before this sometimes the map started filling the full emulator window but TraceLayout was limited to a small area in the upper left corner of the emulator
just as if the map was smaller.
Therefore with changes from the last few days we have some kind of regression here as a similiar issue was introduced.
It seems to me there are a few issues with sizeChanged() and getWidth() /getHeight(), varying from platform to platform.
- getHeight() and maybe getWidth() apparently sometimes give bogus info when called from sizeChanged() (this is what seems to have happened to Karel; after layout change, getHeight() info apparently hadn't changed yet. I have a faint recollection of seeing something about this also in documentation (or discussion) for getHeight() or sizeChanged() when I looked at the issue I had with microemulator getting incorrect size a very long time ago)
- also maybe in some other situations, like when the device's display perhaps is not initialized yet (could be this with you on microemulator). I've seen this on e.g. Microemulator a long time ago, but not in recent months or maybe a year or so
- I added recently code to getWidth() / getHeight() at startup after your first mention of this, but apparently this didn't solve this for you?
- when canvas size is changed, appears with Karel's case getWidth() / getHeight() info is not yet updated
- apparently some devices give sizeChanged() event at startup to set initial screen size (possibly after the device display is initialized / mode changed), and some do not
- the commit you point to added calls get getHeight() / getWidth() to sizeChanged(), and seems to be this is exactly what didn't work with Karel's device(s). A real device is more important than microemu, so if my understanding is correct, we'll better keep it this way and maybe add a workaround for microemu
- as this happens only sometimes, probably a race condition. Maybe a bug in microemulator; maybe something which can be worked out by some microemulator specific changes (like if device == microemulator, start a timer to resize display after a few seconds). Anyway, didn't happen to me with microemu nowadays, not in a very long time.
There's isRunningInMicroEmulator() in the GpsMid class, that would allow to do adjustments just for MicroEmulator.