qt5: use main entrypoint in QPA plugin

Fixes #3644
This commit is contained in:
Christian Prochaska 2020-02-05 19:52:50 +01:00 committed by Christian Helmuth
parent 28e782dda5
commit 9bd3d2aa5c
7 changed files with 15 additions and 53 deletions

View File

@ -48,7 +48,6 @@ class QNitpickerPlatformWindow : public QObject, public QPlatformWindow
bool _framebuffer_changed; bool _framebuffer_changed;
bool _geometry_changed; bool _geometry_changed;
Framebuffer::Mode _current_mode; Framebuffer::Mode _current_mode;
Genode::Entrypoint &_signal_ep;
Nitpicker::Session::View_handle _view_handle; Nitpicker::Session::View_handle _view_handle;
Input::Session_client _input_session; Input::Session_client _input_session;
Genode::Attached_dataspace _ev_buf; Genode::Attached_dataspace _ev_buf;
@ -83,8 +82,8 @@ class QNitpickerPlatformWindow : public QObject, public QPlatformWindow
void _key_event(Input::Keycode, Codepoint, Mapped_key::Event); void _key_event(Input::Keycode, Codepoint, Mapped_key::Event);
void _mouse_button_event(Input::Keycode, bool press); void _mouse_button_event(Input::Keycode, bool press);
Genode::Signal_handler<QNitpickerPlatformWindow> _input_signal_handler; Genode::Io_signal_handler<QNitpickerPlatformWindow> _input_signal_handler;
Genode::Signal_handler<QNitpickerPlatformWindow> _mode_changed_signal_handler; Genode::Io_signal_handler<QNitpickerPlatformWindow> _mode_changed_signal_handler;
QVector<QWindowSystemInterface::TouchPoint> _touch_points { 16 }; QVector<QWindowSystemInterface::TouchPoint> _touch_points { 16 };
QTouchDevice *_touch_device; QTouchDevice *_touch_device;
@ -97,20 +96,12 @@ class QNitpickerPlatformWindow : public QObject, public QPlatformWindow
QString _sanitize_label(QString label); QString _sanitize_label(QString label);
private Q_SLOTS:
void _handle_input(); void _handle_input();
void _handle_mode_changed(); void _handle_mode_changed();
Q_SIGNALS:
void _input();
void _mode_changed();
public: public:
QNitpickerPlatformWindow(Genode::Env &env, QWindow *window, QNitpickerPlatformWindow(Genode::Env &env, QWindow *window,
Genode::Entrypoint &signal_ep,
int screen_width, int screen_height); int screen_width, int screen_height);
~QNitpickerPlatformWindow(); ~QNitpickerPlatformWindow();

View File

@ -40,11 +40,7 @@ QPlatformIntegration *QNitpickerIntegrationPlugin::create(const QString& system,
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (system.toLower() == "nitpicker") { if (system.toLower() == "nitpicker") {
assert(_env != nullptr); assert(_env != nullptr);
Genode::Entrypoint *signal_ep = return new QNitpickerIntegration(*_env);
new Genode::Entrypoint(*_env, 2*1024*sizeof(Genode::addr_t),
"QPA signal handler",
Genode::Affinity::Location());
return new QNitpickerIntegration(*_env, *signal_ep);
} }
return 0; return 0;

View File

@ -27,8 +27,8 @@ QT_BEGIN_NAMESPACE
static constexpr bool verbose = false; static constexpr bool verbose = false;
QGenodeClipboard::QGenodeClipboard(Genode::Env &env, Genode::Entrypoint &sig_ep) QGenodeClipboard::QGenodeClipboard(Genode::Env &env)
: _clipboard_signal_handler(sig_ep, *this, &QGenodeClipboard::_handle_clipboard) : _clipboard_signal_handler(env.ep(), *this, &QGenodeClipboard::_handle_clipboard)
{ {
try { try {

View File

@ -33,7 +33,7 @@ class QGenodeClipboard : public QPlatformClipboard
private: private:
Genode::Attached_rom_dataspace *_clipboard_ds = nullptr; Genode::Attached_rom_dataspace *_clipboard_ds = nullptr;
Genode::Signal_handler<QGenodeClipboard> _clipboard_signal_handler; Genode::Io_signal_handler<QGenodeClipboard> _clipboard_signal_handler;
Genode::Reporter *_clipboard_reporter = nullptr; Genode::Reporter *_clipboard_reporter = nullptr;
@ -45,7 +45,7 @@ class QGenodeClipboard : public QPlatformClipboard
public: public:
QGenodeClipboard(Genode::Env &env, Genode::Entrypoint &sig_ep); QGenodeClipboard(Genode::Env &env);
~QGenodeClipboard(); ~QGenodeClipboard();
QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);

View File

@ -29,10 +29,8 @@ QT_BEGIN_NAMESPACE
static const bool verbose = false; static const bool verbose = false;
QNitpickerIntegration::QNitpickerIntegration(Genode::Env &env, QNitpickerIntegration::QNitpickerIntegration(Genode::Env &env)
Genode::Entrypoint &signal_ep)
: _env(env), : _env(env),
_signal_ep(signal_ep),
_nitpicker_screen(new QNitpickerScreen(env)) { } _nitpicker_screen(new QNitpickerScreen(env)) { }
@ -52,7 +50,6 @@ QPlatformWindow *QNitpickerIntegration::createPlatformWindow(QWindow *window) co
QRect screen_geometry = _nitpicker_screen->geometry(); QRect screen_geometry = _nitpicker_screen->geometry();
return new QNitpickerPlatformWindow(_env, window, return new QNitpickerPlatformWindow(_env, window,
_signal_ep,
screen_geometry.width(), screen_geometry.width(),
screen_geometry.height()); screen_geometry.height());
} }
@ -95,7 +92,7 @@ QPlatformFontDatabase *QNitpickerIntegration::fontDatabase() const
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
QPlatformClipboard *QNitpickerIntegration::clipboard() const QPlatformClipboard *QNitpickerIntegration::clipboard() const
{ {
static QGenodeClipboard cb(_env, _signal_ep); static QGenodeClipboard cb(_env);
return &cb; return &cb;
} }
#endif #endif

View File

@ -30,24 +30,12 @@ class QNitpickerIntegration : public QPlatformIntegration
private: private:
Genode::Env &_env; Genode::Env &_env;
Genode::Entrypoint &_signal_ep;
QNitpickerScreen *_nitpicker_screen; QNitpickerScreen *_nitpicker_screen;
QScopedPointer<QPlatformInputContext> m_inputContext;
/*
* A reference to the signal receiver gets passed to newly created
* objects, for example in 'createPlatformWindow()'. Since this is
* a const member function, the signal receiver cannot be a member
* variable of QNitpickerIntegration.
*/
static Genode::Signal_receiver &_signal_receiver();
QScopedPointer<QPlatformInputContext> m_inputContext;
public: public:
QNitpickerIntegration(Genode::Env &env, QNitpickerIntegration(Genode::Env &env);
Genode::Entrypoint &signal_ep);
void initialize() Q_DECL_OVERRIDE; void initialize() Q_DECL_OVERRIDE;
bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;

View File

@ -493,7 +493,6 @@ QString QNitpickerPlatformWindow::_sanitize_label(QString label)
QNitpickerPlatformWindow::QNitpickerPlatformWindow(Genode::Env &env, QWindow *window, QNitpickerPlatformWindow::QNitpickerPlatformWindow(Genode::Env &env, QWindow *window,
Genode::Entrypoint &signal_ep,
int screen_width, int screen_height) int screen_width, int screen_height)
: QPlatformWindow(window), : QPlatformWindow(window),
_env(env), _env(env),
@ -503,17 +502,16 @@ QNitpickerPlatformWindow::QNitpickerPlatformWindow(Genode::Env &env, QWindow *wi
_framebuffer(0), _framebuffer(0),
_framebuffer_changed(false), _framebuffer_changed(false),
_geometry_changed(false), _geometry_changed(false),
_signal_ep(signal_ep),
_view_handle(_create_view()), _view_handle(_create_view()),
_input_session(env.rm(), _nitpicker_session.input_session()), _input_session(env.rm(), _nitpicker_session.input_session()),
_ev_buf(env.rm(), _input_session.dataspace()), _ev_buf(env.rm(), _input_session.dataspace()),
_resize_handle(!window->flags().testFlag(Qt::Popup)), _resize_handle(!window->flags().testFlag(Qt::Popup)),
_decoration(!window->flags().testFlag(Qt::Popup)), _decoration(!window->flags().testFlag(Qt::Popup)),
_egl_surface(EGL_NO_SURFACE), _egl_surface(EGL_NO_SURFACE),
_input_signal_handler(_signal_ep, *this, _input_signal_handler(_env.ep(), *this,
&QNitpickerPlatformWindow::_input), &QNitpickerPlatformWindow::_handle_input),
_mode_changed_signal_handler(_signal_ep, *this, _mode_changed_signal_handler(_env.ep(), *this,
&QNitpickerPlatformWindow::_mode_changed), &QNitpickerPlatformWindow::_handle_mode_changed),
_touch_device(_init_touch_device()) _touch_device(_init_touch_device())
{ {
if (qnpw_verbose) if (qnpw_verbose)
@ -535,14 +533,6 @@ QNitpickerPlatformWindow::QNitpickerPlatformWindow(Genode::Env &env, QWindow *wi
_nitpicker_session.enqueue<Command::To_front>(_view_handle); _nitpicker_session.enqueue<Command::To_front>(_view_handle);
_nitpicker_session.execute(); _nitpicker_session.execute();
} }
connect(this, SIGNAL(_input()),
this, SLOT(_handle_input()),
Qt::QueuedConnection);
connect(this, SIGNAL(_mode_changed()),
this, SLOT(_handle_mode_changed()),
Qt::QueuedConnection);
} }
QNitpickerPlatformWindow::~QNitpickerPlatformWindow() QNitpickerPlatformWindow::~QNitpickerPlatformWindow()