mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
LibGUI+FileSystemAccessServer: Avoid using dummy windows
Creates two new gatekept helpers for FilePicker and MessageBox to be used by FSAS to replace the "dummy window" approach to centering Dialogs. There was a slight delay in creating two windows, one a transparent intermediary hidden behind the second, to display FSAS Dialogs. Now we only need to make the window we actually see.
This commit is contained in:
parent
f76d24c2ec
commit
7323a54e59
6 changed files with 58 additions and 26 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/NumberFormat.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
|
@ -40,6 +41,18 @@ ErrorOr<Dialog::ExecResult> MessageBox::try_show(Window* parent_window, StringVi
|
|||
return box->exec();
|
||||
}
|
||||
|
||||
ErrorOr<Dialog::ExecResult> MessageBox::try_show(Badge<FileSystemAccessServer::ConnectionFromClient>, i32 window_server_client_id, i32 parent_window_id, StringView text, StringView title)
|
||||
{
|
||||
auto box = TRY(MessageBox::create(nullptr, text, title, MessageBox::Type::Warning, MessageBox::InputType::YesNo));
|
||||
auto parent_rect = ConnectionToWindowServer::the().get_window_rect_from_client(window_server_client_id, parent_window_id);
|
||||
box->center_within(parent_rect);
|
||||
box->constrain_to_desktop();
|
||||
box->set_screen_position(ScreenPosition::DoNotPosition);
|
||||
box->Dialog::show();
|
||||
ConnectionToWindowServer::the().set_window_parent_from_client(window_server_client_id, parent_window_id, box->window_id());
|
||||
return box->exec();
|
||||
}
|
||||
|
||||
Dialog::ExecResult MessageBox::show_error(Window* parent_window, StringView text)
|
||||
{
|
||||
return MUST(try_show_error(parent_window, text));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue