mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 10:06:03 +00:00
Ladybird/Qt: Wire up screen added and removed events
This commit is contained in:
parent
dfc7534eef
commit
cb9e0c4e64
Notes:
sideshowbarker
2024-07-17 03:03:44 +09:00
Author: https://github.com/shannonbooth
Commit: cb9e0c4e64
Pull-request: https://github.com/SerenityOS/serenity/pull/23855
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/awesomekling
1 changed files with 8 additions and 2 deletions
|
@ -74,6 +74,14 @@ WebContentView::WebContentView(QWidget* window, WebContentOptions const& web_con
|
|||
update_viewport_rect();
|
||||
});
|
||||
|
||||
QObject::connect(qGuiApp, &QGuiApplication::screenRemoved, [this](QScreen*) {
|
||||
update_screen_rects();
|
||||
});
|
||||
|
||||
QObject::connect(qGuiApp, &QGuiApplication::screenAdded, [this](QScreen*) {
|
||||
update_screen_rects();
|
||||
});
|
||||
|
||||
initialize_client((parent_client == nullptr) ? CreateNewClient::Yes : CreateNewClient::No);
|
||||
|
||||
on_did_layout = [this](auto content_size) {
|
||||
|
@ -539,8 +547,6 @@ void WebContentView::update_screen_rects()
|
|||
screen_rects.append(Web::DevicePixelRect(geometry.x(), geometry.y(), geometry.width(), geometry.height()));
|
||||
}
|
||||
|
||||
// FIXME: Update the screens again when QGuiApplication::screenAdded/Removed signals are emitted
|
||||
|
||||
// NOTE: The first item in QGuiApplication::screens is always the primary screen.
|
||||
// This is not specified in the documentation but QGuiApplication::primaryScreen
|
||||
// always returns the first item in the list if it isn't empty.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue