summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-08-13 13:03:23 +0200
committerSam Atkins <atkinssj@gmail.com>2022-09-27 14:23:11 +0100
commit9483adee465732cd8acc2bb1991dffdae813673c (patch)
tree664a951c1b63e1fd8c6c146d03382f8de41c2cc7
parent056b081e2d6fde75929ed56c3ce7054105d4e763 (diff)
downloadserenity-9483adee465732cd8acc2bb1991dffdae813673c.zip
PixelPaint: Expose the GUI event loop from the ImageEditor
This allows processing threads to call back into the GUI.
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp1
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.h5
2 files changed, 6 insertions, 0 deletions
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> 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<ImageUndoCommand>(*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 <AK/Variant.h>
+#include <LibCore/EventLoop.h>
#include <LibGUI/AbstractZoomPanWidget.h>
#include <LibGUI/Frame.h>
#include <LibGUI/UndoStack.h>
@@ -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<Image>);
@@ -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;
};
}