Comments (17)
Was there a regression of sorts? I think the pull request was for old version of this library that used the msedge HTML, and needs to be fixed for webview2 Edge implementation too.
I'm testing the webview_rust in Windows 10, the windows are blurry.
For webview_rust one can fix it like this:
Cargo.toml
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["shellscalingapi"] }
main.rs
fn main() {
#[cfg(target_os = "windows")]
unsafe {
winapi::um::shellscalingapi::SetProcessDpiAwareness(2);
}
// Rest of the application ...
from webview.
This library also doesn't support display scaling from KDE, when the display is scaled, the GTK+ webkit doesn't scale properly and elements are too small.
from webview.
from webview.
I have a fix for windows that extends the minimal-go example.
package main
import (
"syscall"
"github.com/zserge/webview"
)
func scale() {
modshcore := syscall.NewLazyDLL("Shcore.dll")
shc := modshcore.NewProc("SetProcessDpiAwareness")
shc.Call(uintptr(1))
}
func main() {
// Open wikipedia in a 800x600 resizable window
scale()
webview.Open("Minimal webview example",
"https://en.m.wikipedia.org/wiki/Main_Page", 800, 600, true)
}
No idea about mac so sorry about that but I hope this helps.
from webview.
I'm also interested in this...
from webview.
Right click the exe file -> properties -> compatibility, there's an option "Override high DPI scaling behavior". Check it.
This is equal to write register "/Software/Microsoft/Windows NT/CurrentVersion/AppCompatFlags/Layers" KEY:path/to/exe VALUE:"~HIGHDPIAWARE"
from webview.
Woah that was a quick reply. :) I took a drink of coffee, looked back over and here it is. Nice thank you for the great project
from webview.
Did this PR ever get merged?
from webview.
Relevant page? https://msdn.microsoft.com/en-us/library/dn265030(v=vs.85).aspx
from webview.
Hm, I don't think that's the solution. In my normal IE11 on Win8.1, the same site looks HDPI but if I open it with webview, it looks low-res.. It must be some setting for the MSHTML engine.
from webview.
Yeah, I noticed that too
from webview.
Probably related to application DPI awareness:
EDIT:
Verified with Visual Studio 2013 Community
Project->Properties->Configuration Properties->Manifest Tool->Input and Output->DPI Awareness
change from None
to High DPI Aware
.
Per Monitor High DPI Aware
needs handling of additional messages, so initially it would be harder, but it would react faster on DPI setting change.
Unfortunately High DPI Aware
on Windows 10 needs log off and log in after change to work correctly.
Or edit manifest manually:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
Or early in WinMain call
SetProcessDpiAwareness( PROCESS_SYSTEM_DPI_AWARE );
Or
SetProcessDpiAwareness( PROCESS_PER_MONITOR_DPI_AWARE );
from webview.
Use the following code to adjust width and height automatically
HDC hDC = GetDC(NULL);
w->width = GetDeviceCaps(hDC, 88)*w->width/96.0;
w->height = GetDeviceCaps(hDC, 90)*w->height/96.0;
ReleaseDC(NULL, hDC);
and this works fine for most examples.
from webview.
I have a pull request which fixes this.
from webview.
When I execute binary files directly, the application is not blurred. But when the application is packaged and run, the window becomes blurred. I use macOS.
https://github.com/mantou132/evernote-webview
// fixed: NSHighResolutionCapable
from webview.
So recently, I started using this library again and I've found a workaround for Linux. ✨
Use winit
to get the scale factor and set the scale factor as the zoom level on the webview instead.
First, get the scale factor
let scale_factor = {
use winit::{event_loop::EventLoop, window::WindowBuilder};
let event_loop = EventLoop::new();
let window = WindowBuilder::new()
.with_maximized(false)
.with_visible(false)
.build(&event_loop)?;
let scale_factor = window.scale_factor();
println!("Scale factor: {}", scale_factor);
drop(window);
scale_factor
};
Then, instantiate the webview and call set_zoom_level
on the webview.
webview.set_zoom_level(scale_factor);
from webview.
Closing as stale. The current situation on Windows is that the library enables DPI awareness.
from webview.
Related Issues (20)
- examples/basic: Blank screen HOT 18
- How to correctly render the web page? HOT 3
- Q: HTTP communication over unix domain sockets HOT 1
- Add troubleshooting hint to readme about where to get CMake on windows machines.
- Calling Webview::eval on some JS code does not work. HOT 7
- How to pass a javascript function as an arg to C/C++? HOT 1
- [bug] utf8 support for webbind HOT 17
- How to stream bytes to webview?
- Handling webview as part of a library causes segfault when setting variables (Linux/C++) HOT 1
- Looking for Qt binding project
- One Window multiple webviews HOT 5
- Update to webkitgtk-6.0 (GTK4, libsoup 3) HOT 1
- How to run javascript code passed as an html string to the webview in secure context? HOT 1
- Call webview_eval from thread HOT 1
- enable microphone in MacOs Sonoma ?
- Mac OS - JS mousedown is not working properly HOT 2
- Cannot use set_html with string longer than 1572834 characters on Windows HOT 4
- Font not property rendered in macos using webgl HOT 1
- how Inject JavaScript code?
- Not work when embed into a win32 window HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webview.