You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is DPI awareness issue. The example sets DPI awareness via a call to cef.DpiAware.EnableHighDpiSupport, but the call occurs too late in Python programs on some machines, it's a race condition. DPI awareness needs to be set for the executable before Python program executes. Same for the subprocess.exe executable that runs the Renderer subprocess. If you remove the call to EnableHighDpiSupport you will get rid of double rendering, but it will result in a different rendering issue with app appearing blurry.
It is recommended to set High DPI awareness through manifest that is attached inside or next to executable. Such manifest must be added for both main executable and subprocess executable. Sometimes it is too late to set DPI awareness during runtime, so it must be set through manifest. If you want to fix the issue on a developer machine then go find python.exe executable and set appropriate file properties. On Windows 7 select "Compatibility" tab and check "Disable display scaling on high DPI settings".
For example to set DPI awareness through manifest create two files: myapp.exe.manifest and subprocess.exe.manifest in the same directory where myapp.exe and subprocess.exe executables reside. Edit both of these manifest files, so that they contain these contents:
When using pyinstaller you might not be able to embed manifest inside myapp.exe executable, in my case it resulted in errors. In such case you have to modify the existing manifest file that is placed next to exe, it was generated by pyinstaller. You cannot overwrite it entirely with a new file, because it contains other necessary options, so manual editing is required. Embedding manifest inside subprocess.exe executable will alway work fine.
I've recently spent some time working through a similar issue in our cefpython-based app.
The app is intended to run on a Dell tablet running Windows 10 where the system Display Scale setting is very likely to be greater than 100%. It is using CEF 66, python 3.7.3 and wxPython 4.0.6.
The app was exhibiting the rendering artefact described and illustrated in this issue whereby the UI is drawn twice - once at the desired scale, and a duplicated, smaller version aligned in the top left of the screen. Touch and mouse events would go to the right place in the full-sized UI, but the updates would only be rendered in the smaller version.
Setting a chrome switch to disable GPU compositing has 'fixed' this issue.
@cztomczak I saw the comment and tried putting a .manifest next to both the python.exe and the subprocess.exe that are the entry points for our app. I'm not sure that they are doing anything - my reading suggests the python.exe has an embedded manifest and therefore ignores the .manifest next to it. We're not building our own executable at the moment, just running python.exe scriptname.py to startup.
I've been unable to get the layout I want in the browser by setting the High DPI scaling override on the application executable, so I haven't looked into manifests any further, assuming that it wouldn't give me the result I was after.
Thanks for your attention :)
@pi-slh The issue is with DPI support and fixing it by disabling GPU is not a good idea. Unless you have a different issue. What do you mean by "I've been unable to get the layout I want in the browser by setting the High DPI scaling override on the application executable"? Are you sure you've checked the right option? Have you tested with original wxpython.py example?
changed the title [-]cef.DpiAware.EnableHighDpiSupport() doesn't work well[/-][+]cef.DpiAware.EnableHighDpiSupport() doesn't work well. Update pyinstaller example to embed High DPI manifest files in exe's.[/+]on Jan 16, 2020
Activity
cztomczak commentedon Jun 24, 2019
The wxpython.py example supports High DPI by default. Does it work for you?
Please provide exact steps to reproduce your issue from the screenshot.
amstaff8 commentedon Jun 24, 2019
Same result. My steps:
This is the output:
[wxpython.py] System DPI settings: (192, 192)
[wxpython.py] wx.GetDisplayPPI = (267, 267)
[wxpython.py] wx.GetDisplaySize = (2736, 1824)
[wxpython.py] MainFrame declared size: (900, 640)
[wxpython.py] MainFrame DPI scaled size: (1800, 1280)
[wxpython.py] MainFrame actual size: (1800, 1280)
And this is the result:
This is my resolution:
cztomczak commentedon Jun 24, 2019
This is DPI awareness issue. The example sets DPI awareness via a call to
cef.DpiAware.EnableHighDpiSupport
, but the call occurs too late in Python programs on some machines, it's a race condition. DPI awareness needs to be set for the executable before Python program executes. Same for the subprocess.exe executable that runs the Renderer subprocess. If you remove the call toEnableHighDpiSupport
you will get rid of double rendering, but it will result in a different rendering issue with app appearing blurry.It is recommended to set High DPI awareness through manifest that is attached inside or next to executable. Such manifest must be added for both main executable and subprocess executable. Sometimes it is too late to set DPI awareness during runtime, so it must be set through manifest. If you want to fix the issue on a developer machine then go find python.exe executable and set appropriate file properties. On Windows 7 select "Compatibility" tab and check "Disable display scaling on high DPI settings".
For example to set DPI awareness through manifest create two files:
myapp.exe.manifest
andsubprocess.exe.manifest
in the same directory wheremyapp.exe
andsubprocess.exe
executables reside. Edit both of these manifest files, so that they contain these contents:Some users report that this still doesn't work for them and it works only after embedding manifest inside the exe with such command:
When using pyinstaller you might not be able to embed manifest inside myapp.exe executable, in my case it resulted in errors. In such case you have to modify the existing manifest file that is placed next to exe, it was generated by pyinstaller. You cannot overwrite it entirely with a new file, because it contains other necessary options, so manual editing is required. Embedding manifest inside subprocess.exe executable will alway work fine.
pi-slh commentedon Jul 31, 2019
I've recently spent some time working through a similar issue in our cefpython-based app.
The app is intended to run on a Dell tablet running Windows 10 where the system Display Scale setting is very likely to be greater than 100%. It is using CEF 66, python 3.7.3 and wxPython 4.0.6.
The app was exhibiting the rendering artefact described and illustrated in this issue whereby the UI is drawn twice - once at the desired scale, and a duplicated, smaller version aligned in the top left of the screen. Touch and mouse events would go to the right place in the full-sized UI, but the updates would only be rendered in the smaller version.
Setting a chrome switch to disable GPU compositing has 'fixed' this issue.
Using any of these switches 'fixes' the issue.
The solution in my situation is;
I've seen this issue on Dell machines with integrated Intel GPUs and with an Nvidia card.
I haven't identified a root cause.
cztomczak commentedon Jul 31, 2019
@pi-slh Have you embedded a DPI aware manifest in your app? See my comment: #530 (comment)
pi-slh commentedon Jul 31, 2019
@cztomczak I saw the comment and tried putting a .manifest next to both the python.exe and the subprocess.exe that are the entry points for our app. I'm not sure that they are doing anything - my reading suggests the python.exe has an embedded manifest and therefore ignores the .manifest next to it. We're not building our own executable at the moment, just running
python.exe scriptname.py
to startup.I've been unable to get the layout I want in the browser by setting the High DPI scaling override on the application executable, so I haven't looked into manifests any further, assuming that it wouldn't give me the result I was after.
Thanks for your attention :)
cztomczak commentedon Jul 31, 2019
@pi-slh The issue is with DPI support and fixing it by disabling GPU is not a good idea. Unless you have a different issue. What do you mean by "I've been unable to get the layout I want in the browser by setting the High DPI scaling override on the application executable"? Are you sure you've checked the right option? Have you tested with original wxpython.py example?
dfb commentedon Nov 30, 2019
For anyone stuck on this, it never worked for me using a manifest file next to the exe, but it did work if I embedded the manifest inside the exe:
mt.exe -nologo -manifest subprocess.exe.manifest -outputresource:"subprocess.exe;1"
[-]cef.DpiAware.EnableHighDpiSupport() doesn't work well[/-][+]cef.DpiAware.EnableHighDpiSupport() doesn't work well. Update pyinstaller example to embed High DPI manifest files in exe's.[/+]cztomczak commentedon Jan 16, 2020
We should update the pyinstaller example to embed the necessary High DPI manifest files in the exe's. Marking this for next release.
18 remaining items