Scaling issue on HDPI screen after CEF update

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Scaling issue on HDPI screen after CEF update

Postby sjoerd222888 » Sun Jun 04, 2023 4:13 pm

I have an application based on CefGlue but I assume the question here is rather specific to CEF than to CefGlue. Please correct me if my assumption is wrong.

The issue I have is that after an update from version 96.0.18+gfe551e4+chromium-96.0.4664.110 to version 112.3.0+gb09c4ca+chromium-112.0.5615.165 on Windows I see the following issue:

I have a setup where I have a HDPI screen and a normal screen (an old on). When I start the application on a HDPI screen the application is not using the full window to render. When I move the window to a non HDPI screen all is normal as it should. Then if I move the window again to the HDPI screen there is a scaling issue again. Do you have an idea what could be going wrong? What am I missing?

Application when starting on HDPI screen:
Back_On_HDPI_Screen.png
Back_On_HDPI_Screen.png (331.73 KiB) Viewed 4004 times


Application when moved to Non-DPI screen:
On-Non-HDPI-Screen.png
On-Non-HDPI-Screen.png (223.03 KiB) Viewed 4004 times


Application when moved back to HDPI screen:
Back_On_HDPI_Screen.png
Back_On_HDPI_Screen.png (331.73 KiB) Viewed 4004 times
Attachments
Starting_on_HDPI.png
Starting_on_HDPI.png (91.95 KiB) Viewed 4004 times
sjoerd222888
Techie
 
Posts: 15
Joined: Thu Jun 04, 2015 9:02 am

Re: Scaling issue on HDPI screen after CEF update

Postby magreenblatt » Mon Jun 05, 2023 1:18 am

Did you configure DPI awareness in the app manifest? See related at https://github.com/cefsharp/CefSharp/issues/4410
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Scaling issue on HDPI screen after CEF update

Postby sjoerd222888 » Sun Jun 11, 2023 4:09 pm

No I have not configured this, I have no app.manifest in fact.
Is there a way to do so programmatically? I found old threads in CefSharp about that but no answer did lead me to something that works.
sjoerd222888
Techie
 
Posts: 15
Joined: Thu Jun 04, 2015 9:02 am

Re: Scaling issue on HDPI screen after CEF update

Postby ndesktop » Mon Jun 12, 2023 1:27 am

You can use SetProcessDpiAwareness with PROCESS_SYSTEM_DPI_UNAWARE, PROCESS_SYSTEM_DPI_AWARE (or PROCESS_PER_MONITOR_DPI_AWARE if you customize per monitor) or the newer SetProcessDpiAwarenessContext available on Windows 10.
But MSDN recommends the manifest solution.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Scaling issue on HDPI screen after CEF update

Postby sjoerd222888 » Mon Jun 12, 2023 2:53 pm

Do I have to set this on the main process or on the rendering processes? Or on both?

I think I tried all variations but none of them worked for me. What could be wrong?
When I tried with
Code: Select all
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE)
in the main process then it returns false, but when I call
Code: Select all
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)
it returns (because it is maybe already stuck to that?). Even if this is my first line of code in the Main method...

But in case I set DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 what do I have to do that this is actually supported by my application? Do I need to do something special in a handler? I ask because I actually have some handler with a custom implementation.

Thanks for your patience, I feel a bit lost.
sjoerd222888
Techie
 
Posts: 15
Joined: Thu Jun 04, 2015 9:02 am

Re: Scaling issue on HDPI screen after CEF update

Postby ndesktop » Mon Jun 12, 2023 11:56 pm

You may want to check what Chromium does, specifically the EnableHighDPISupport call.
From what I see it appears to be called in the browser process, GPU process and in one subtype of utility process, media foundation CDM.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 35 guests