diff --git a/repos/gems/run/mixer_gui_qt_test.run b/repos/gems/run/mixer_gui_qt_test.run index 948f902ac9..87fad4f748 100644 --- a/repos/gems/run/mixer_gui_qt_test.run +++ b/repos/gems/run/mixer_gui_qt_test.run @@ -85,13 +85,15 @@ append config { + + - + @@ -107,8 +109,12 @@ append config { + + + + @@ -203,6 +209,9 @@ append config { + + + diff --git a/repos/libports/lib/mk/qt5_qpa_nitpicker.mk b/repos/libports/lib/mk/qt5_qpa_nitpicker.mk index f2ba9ad969..5f5e7e9902 100644 --- a/repos/libports/lib/mk/qt5_qpa_nitpicker.mk +++ b/repos/libports/lib/mk/qt5_qpa_nitpicker.mk @@ -11,6 +11,7 @@ SRC_CC = qgenericunixeventdispatcher.cpp \ SRC_CC += main.cpp \ qgenodeclipboard.cpp \ + qnitpickercursor.cpp \ qnitpickerglcontext.cpp \ qnitpickerintegration.cpp \ qnitpickerplatformwindow.cpp \ diff --git a/repos/libports/run/qt5.run b/repos/libports/run/qt5.run index 3eb86f869f..640d42f086 100644 --- a/repos/libports/run/qt5.run +++ b/repos/libports/run/qt5.run @@ -72,6 +72,15 @@ append config { + + + + + + + + + diff --git a/repos/libports/run/qt5_avplay.run b/repos/libports/run/qt5_avplay.run index f581000237..f6319a1264 100644 --- a/repos/libports/run/qt5_avplay.run +++ b/repos/libports/run/qt5_avplay.run @@ -64,6 +64,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_calculatorform.run b/repos/libports/run/qt5_calculatorform.run index 5c763196c6..a2d90f9abc 100644 --- a/repos/libports/run/qt5_calculatorform.run +++ b/repos/libports/run/qt5_calculatorform.run @@ -51,6 +51,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_common.inc b/repos/libports/run/qt5_common.inc index 1fa8ab4dfd..80ad26b404 100644 --- a/repos/libports/run/qt5_common.inc +++ b/repos/libports/run/qt5_common.inc @@ -68,7 +68,7 @@ proc qt5_start_nodes { feature_arg } { - + @@ -80,8 +80,12 @@ proc qt5_start_nodes { feature_arg } { + + + + @@ -102,6 +106,8 @@ proc qt5_start_nodes { feature_arg } { + + diff --git a/repos/libports/run/qt5_openglwindow.run b/repos/libports/run/qt5_openglwindow.run index 3b2ffc8b44..fcb9993f99 100644 --- a/repos/libports/run/qt5_openglwindow.run +++ b/repos/libports/run/qt5_openglwindow.run @@ -33,7 +33,7 @@ append config { - + } append config [qt5_start_nodes feature] @@ -42,8 +42,12 @@ append config { + + + + - + diff --git a/repos/libports/run/qt5_qpluginwidget.run b/repos/libports/run/qt5_qpluginwidget.run index c354a6348e..dc10814748 100644 --- a/repos/libports/run/qt5_qpluginwidget.run +++ b/repos/libports/run/qt5_qpluginwidget.run @@ -69,6 +69,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_quicktest.run b/repos/libports/run/qt5_quicktest.run index 20d6c1f25c..90815c0641 100644 --- a/repos/libports/run/qt5_quicktest.run +++ b/repos/libports/run/qt5_quicktest.run @@ -51,6 +51,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_samegame.run b/repos/libports/run/qt5_samegame.run index c8b9e8586b..d8a0c74914 100644 --- a/repos/libports/run/qt5_samegame.run +++ b/repos/libports/run/qt5_samegame.run @@ -51,6 +51,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_tetrix.run b/repos/libports/run/qt5_tetrix.run index 9bcb3c756c..f8419aa992 100644 --- a/repos/libports/run/qt5_tetrix.run +++ b/repos/libports/run/qt5_tetrix.run @@ -50,6 +50,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_textedit.run b/repos/libports/run/qt5_textedit.run index 0b0d7ec071..e3f42a272c 100644 --- a/repos/libports/run/qt5_textedit.run +++ b/repos/libports/run/qt5_textedit.run @@ -100,6 +100,9 @@ append config { + + + @@ -117,6 +120,9 @@ append config { + + + diff --git a/repos/libports/run/qt5_virtualkeyboard.run b/repos/libports/run/qt5_virtualkeyboard.run index fee9101bc0..0109751541 100644 --- a/repos/libports/run/qt5_virtualkeyboard.run +++ b/repos/libports/run/qt5_virtualkeyboard.run @@ -52,6 +52,9 @@ append config { + + + diff --git a/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickercursor.cpp b/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickercursor.cpp new file mode 100644 index 0000000000..5c0cab231c --- /dev/null +++ b/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickercursor.cpp @@ -0,0 +1,79 @@ +/* + * \brief QNitpickerCursor + * \author Christian Prochaska + * \date 2017-11-13 + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + + +/* Genode includes */ +#include + +/* Qt includes */ +#include +#include "qnitpickercursor.h" + +QT_BEGIN_NAMESPACE + +QNitpickerCursor::QNitpickerCursor(Genode::Env &env) +{ + try { + _shape_report_connection.construct(env, "shape", sizeof(Pointer::Shape_report)); + _shape_report_ds.construct(env.rm(), _shape_report_connection->dataspace()); + _shape_report = _shape_report_ds->local_addr(); + } catch (Genode::Service_denied) { } +} + +void QNitpickerCursor::changeCursor(QCursor *widgetCursor, QWindow *window) +{ + Q_UNUSED(window); + +#ifndef QT_NO_CURSOR + + if (!_shape_report) + return; + + const Qt::CursorShape shape = widgetCursor ? + widgetCursor->shape() : + Qt::ArrowCursor; + + _shape_report->visible = (shape != Qt::BlankCursor); + + QImage cursor; + + if (shape == Qt::BitmapCursor) { + // application supplied cursor + cursor = widgetCursor->pixmap().toImage(); + _shape_report->x_hot = widgetCursor->hotSpot().x(); + _shape_report->y_hot = widgetCursor->hotSpot().y(); + } else { + // system cursor + QPlatformCursorImage platformImage(0, 0, 0, 0, 0, 0); + platformImage.set(shape); + cursor = *platformImage.image(); + _shape_report->x_hot = platformImage.hotspot().x(); + _shape_report->y_hot = platformImage.hotspot().y(); + } + + cursor = cursor.convertToFormat(QImage::Format_RGBA8888); + + _shape_report->width = cursor.width(); + _shape_report->height = cursor.height(); + + memcpy(_shape_report->shape, cursor.constBits(), + cursor.width() * cursor.height() * 4); + + _shape_report_connection->submit(sizeof(Pointer::Shape_report)); + +#else // !QT_NO_CURSOR + Q_UNUSED(widgetCursor); +#endif +} + +QT_END_NAMESPACE diff --git a/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickercursor.h b/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickercursor.h new file mode 100644 index 0000000000..986074a6b9 --- /dev/null +++ b/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickercursor.h @@ -0,0 +1,45 @@ +/* + * \brief QNitpickerCursor + * \author Christian Prochaska + * \date 2017-11-13 + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + + +#ifndef _QNITPICKERCURSOR_H_ +#define _QNITPICKERCURSOR_H_ + +/* Genode includes */ +#include +#include +#include + +/* Qt includes */ +#include + +QT_BEGIN_NAMESPACE + +class QNitpickerCursor : public QPlatformCursor +{ + private: + + Genode::Constructible _shape_report_connection; + Genode::Constructible _shape_report_ds; + Pointer::Shape_report *_shape_report { nullptr }; + + public: + + QNitpickerCursor(Genode::Env &env); + + virtual void changeCursor(QCursor *widgetCursor, QWindow *window) override; +}; + +QT_END_NAMESPACE + +#endif /* _QNITPICKERCURSOR_H_ */ diff --git a/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickerscreen.h b/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickerscreen.h index b87a744b3c..1f1f6c767b 100644 --- a/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickerscreen.h +++ b/repos/libports/src/lib/qt5/qtbase/src/plugins/platforms/nitpicker/qnitpickerscreen.h @@ -15,12 +15,15 @@ #ifndef _QNITPICKERSCREEN_H_ #define _QNITPICKERSCREEN_H_ +/* Genode includes */ +#include + +/* Qt includes */ #include #include -/* Genode includes */ -#include +#include "qnitpickercursor.h" QT_BEGIN_NAMESPACE @@ -28,11 +31,12 @@ class QNitpickerScreen : public QPlatformScreen { private: - QRect _geometry; + Genode::Env &_env; + QRect _geometry; public: - QNitpickerScreen(Genode::Env &env) + QNitpickerScreen(Genode::Env &env) : _env(env) { Nitpicker::Connection _nitpicker(env); @@ -49,6 +53,12 @@ class QNitpickerScreen : public QPlatformScreen int depth() const { return 16; } QImage::Format format() const { return QImage::Format_RGB16; } QDpi logicalDpi() const { return QDpi(80, 80); }; + + QPlatformCursor *cursor() const + { + static QNitpickerCursor instance(_env); + return &instance; + } }; QT_END_NAMESPACE diff --git a/repos/ports/run/arora.run b/repos/ports/run/arora.run index 324400861b..b9ede4fd34 100644 --- a/repos/ports/run/arora.run +++ b/repos/ports/run/arora.run @@ -99,6 +99,9 @@ append config { + + +