1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:07:35 +00:00

PixelPaint: Expose the GUI event loop from the ImageEditor

This allows processing threads to call back into the GUI.
This commit is contained in:
kleines Filmröllchen 2022-08-13 13:03:23 +02:00 committed by Sam Atkins
parent 056b081e2d
commit 9483adee46
2 changed files with 6 additions and 0 deletions

View file

@ -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()));

View file

@ -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;
};
}