mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +00:00
Ladybird/AppKit: Listen for device pixel ratio changes
This commit is contained in:
parent
7718842829
commit
0574c0e474
6 changed files with 28 additions and 5 deletions
|
@ -87,6 +87,7 @@ struct HideCursor {
|
|||
screen_rects.unchecked_append(screen_rect);
|
||||
}
|
||||
|
||||
// This returns device pixel ratio of the screen the window is opened in
|
||||
auto device_pixel_ratio = [[NSScreen mainScreen] backingScaleFactor];
|
||||
|
||||
m_web_view_bridge = MUST(Ladybird::WebViewBridge::create(move(screen_rects), device_pixel_ratio, [delegate webdriverContentIPCPath], [delegate preferredColorScheme]));
|
||||
|
@ -130,6 +131,13 @@ struct HideCursor {
|
|||
[self updateStatusLabelPosition];
|
||||
}
|
||||
|
||||
- (void)handleDevicePixelRatioChange
|
||||
{
|
||||
m_web_view_bridge->set_device_pixel_ratio([[self window] backingScaleFactor]);
|
||||
[self updateViewportRect:Ladybird::WebViewBridge::ForResize::Yes];
|
||||
[self updateStatusLabelPosition];
|
||||
}
|
||||
|
||||
- (void)handleScroll
|
||||
{
|
||||
[self updateViewportRect:Ladybird::WebViewBridge::ForResize::No];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue