When running our C++ node addon in Electron high DPI settings/flags are not respected. The node addon on its own works fine until it's packaged with Electron.
Our node addon separately, in another process but called from within Electron, creates a new window with SDL that attempts to be DPI enabled via SDL_WINDOW_ALLOW_HIGHDPI
We aren't using new BrowserWindow and expecting Chrome to resize in this case!
Does not work in the following scenario:
- Running via
electron . - Running after a packaged .dmg
The Key in Info.plist High Resolution Capable is set to YES -- electron appears to auto-generate a default info.plist with it. (We do not set anything on our own) nor are we setting --extend-info
Electron Version:
- "electron": "^6.0.9", "electron-builder": "^21.2.0",
Operating System: macOS - 10.14.6
Expected Behavior
The program should be displayed in High DPI mode and respect what is being passed to SDL
For example, we should receive a SDL_WINDOWEVENT that tells us to resize the texture at a new width and height.
Actual Behavior
When moving a program window (not Electron created window) over to a Retina screen (macbook pro), it doesn't receive a new renderer output to resize too and doesn't appear high DPI aware
When we run our node addon separately, moving the window reconfigures the texture each time as soon as we move the screen enough to a different DPI screen.
To Reproduce
Set the following up in SDL:
// init
SDL_Window *window = SDL_CreateWindow(
"App name", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI)
SDL_Renderer *renderer =
SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
// configure texture
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
int o_width = 0, o_height = 0;
int ret = SDL_GetRendererOutputSize(ctx->renderer, &o_width, &o_height);
if (ret != 0) {
throw runtime_error("Could not get output renderer size\n");
}
printf("Output renderer size: %dx%d\n", o_width, o_height);
Questions
- How do ensure this works in dev when we do
electron . - How do make this successful work when packaged?