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

Set DPI awareness for chromium_subp to "System Aware" #42

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions native/chromium_subp/src/bin/chromium_subp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ use std::os::raw::c_int;
use std::ptr::null_mut;

fn main() {
// Disable High DPI per Monitor support.
// By default Chromium enables the "PerMonitorV2" strategy for high DPI awareness. However SWT does not yet support
// "PerMonitorV2", but only "System" DPI awareness. Mismatching DPI awareness between the render process (chromium)
// and the host process (swt/java) causes strange visual artifacts.
//
// Thus set "System" DPI awareness here, to override Chromiums default to match SWT.
unsafe {
winapi::um::winuser::SetProcessDpiAwarenessContext(
winapi::shared::windef::DPI_AWARENESS_CONTEXT_SYSTEM_AWARE,
);
}

let main_args = chromium::utils::prepare_args();
let mut app = app::App::new();
let exit_code: c_int =
Expand Down