mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-01 08:48:20 +00:00
parent
0fb672b493
commit
a507928cde
@ -194,13 +194,12 @@ append config {
|
||||
<start name="mixer_gui_qt" caps="200">
|
||||
<resource name="RAM" quantum="32M"/>
|
||||
<config ld_verbose="yes">
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<tar name="qt5_fs_mixer_gui_qt.tar"/>
|
||||
<!--<dir name="config"> <fs label="config"/> </dir>-->
|
||||
</vfs>
|
||||
</libc>
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<tar name="qt5_fs_mixer_gui_qt.tar"/>
|
||||
<!--<dir name="config"> <fs label="config"/> </dir>-->
|
||||
</vfs>
|
||||
<libc stdout="/dev/log" stderr="/dev/log"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Nitpicker"> <child name="wm"/> </service>
|
||||
@ -233,11 +232,12 @@ exec tar chf bin/qt5_fs_mixer_gui_qt.tar -C bin/qt5_fs/mixer_gui_qt .
|
||||
|
||||
set boot_modules {
|
||||
core ld.lib.so init timer
|
||||
libc.lib.so posix.lib.so
|
||||
libc.lib.so
|
||||
|
||||
report_rom dynamic_rom ram_fs
|
||||
fs_rom
|
||||
|
||||
qt5_component.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_widgets.lib.so
|
||||
qt5_xml.lib.so
|
||||
|
@ -8,4 +8,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
main_window.o: main_window.moc
|
||||
|
||||
LIBS += config qoost posix
|
||||
LIBS += config qoost qt5_component
|
||||
|
@ -130,7 +130,7 @@ class QPluginWidget : public QEmbeddedViewWidget
|
||||
int max_width = -1, int max_height = -1);
|
||||
~QPluginWidget();
|
||||
|
||||
static void set_env(Libc::Env *env) { _env = env; }
|
||||
static void env(Libc::Env &env) { _env = &env; }
|
||||
};
|
||||
|
||||
#endif // QPLUGINWIDGET_H
|
||||
|
7
repos/libports/lib/mk/qt5_component.mk
Normal file
7
repos/libports/lib/mk/qt5_component.mk
Normal file
@ -0,0 +1,7 @@
|
||||
SRC_CC = qt_component.cc
|
||||
|
||||
LIBS = libc
|
||||
|
||||
SHARED_LIB = yes
|
||||
|
||||
vpath qt_component.cc $(REP_DIR)/src/lib/qt5
|
@ -88,13 +88,13 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_widgets.lib.so
|
||||
|
@ -67,13 +67,13 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_widgets.lib.so
|
||||
|
@ -66,13 +66,13 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_widgets.lib.so
|
||||
|
@ -86,7 +86,6 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libcrypto.lib.so
|
||||
libm.lib.so
|
||||
@ -95,6 +94,7 @@ append boot_modules {
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_qnitpickerviewwidget.lib.so
|
||||
|
@ -70,7 +70,6 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libcrypto.lib.so
|
||||
libm.lib.so
|
||||
@ -79,6 +78,7 @@ append boot_modules {
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_network.lib.so
|
||||
qt5_qml.lib.so
|
||||
|
@ -70,7 +70,6 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libcrypto.lib.so
|
||||
libm.lib.so
|
||||
@ -79,6 +78,7 @@ append boot_modules {
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_network.lib.so
|
||||
qt5_qml.lib.so
|
||||
|
@ -66,13 +66,13 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_widgets.lib.so
|
||||
|
@ -128,13 +128,13 @@ append boot_modules {
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
posix.lib.so
|
||||
libc_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
jpeg.lib.so
|
||||
pcre16.lib.so
|
||||
pthread.lib.so
|
||||
qt5_component.lib.so
|
||||
qt5_core.lib.so
|
||||
qt5_gui.lib.so
|
||||
qt5_widgets.lib.so
|
||||
|
@ -16,4 +16,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
LIBS += qt5_component
|
||||
|
@ -16,4 +16,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
LIBS += qt5_component
|
||||
|
@ -37,4 +37,4 @@ $(addprefix $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/, $(SAMEGAME3_RESOURCES)): $(
|
||||
$(addprefix $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/shared/pics/, $(SAMEGAME_RESOURCES)): $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/shared/pics
|
||||
$(VERBOSE)ln -sf $(QT5_CONTRIB_DIR)/qtdeclarative/examples/quick/tutorials/samegame/shared/pics/$(notdir $@) $@
|
||||
|
||||
LIBS += posix
|
||||
LIBS += qt5_component
|
||||
|
@ -18,4 +18,4 @@ CC_CXX_OPT += -DQT_NO_SCRIPTTOOLS
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
LIBS += qt5_component
|
||||
|
@ -16,4 +16,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
LIBS += qt5_component
|
||||
|
@ -78,19 +78,21 @@ class Avplay_slave : public QObject
|
||||
* Configure libc of avplay to direct output to LOG and to obtain
|
||||
* the mediafile from ROM.
|
||||
*/
|
||||
|
||||
QDomElement vfs_node = config_doc.createElement("vfs");
|
||||
QDomElement vfs_dev_node = config_doc.createElement("dir");
|
||||
vfs_dev_node.setAttribute("name", "dev");
|
||||
QDomElement vfs_dev_log_node = config_doc.createElement("log");
|
||||
vfs_dev_node.appendChild(vfs_dev_log_node);
|
||||
vfs_node.appendChild(vfs_dev_node);
|
||||
QDomElement vfs_mediafile_node = config_doc.createElement("rom");
|
||||
vfs_mediafile_node.setAttribute("name", "mediafile");
|
||||
vfs_node.appendChild(vfs_mediafile_node);
|
||||
config_node.appendChild(vfs_node);
|
||||
|
||||
QDomElement libc_node = config_doc.createElement("libc");
|
||||
libc_node.setAttribute("stdout", "/dev/log");
|
||||
libc_node.setAttribute("stderr", "/dev/log");
|
||||
QDomElement libc_vfs_node = config_doc.createElement("vfs");
|
||||
QDomElement libc_vfs_dev_node = config_doc.createElement("dir");
|
||||
libc_vfs_dev_node.setAttribute("name", "dev");
|
||||
QDomElement libc_vfs_dev_log_node = config_doc.createElement("log");
|
||||
libc_vfs_dev_node.appendChild(libc_vfs_dev_log_node);
|
||||
libc_vfs_node.appendChild(libc_vfs_dev_node);
|
||||
QDomElement libc_vfs_mediafile_node = config_doc.createElement("rom");
|
||||
libc_vfs_mediafile_node.setAttribute("name", "mediafile");
|
||||
libc_vfs_node.appendChild(libc_vfs_mediafile_node);
|
||||
libc_node.appendChild(libc_vfs_node);
|
||||
config_node.appendChild(libc_node);
|
||||
|
||||
QDomElement sdl_audio_volume_node = config_doc.createElement("sdl_audio_volume");
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
/* Qt includes */
|
||||
#include <QApplication>
|
||||
#include <qnitpickerintegrationplugin.h>
|
||||
|
||||
/* qt_avplay includes */
|
||||
#include "main_window.h"
|
||||
@ -33,14 +34,18 @@ static inline void load_stylesheet()
|
||||
qApp->setStyleSheet(QLatin1String(file.readAll()));
|
||||
}
|
||||
|
||||
|
||||
extern int genode_argc;
|
||||
extern char **genode_argv;
|
||||
extern void initialize_qpa_plugin(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
QApplication app(genode_argc, genode_argv);
|
||||
|
||||
initialize_qpa_plugin(env);
|
||||
|
||||
int argc = 1;
|
||||
char const *argv[] = { "qt_avplay", 0 };
|
||||
|
||||
QApplication app(argc, (char**)argv);
|
||||
|
||||
load_stylesheet();
|
||||
|
||||
|
@ -32,6 +32,7 @@ struct Framebuffer_filter
|
||||
Main_window::Main_window(Genode::Env &env)
|
||||
:
|
||||
_env(env),
|
||||
_mediafile_name(env),
|
||||
_control_bar(_input_session_component)
|
||||
{
|
||||
_input_session_component.event_queue().enabled(true);
|
||||
@ -56,7 +57,8 @@ Main_window::Main_window(Genode::Env &env)
|
||||
|
||||
static QList<Framebuffer_filter*> framebuffer_filters;
|
||||
try {
|
||||
Xml_node node = config()->xml_node().sub_node("framebuffer_filter");
|
||||
Genode::Attached_rom_dataspace config(_env, "config");
|
||||
Xml_node node = config.xml().sub_node("framebuffer_filter");
|
||||
for (; ; node = node.next("framebuffer_filter")) {
|
||||
Framebuffer_filter *framebuffer_filter = new Framebuffer_filter;
|
||||
node.attribute("name").value(framebuffer_filter->name, sizeof(framebuffer_filter->name));
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include <qoost/qmember.h>
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/service.h>
|
||||
#include <input/root.h>
|
||||
#include <os/config.h>
|
||||
#include <rom_session/connection.h>
|
||||
|
||||
/* local includes */
|
||||
@ -46,11 +46,12 @@ class Main_window : public Compound_widget<QWidget, QVBoxLayout>
|
||||
enum { MAX_LEN_MEDIAFILE_NAME = 256 };
|
||||
char buf[MAX_LEN_MEDIAFILE_NAME];
|
||||
|
||||
Mediafile_name()
|
||||
Mediafile_name(Genode::Env &env)
|
||||
{
|
||||
Genode::strncpy(buf, "mediafile", sizeof(buf));
|
||||
try {
|
||||
Genode::config()->xml_node().sub_node("mediafile")
|
||||
Genode::Attached_rom_dataspace config(env, "config");
|
||||
config.xml().sub_node("mediafile")
|
||||
.attribute("name").value(buf, sizeof(buf));
|
||||
} catch(...) {
|
||||
Genode::warning("no <mediafile> config node found, using \"mediafile\"");
|
||||
|
@ -15,9 +15,6 @@
|
||||
#include <libc/component.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
extern int genode_argc;
|
||||
extern char **genode_argv;
|
||||
|
||||
namespace Qt_launchpad_namespace {
|
||||
struct Local_env;
|
||||
using namespace Genode;
|
||||
@ -66,13 +63,20 @@ struct Qt_launchpad_namespace::Local_env : Genode::Env
|
||||
}
|
||||
};
|
||||
|
||||
extern void initialize_qpa_plugin(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qpa_plugin(env);
|
||||
|
||||
Qt_launchpad_namespace::Local_env local_env(env);
|
||||
|
||||
QApplication a(genode_argc, genode_argv);
|
||||
int argc = 1;
|
||||
char const *argv[] = { "qt_launchpad", 0 };
|
||||
|
||||
QApplication a(argc, (char**)argv);
|
||||
|
||||
Qt_launchpad launchpad(local_env, env.ram().avail_ram().value);
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
Qt_launchpad::Qt_launchpad(Genode::Env &env, unsigned long initial_quota,
|
||||
QWidget *parent)
|
||||
: QMainWindow(parent), Launchpad(env, initial_quota)
|
||||
: QMainWindow(parent), Launchpad(env, initial_quota), _env(env)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@ -59,7 +59,7 @@ void Qt_launchpad::_avail_quota_update()
|
||||
{
|
||||
static Genode::size_t _avail = 0;
|
||||
|
||||
Genode::size_t new_avail = Genode::env()->ram_session()->avail_ram().value;
|
||||
Genode::size_t new_avail = _env.ram().avail_ram().value;
|
||||
|
||||
if (new_avail != _avail)
|
||||
quota(new_avail);
|
||||
|
@ -23,6 +23,10 @@ class Qt_launchpad : public QMainWindow, public Launchpad, private Ui::Qt_launch
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
|
||||
private slots:
|
||||
|
||||
void _avail_quota_update();
|
||||
|
@ -6,4 +6,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
LIBS += qt5_component
|
||||
|
@ -7,7 +7,6 @@
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <dataspace/client.h>
|
||||
#include <os/timed_semaphore.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <util/arg_string.h>
|
||||
|
||||
@ -70,21 +69,21 @@ class Signal_wait_thread : public QThread
|
||||
private:
|
||||
|
||||
Signal_receiver &_signal_receiver;
|
||||
Timed_semaphore &_timeout_semaphore;
|
||||
QMutex &_timeout_mutex;
|
||||
|
||||
protected:
|
||||
|
||||
void run()
|
||||
{
|
||||
_signal_receiver.wait_for_signal();
|
||||
_timeout_semaphore.up();
|
||||
_timeout_mutex.unlock();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Signal_wait_thread(Signal_receiver &signal_receiver, Timed_semaphore &timeout_semaphore)
|
||||
Signal_wait_thread(Signal_receiver &signal_receiver, QMutex &timeout_mutex)
|
||||
: _signal_receiver(signal_receiver),
|
||||
_timeout_semaphore(timeout_semaphore) { }
|
||||
_timeout_mutex(timeout_mutex) { }
|
||||
};
|
||||
|
||||
|
||||
@ -141,7 +140,7 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf
|
||||
|
||||
Dataspace_capability ds = _pc->alloc_rom_module(file_name.toUtf8().constData(), file_size);
|
||||
if (ds.valid()) {
|
||||
void *ds_addr = env()->rm_session()->attach(ds);
|
||||
void *ds_addr = _env->rm().attach(ds);
|
||||
|
||||
z_stream zs;
|
||||
zs.next_in = (Bytef*)(file_buf.data());
|
||||
@ -159,7 +158,7 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf
|
||||
_plugin_loading_state = INFLATE_ERROR;
|
||||
|
||||
inflateEnd(&zs);
|
||||
env()->rm_session()->detach(ds_addr);
|
||||
_env->rm().detach(ds_addr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -169,19 +168,19 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf
|
||||
_plugin_loading_state = INFLATE_ERROR;
|
||||
|
||||
inflateEnd(&zs);
|
||||
env()->rm_session()->detach(ds_addr);
|
||||
_env->rm().detach(ds_addr);
|
||||
return;
|
||||
}
|
||||
|
||||
inflateEnd(&zs);
|
||||
|
||||
env()->rm_session()->detach(ds_addr);
|
||||
_env->rm().detach(ds_addr);
|
||||
_pc->commit_rom_module(file_name.toUtf8().constData());
|
||||
}
|
||||
} else {
|
||||
Genode::size_t ram_quota = Arg_string::find_arg(_args.constData(), "ram_quota").ulong_value(0);
|
||||
|
||||
if (((long)env()->ram_session()->avail_ram().value - (long)ram_quota) <
|
||||
if (((long)_env->ram().avail_ram().value - (long)ram_quota) <
|
||||
QPluginWidget::PRESERVED_RAM_QUOTA) {
|
||||
_plugin_loading_state = RAM_QUOTA_EXCEEDED_ERROR;
|
||||
return;
|
||||
@ -193,18 +192,18 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf
|
||||
|
||||
Dataspace_capability plugin_ds = _pc->alloc_rom_module("plugin.tar", file_buf.size());
|
||||
if (plugin_ds.valid()) {
|
||||
void *plugin_ds_addr = env()->rm_session()->attach(plugin_ds);
|
||||
void *plugin_ds_addr = _env->rm().attach(plugin_ds);
|
||||
::memcpy(plugin_ds_addr, file_buf.constData(), file_buf.size());
|
||||
env()->rm_session()->detach(plugin_ds_addr);
|
||||
_env->rm().detach(plugin_ds_addr);
|
||||
_pc->commit_rom_module("plugin.tar");
|
||||
}
|
||||
}
|
||||
|
||||
Dataspace_capability config_ds = _pc->alloc_rom_module("config", ::strlen(config) + 1);
|
||||
if (config_ds.valid()) {
|
||||
void *config_ds_addr = env()->rm_session()->attach(config_ds);
|
||||
void *config_ds_addr = _env->rm().attach(config_ds);
|
||||
::memcpy(config_ds_addr, config, ::strlen(config) + 1);
|
||||
env()->rm_session()->detach(config_ds_addr);
|
||||
_env->rm().detach(config_ds_addr);
|
||||
_pc->commit_rom_module("config");
|
||||
}
|
||||
|
||||
@ -216,13 +215,12 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf
|
||||
_pc->parent_view(_parent_view);
|
||||
_pc->start("init", "init");
|
||||
|
||||
Timed_semaphore view_ready_semaphore;
|
||||
Signal_wait_thread signal_wait_thread(sig_rec, view_ready_semaphore);
|
||||
QMutex view_ready_mutex;
|
||||
Signal_wait_thread signal_wait_thread(sig_rec, view_ready_mutex);
|
||||
signal_wait_thread.start();
|
||||
try {
|
||||
view_ready_semaphore.down(10000);
|
||||
if (view_ready_mutex.tryLock(10000)) {
|
||||
_plugin_loading_state = LOADED;
|
||||
} catch (Timeout_exception) {
|
||||
} else {
|
||||
_plugin_loading_state = TIMEOUT_EXCEPTION;
|
||||
signal_wait_thread.terminate();
|
||||
}
|
||||
@ -237,17 +235,17 @@ void PluginStarter::run()
|
||||
QString file_name = _plugin_url.path().remove("/");
|
||||
|
||||
try {
|
||||
Rom_connection rc(file_name.toLatin1().constData());
|
||||
Rom_connection rc(_env, file_name.toLatin1().constData());
|
||||
|
||||
Dataspace_capability rom_ds = rc.dataspace();
|
||||
|
||||
char const *rom_ds_addr = (char const *)env()->rm_session()->attach(rom_ds);
|
||||
char const *rom_ds_addr = (char const *)_env->rm().attach(rom_ds);
|
||||
|
||||
QByteArray file_buf = QByteArray::fromRawData(rom_ds_addr, Dataspace_client(rom_ds).size());
|
||||
|
||||
_start_plugin(file_name, file_buf);
|
||||
|
||||
env()->rm_session()->detach(rom_ds_addr);
|
||||
_env->rm().detach(rom_ds_addr);
|
||||
|
||||
} catch (Rom_connection::Rom_connection_failed) {
|
||||
_plugin_loading_state = ROM_CONNECTION_FAILED_EXCEPTION;
|
||||
|
37
repos/libports/src/lib/qt5/qt_component.cc
Normal file
37
repos/libports/src/lib/qt5/qt_component.cc
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* \brief Entry point for Qt applications with a main() function
|
||||
* \author Christian Prochaska
|
||||
* \date 2017-05-22
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 <libc/component.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <stdlib.h> /* 'exit' */
|
||||
|
||||
/* provided by the application */
|
||||
extern "C" int main(int argc, char const **argv);
|
||||
|
||||
void initialize_qpa_plugin(Genode::Env &env) __attribute__((weak));
|
||||
void initialize_qpa_plugin(Genode::Env &) { }
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qpa_plugin(env);
|
||||
|
||||
int argc = 1;
|
||||
char const *argv[] = { "qt5_app", 0 };
|
||||
|
||||
exit(main(argc, argv));
|
||||
});
|
||||
}
|
@ -11,25 +11,39 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
|
||||
/* Qt includes */
|
||||
#include "qnitpickerintegrationplugin.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Genode::Env *QNitpickerIntegrationPlugin::_env = nullptr;
|
||||
|
||||
void initialize_qpa_plugin(Genode::Env &env)
|
||||
{
|
||||
QNitpickerIntegrationPlugin::env(env);
|
||||
}
|
||||
|
||||
|
||||
QStringList QNitpickerIntegrationPlugin::keys() const
|
||||
{
|
||||
QStringList list;
|
||||
list << "Nitpicker";
|
||||
return list;
|
||||
QStringList list;
|
||||
list << "Nitpicker";
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
QPlatformIntegration *QNitpickerIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||
{
|
||||
qDebug() << "QNitpickerIntegrationPlugin::create()";
|
||||
Q_UNUSED(paramList);
|
||||
if (system.toLower() == "nitpicker")
|
||||
return new QNitpickerIntegration;
|
||||
Q_UNUSED(paramList);
|
||||
if (system.toLower() == "nitpicker") {
|
||||
assert(_env != nullptr);
|
||||
return new QNitpickerIntegration(*_env);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_IMPORT_PLUGIN(QNitpickerIntegrationPlugin)
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/config.h>
|
||||
#include <util/xml_node.h>
|
||||
|
||||
/* Qt includes */
|
||||
@ -28,36 +27,39 @@ QT_BEGIN_NAMESPACE
|
||||
static constexpr bool verbose = false;
|
||||
|
||||
|
||||
QGenodeClipboard::QGenodeClipboard(Genode::Signal_receiver &sig_rcv)
|
||||
QGenodeClipboard::QGenodeClipboard(Genode::Env &env, Genode::Signal_receiver &sig_rcv)
|
||||
: _clipboard_signal_dispatcher(sig_rcv, *this, &QGenodeClipboard::_handle_clipboard)
|
||||
{
|
||||
if (Genode::config()->xml_node().attribute_value("clipboard", false)) {
|
||||
try {
|
||||
|
||||
try {
|
||||
Genode::Attached_rom_dataspace config(env, "config");
|
||||
|
||||
_clipboard_ds = new (Genode::env()->heap())
|
||||
Genode::Attached_rom_dataspace("clipboard");
|
||||
if (config.xml().attribute_value("clipboard", false)) {
|
||||
|
||||
_clipboard_ds->sigh(_clipboard_signal_dispatcher);
|
||||
_clipboard_ds->update();
|
||||
try {
|
||||
|
||||
} catch (...) { }
|
||||
_clipboard_ds = new Genode::Attached_rom_dataspace(env, "clipboard");
|
||||
|
||||
try {
|
||||
_clipboard_reporter = new (Genode::env()->heap())
|
||||
Genode::Reporter("clipboard");
|
||||
_clipboard_reporter->enabled(true);
|
||||
} catch (...) { }
|
||||
_clipboard_ds->sigh(_clipboard_signal_dispatcher);
|
||||
_clipboard_ds->update();
|
||||
|
||||
}
|
||||
} catch (...) { }
|
||||
|
||||
try {
|
||||
_clipboard_reporter = new Genode::Reporter(env, "clipboard");
|
||||
_clipboard_reporter->enabled(true);
|
||||
} catch (...) { }
|
||||
|
||||
}
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
|
||||
QGenodeClipboard::~QGenodeClipboard()
|
||||
{
|
||||
free(_decoded_clipboard_content);
|
||||
destroy(Genode::env()->heap(), _clipboard_ds);
|
||||
destroy(Genode::env()->heap(), _clipboard_reporter);
|
||||
delete _clipboard_ds;
|
||||
delete _clipboard_reporter;
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ class QGenodeClipboard : public QPlatformClipboard
|
||||
|
||||
public:
|
||||
|
||||
QGenodeClipboard(Genode::Signal_receiver &sig_rcv);
|
||||
QGenodeClipboard(Genode::Env &env, Genode::Signal_receiver &sig_rcv);
|
||||
~QGenodeClipboard();
|
||||
QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
|
||||
void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
|
||||
|
@ -32,9 +32,10 @@ Genode::Signal_receiver &QNitpickerIntegration::_signal_receiver()
|
||||
return _inst;
|
||||
}
|
||||
|
||||
QNitpickerIntegration::QNitpickerIntegration()
|
||||
: _signal_handler_thread(_signal_receiver()),
|
||||
_nitpicker_screen(new QNitpickerScreen())
|
||||
QNitpickerIntegration::QNitpickerIntegration(Genode::Env &env)
|
||||
: _env(env),
|
||||
_signal_handler_thread(_signal_receiver()),
|
||||
_nitpicker_screen(new QNitpickerScreen(env))
|
||||
{
|
||||
_signal_handler_thread.start();
|
||||
}
|
||||
@ -55,7 +56,7 @@ QPlatformWindow *QNitpickerIntegration::createPlatformWindow(QWindow *window) co
|
||||
qDebug() << "QNitpickerIntegration::createPlatformWindow(" << window << ")";
|
||||
|
||||
QRect screen_geometry = _nitpicker_screen->geometry();
|
||||
return new QNitpickerPlatformWindow(window,
|
||||
return new QNitpickerPlatformWindow(_env, window,
|
||||
_signal_receiver(),
|
||||
screen_geometry.width(),
|
||||
screen_geometry.height());
|
||||
@ -94,7 +95,7 @@ QPlatformFontDatabase *QNitpickerIntegration::fontDatabase() const
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
QPlatformClipboard *QNitpickerIntegration::clipboard() const
|
||||
{
|
||||
static QGenodeClipboard cb(_signal_receiver());
|
||||
static QGenodeClipboard cb(_env, _signal_receiver());
|
||||
return &cb;
|
||||
}
|
||||
#endif
|
||||
|
@ -29,6 +29,8 @@ class QNitpickerIntegration : public QPlatformIntegration
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
|
||||
QSignalHandlerThread _signal_handler_thread;
|
||||
|
||||
QNitpickerScreen *_nitpicker_screen;
|
||||
@ -43,7 +45,7 @@ class QNitpickerIntegration : public QPlatformIntegration
|
||||
|
||||
public:
|
||||
|
||||
QNitpickerIntegration();
|
||||
QNitpickerIntegration(Genode::Env &env);
|
||||
|
||||
void initialize() Q_DECL_OVERRIDE;
|
||||
bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
|
||||
|
@ -14,7 +14,10 @@
|
||||
#ifndef _QNITPICKERINTEGRATIONPLUGIN_H_
|
||||
#define _QNITPICKERINTEGRATIONPLUGIN_H_
|
||||
|
||||
#include <QDebug>
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
|
||||
/* Qt includes */
|
||||
#include <qpa/qplatformintegrationplugin.h>
|
||||
#include "qnitpickerintegration.h"
|
||||
|
||||
@ -24,9 +27,15 @@ class QNitpickerIntegrationPlugin : public QPlatformIntegrationPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" FILE "nitpicker.json")
|
||||
|
||||
private:
|
||||
static Genode::Env *_env;
|
||||
|
||||
public:
|
||||
QStringList keys() const;
|
||||
QPlatformIntegration *create(const QString&, const QStringList&);
|
||||
|
||||
static void env(Genode::Env &env) { _env = &env; }
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -220,7 +220,9 @@ void QNitpickerPlatformWindow::_handle_input(unsigned int)
|
||||
Qt::ControlModifier);
|
||||
} else {
|
||||
|
||||
char const utf8_string[] = { utf8.b0, utf8.b1, utf8.b2, utf8.b3, '\0' };
|
||||
char const utf8_string[] = { (char)utf8.b0, (char)utf8.b1,
|
||||
(char)utf8.b2, (char)utf8.b3,
|
||||
'\0' };
|
||||
|
||||
QWindowSystemInterface::handleKeyEvent(0, QEvent::KeyPress, 0, 0,
|
||||
QString::fromUtf8(utf8_string));
|
||||
@ -322,17 +324,20 @@ void QNitpickerPlatformWindow::_adjust_and_set_geometry(const QRect &rect)
|
||||
emit framebuffer_changed();
|
||||
}
|
||||
|
||||
QNitpickerPlatformWindow::QNitpickerPlatformWindow(QWindow *window,
|
||||
QNitpickerPlatformWindow::QNitpickerPlatformWindow(Genode::Env &env, QWindow *window,
|
||||
Genode::Signal_receiver &signal_receiver,
|
||||
int screen_width, int screen_height)
|
||||
: QPlatformWindow(window),
|
||||
_env(env),
|
||||
_nitpicker_session(env),
|
||||
_framebuffer_session(_nitpicker_session.framebuffer_session()),
|
||||
_framebuffer(0),
|
||||
_framebuffer_changed(false),
|
||||
_geometry_changed(false),
|
||||
_signal_receiver(signal_receiver),
|
||||
_view_handle(_create_view()),
|
||||
_input_session(_nitpicker_session.input_session()),
|
||||
_input_session(env.rm(), _nitpicker_session.input_session()),
|
||||
_ev_buf(env.rm(), _input_session.dataspace()),
|
||||
_keyboard_handler("", -1, false, false, ""),
|
||||
_resize_handle(!window->flags().testFlag(Qt::Popup)),
|
||||
_decoration(!window->flags().testFlag(Qt::Popup)),
|
||||
@ -355,9 +360,6 @@ QNitpickerPlatformWindow::QNitpickerPlatformWindow(QWindow *window,
|
||||
|
||||
_adjust_and_set_geometry(geometry());
|
||||
|
||||
_ev_buf = static_cast<Input::Event *>
|
||||
(Genode::env()->rm_session()->attach(_input_session.dataspace()));
|
||||
|
||||
if (_view_handle.valid()) {
|
||||
|
||||
/* bring the view to the top */
|
||||
@ -690,9 +692,9 @@ unsigned char *QNitpickerPlatformWindow::framebuffer()
|
||||
_framebuffer_changed = false;
|
||||
|
||||
if (_framebuffer != 0)
|
||||
Genode::env()->rm_session()->detach(_framebuffer);
|
||||
_env.rm().detach(_framebuffer);
|
||||
|
||||
_framebuffer = Genode::env()->rm_session()->attach(_framebuffer_session.dataspace());
|
||||
_framebuffer = _env.rm().attach(_framebuffer_session.dataspace());
|
||||
}
|
||||
|
||||
return _framebuffer;
|
||||
|
@ -44,6 +44,7 @@ class QNitpickerPlatformWindow : public QObject, public QPlatformWindow
|
||||
KEY_REPEAT_RATE_MS = 50 /* 50 ms delay between repetitions */
|
||||
};
|
||||
|
||||
Genode::Env &_env;
|
||||
Nitpicker::Connection _nitpicker_session;
|
||||
Framebuffer::Session_client _framebuffer_session;
|
||||
unsigned char *_framebuffer;
|
||||
@ -53,7 +54,7 @@ class QNitpickerPlatformWindow : public QObject, public QPlatformWindow
|
||||
Genode::Signal_receiver &_signal_receiver;
|
||||
Nitpicker::Session::View_handle _view_handle;
|
||||
Input::Session_client _input_session;
|
||||
Input::Event *_ev_buf;
|
||||
Genode::Attached_dataspace _ev_buf;
|
||||
Qt::MouseButtons _mouse_button_state;
|
||||
QEvdevKeyboardHandler _keyboard_handler;
|
||||
QByteArray _title;
|
||||
@ -90,7 +91,7 @@ class QNitpickerPlatformWindow : public QObject, public QPlatformWindow
|
||||
|
||||
public:
|
||||
|
||||
QNitpickerPlatformWindow(QWindow *window,
|
||||
QNitpickerPlatformWindow(Genode::Env &env, QWindow *window,
|
||||
Genode::Signal_receiver &signal_receiver,
|
||||
int screen_width, int screen_height);
|
||||
|
||||
|
@ -32,9 +32,9 @@ class QNitpickerScreen : public QPlatformScreen
|
||||
|
||||
public:
|
||||
|
||||
QNitpickerScreen()
|
||||
QNitpickerScreen(Genode::Env &env)
|
||||
{
|
||||
Nitpicker::Connection _nitpicker;
|
||||
Nitpicker::Connection _nitpicker(env);
|
||||
|
||||
Framebuffer::Mode const scr_mode = _nitpicker.mode();
|
||||
|
||||
|
@ -12,16 +12,19 @@
|
||||
/* Qoost includes */
|
||||
#include <qoost/compound_widget.h>
|
||||
|
||||
extern void initialize_qpa_plugin(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
QPluginWidget::set_env(&env);
|
||||
initialize_qpa_plugin(env);
|
||||
QPluginWidget::env(env);
|
||||
|
||||
int argc = 1;
|
||||
char *argv[] = { "test-qpluginwidget", 0 };
|
||||
char const *argv[] = { "test-qpluginwidget", 0 };
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QApplication app(argc, (char**)argv);
|
||||
|
||||
Compound_widget<QWidget, QHBoxLayout> w;
|
||||
|
||||
|
@ -87,15 +87,14 @@ append config {
|
||||
<start name="arora" caps="2000">
|
||||
<resource name="RAM" quantum="2G"/>
|
||||
<config clipboard="yes">
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<jitterentropy name="random"/>
|
||||
</dir>
|
||||
<tar name="qt5_fs_arora.tar"/>
|
||||
</vfs>
|
||||
</libc>
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<jitterentropy name="random"/>
|
||||
</dir>
|
||||
<tar name="qt5_fs_arora.tar"/>
|
||||
</vfs>
|
||||
<libc stdout="/dev/log" stderr="/dev/log"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Nitpicker"> <child name="wm"/> </service>
|
||||
|
@ -23,11 +23,15 @@
|
||||
/* provided by the application */
|
||||
extern "C" int main(int argc, char const **argv);
|
||||
|
||||
/* provided by the QPA plugin */
|
||||
extern void initialize_qpa_plugin(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
QPluginWidget::set_env(&env);
|
||||
initialize_qpa_plugin(env);
|
||||
QPluginWidget::env(env);
|
||||
|
||||
int argc = 1;
|
||||
char const *argv[] = { "arora", 0 };
|
||||
|
Loading…
x
Reference in New Issue
Block a user