mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-07 10:21:30 +00:00
Move SkiaEventQueue to WinEventQueue
Added queueEvent() member function to EventQueue interface.
This commit is contained in:
parent
02f8fd7920
commit
41114580ae
@ -135,7 +135,7 @@ public:
|
|||||||
event.setType(Event::None);
|
event.setType(Event::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void queueEvent(const Event& event) {
|
void queueEvent(const Event& event) override {
|
||||||
m_events.push(event);
|
m_events.push(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ namespace she {
|
|||||||
public:
|
public:
|
||||||
virtual ~EventQueue() { }
|
virtual ~EventQueue() { }
|
||||||
virtual void getEvent(Event& ev, bool canWait) = 0;
|
virtual void getEvent(Event& ev, bool canWait) = 0;
|
||||||
|
virtual void queueEvent(const Event& ev) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace she
|
} // namespace she
|
||||||
|
@ -10,10 +10,20 @@
|
|||||||
|
|
||||||
#include "she/skia/skia_display.h"
|
#include "she/skia/skia_display.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "she/win/event_queue.h"
|
||||||
|
#else
|
||||||
|
#error Your platform does not have a EventQueue implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace she {
|
namespace she {
|
||||||
|
|
||||||
SkiaDisplay::SkiaDisplay(int width, int height, int scale)
|
SkiaDisplay::SkiaDisplay(int width, int height, int scale)
|
||||||
: m_window(&m_queue, this)
|
:
|
||||||
|
#ifdef _WIN32
|
||||||
|
m_queue(new WinEventQueue)
|
||||||
|
#endif
|
||||||
|
, m_window(m_queue, this)
|
||||||
, m_surface(new SkiaSurface)
|
, m_surface(new SkiaSurface)
|
||||||
{
|
{
|
||||||
m_surface->create(width, height);
|
m_surface->create(width, height);
|
||||||
@ -101,7 +111,7 @@ void SkiaDisplay::setTitleBar(const std::string& title)
|
|||||||
|
|
||||||
EventQueue* SkiaDisplay::getEventQueue()
|
EventQueue* SkiaDisplay::getEventQueue()
|
||||||
{
|
{
|
||||||
return &m_queue;
|
return m_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkiaDisplay::setNativeMouseCursor(NativeCursor cursor)
|
bool SkiaDisplay::setNativeMouseCursor(NativeCursor cursor)
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "she/display.h"
|
#include "she/display.h"
|
||||||
#include "she/skia/skia_event_queue.h"
|
|
||||||
#include "she/skia/skia_window.h"
|
#include "she/skia/skia_window.h"
|
||||||
|
|
||||||
namespace she {
|
namespace she {
|
||||||
@ -55,7 +54,7 @@ public:
|
|||||||
DisplayHandle nativeHandle() override;
|
DisplayHandle nativeHandle() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkiaEventQueue m_queue;
|
EventQueue* m_queue;
|
||||||
SkiaWindow m_window;
|
SkiaWindow m_window;
|
||||||
SkiaSurface* m_surface;
|
SkiaSurface* m_surface;
|
||||||
bool m_recreated;
|
bool m_recreated;
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
|
|
||||||
#include "she/skia/skia_window.h"
|
#include "she/skia/skia_window.h"
|
||||||
|
|
||||||
|
#include "she/event_queue.h"
|
||||||
#include "she/skia/skia_display.h"
|
#include "she/skia/skia_display.h"
|
||||||
|
|
||||||
namespace she {
|
namespace she {
|
||||||
|
|
||||||
SkiaWindow::SkiaWindow(SkiaEventQueue* queue, SkiaDisplay* display)
|
SkiaWindow::SkiaWindow(EventQueue* queue, SkiaDisplay* display)
|
||||||
: m_queue(queue)
|
: m_queue(queue)
|
||||||
, m_display(display)
|
, m_display(display)
|
||||||
{
|
{
|
||||||
|
@ -14,22 +14,22 @@
|
|||||||
#error There is no Window implementation
|
#error There is no Window implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "she/skia/skia_event_queue.h"
|
|
||||||
#include "she/skia/skia_surface.h"
|
#include "she/skia/skia_surface.h"
|
||||||
|
|
||||||
namespace she {
|
namespace she {
|
||||||
|
|
||||||
|
class EventQueue;
|
||||||
class SkiaDisplay;
|
class SkiaDisplay;
|
||||||
|
|
||||||
class SkiaWindow : public Window<SkiaWindow> {
|
class SkiaWindow : public Window<SkiaWindow> {
|
||||||
public:
|
public:
|
||||||
SkiaWindow(SkiaEventQueue* queue, SkiaDisplay* display);
|
SkiaWindow(EventQueue* queue, SkiaDisplay* display);
|
||||||
void queueEventImpl(Event& ev);
|
void queueEventImpl(Event& ev);
|
||||||
void paintImpl(HDC hdc);
|
void paintImpl(HDC hdc);
|
||||||
void resizeImpl(const gfx::Size& size);
|
void resizeImpl(const gfx::Size& size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkiaEventQueue* m_queue;
|
EventQueue* m_queue;
|
||||||
SkiaDisplay* m_display;
|
SkiaDisplay* m_display;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
#ifndef SHE_SKIA_SKIA_EVENT_QUEUE_INCLUDED
|
#ifndef SHE_WIN_EVENT_QUEUE_INCLUDED
|
||||||
#define SHE_SKIA_SKIA_EVENT_QUEUE_INCLUDED
|
#define SHE_WIN_EVENT_QUEUE_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
namespace she {
|
namespace she {
|
||||||
|
|
||||||
class SkiaEventQueue : public EventQueue {
|
class WinEventQueue : public EventQueue {
|
||||||
public:
|
public:
|
||||||
SkiaEventQueue() : m_stop(false) {
|
WinEventQueue() : m_stop(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void getEvent(Event& ev, bool canWait) override {
|
void getEvent(Event& ev, bool canWait) override {
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void queueEvent(Event& ev) {
|
void queueEvent(const Event& ev) override {
|
||||||
if (ev.type() == Event::CloseDisplay)
|
if (ev.type() == Event::CloseDisplay)
|
||||||
m_stop = true;
|
m_stop = true;
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user