From 9483adee465732cd8acc2bb1991dffdae813673c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Sat, 13 Aug 2022 13:03:23 +0200 Subject: PixelPaint: Expose the GUI event loop from the ImageEditor This allows processing threads to call back into the GUI. --- Userland/Applications/PixelPaint/ImageEditor.cpp | 1 + Userland/Applications/PixelPaint/ImageEditor.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 62cd342b49..05ce2e857f 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -30,6 +30,7 @@ constexpr int marching_ant_length = 4; ImageEditor::ImageEditor(NonnullRefPtr image) : m_image(move(image)) , m_title("Untitled") + , m_gui_event_loop(Core::EventLoop::current()) { set_focus_policy(GUI::FocusPolicy::StrongFocus); m_undo_stack.push(make(*m_image, String())); diff --git a/Userland/Applications/PixelPaint/ImageEditor.h b/Userland/Applications/PixelPaint/ImageEditor.h index b7d5888d43..d0e2bc4cb2 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.h +++ b/Userland/Applications/PixelPaint/ImageEditor.h @@ -12,6 +12,7 @@ #include "Image.h" #include "Selection.h" #include +#include #include #include #include @@ -114,6 +115,8 @@ public: void draw_marching_ants(Gfx::Painter&, Gfx::IntRect const&) const; void draw_marching_ants(Gfx::Painter&, Mask const&) const; + Core::EventLoop& gui_event_loop() { return m_gui_event_loop; } + private: explicit ImageEditor(NonnullRefPtr); @@ -179,6 +182,8 @@ private: int m_marching_ants_offset { 0 }; void draw_marching_ants_pixel(Gfx::Painter&, int x, int y) const; + + Core::EventLoop& m_gui_event_loop; }; } -- cgit v1.2.3