1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-12 02:30:30 +09:00

LibGUI: Port the drag&drop code to Core::MimeData

This commit is contained in:
Andreas Kling 2020-02-14 13:18:34 +01:00
parent 3cba9c3c25
commit 814d59f462
Notes: sideshowbarker 2024-07-19 09:20:38 +09:00
10 changed files with 59 additions and 53 deletions

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibCore/MimeData.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h>
@ -309,8 +310,11 @@ void WindowServerConnection::handle(const Messages::WindowClient::AsyncSetWallpa
void WindowServerConnection::handle(const Messages::WindowClient::DragDropped& message)
{
if (auto* window = Window::from_window_id(message.window_id()))
Core::EventLoop::current().post_event(*window, make<DropEvent>(message.mouse_position(), message.text(), message.data_type(), message.data()));
if (auto* window = Window::from_window_id(message.window_id())) {
auto mime_data = Core::MimeData::construct();
mime_data->set_data(message.data_type(), message.data().to_byte_buffer());
Core::EventLoop::current().post_event(*window, make<DropEvent>(message.mouse_position(), message.text(), mime_data));
}
}
void WindowServerConnection::handle(const Messages::WindowClient::DragAccepted&)