diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-19 00:01:02 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-19 00:01:02 +0100 |
commit | 57ff293a51d97742d50987950c86dfcde55e6ad1 (patch) | |
tree | 44cb31375a62808be2b743758bc6c42c574b4afa /LibGUI/GClipboard.cpp | |
parent | 55aa8190773721f1dc0a3f49bedea6ed8524b318 (diff) | |
download | serenity-57ff293a51d97742d50987950c86dfcde55e6ad1.zip |
LibGUI: Implement nested event loops to support dialog boxes.
This patch adds a simple GMessageBox that can run in a nested event loop.
Here's how you use it:
GMessageBox box("Message text here", "Message window title");
int result = box.exec();
The next step is to make the WindowServer respect the modality flag of
these windows and prevent interaction with other windows in the same
process until the modal window has been closed.
Diffstat (limited to 'LibGUI/GClipboard.cpp')
-rw-r--r-- | LibGUI/GClipboard.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/LibGUI/GClipboard.cpp b/LibGUI/GClipboard.cpp index d6fe9efba3..9a349a157d 100644 --- a/LibGUI/GClipboard.cpp +++ b/LibGUI/GClipboard.cpp @@ -19,7 +19,7 @@ String GClipboard::data() const { WSAPI_ClientMessage request; request.type = WSAPI_ClientMessage::Type::GetClipboardContents; - auto response = GEventLoop::main().sync_request(request, WSAPI_ServerMessage::Type::DidGetClipboardContents); + auto response = GEventLoop::current().sync_request(request, WSAPI_ServerMessage::Type::DidGetClipboardContents); if (response.clipboard.shared_buffer_id < 0) return { }; auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(response.clipboard.shared_buffer_id); @@ -38,7 +38,7 @@ void GClipboard::set_data(const String& data) { WSAPI_ClientMessage request; request.type = WSAPI_ClientMessage::Type::SetClipboardContents; - auto shared_buffer = SharedBuffer::create(GEventLoop::main().server_pid(), data.length() + 1); + auto shared_buffer = SharedBuffer::create(GEventLoop::current().server_pid(), data.length() + 1); if (!shared_buffer) { dbgprintf("GClipboard::set_data() failed to create a shared buffer\n"); return; @@ -50,6 +50,6 @@ void GClipboard::set_data(const String& data) shared_buffer->seal(); request.clipboard.shared_buffer_id = shared_buffer->shared_buffer_id(); request.clipboard.contents_size = data.length(); - auto response = GEventLoop::main().sync_request(request, WSAPI_ServerMessage::Type::DidSetClipboardContents); + auto response = GEventLoop::current().sync_request(request, WSAPI_ServerMessage::Type::DidSetClipboardContents); ASSERT(response.clipboard.shared_buffer_id == shared_buffer->shared_buffer_id()); } |