From 1fe9b07c990c3f56c365f54f142ddb2fbb9e3a44 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 27 Jun 2019 19:03:03 +0200 Subject: [PATCH] wm: forwarding of clipboard ROM/Report sessions The labels of clipboard ROM and clipboard report sessions of WM clients must be consistent with the client's nitpicker label. Hence, we must route those sessions through the window manager, analogously to the approach taken for shape reports in #3165. Issue #3437 --- repos/gems/recipes/pkg/motif_wm/runtime | 11 ++- repos/gems/recipes/pkg/themed_wm/runtime | 6 +- repos/gems/recipes/pkg/wm/runtime | 4 +- repos/gems/recipes/raw/motif_wm/wm.config | 21 +++-- repos/gems/recipes/raw/wm/wm.config | 39 +++++---- repos/gems/run/launcher.run | 2 +- repos/gems/run/sculpt/leitzentrale.config | 4 +- repos/gems/run/wm.run | 4 +- repos/gems/src/server/wm/main.cc | 2 + repos/gems/src/server/wm/report_forwarder.h | 5 +- repos/gems/src/server/wm/rom_forwarder.h | 96 +++++++++++++++++++++ repos/libports/run/mupdf.run | 4 +- repos/libports/run/qt5_common.inc | 2 +- repos/ports/run/vbox_win.inc | 4 +- 14 files changed, 167 insertions(+), 37 deletions(-) create mode 100644 repos/gems/src/server/wm/rom_forwarder.h diff --git a/repos/gems/recipes/pkg/motif_wm/runtime b/repos/gems/recipes/pkg/motif_wm/runtime index c01a562751..b963b61c9e 100644 --- a/repos/gems/recipes/pkg/motif_wm/runtime +++ b/repos/gems/recipes/pkg/motif_wm/runtime @@ -1,8 +1,15 @@ - + + + + + + + + - + diff --git a/repos/gems/recipes/pkg/themed_wm/runtime b/repos/gems/recipes/pkg/themed_wm/runtime index 8bff9dca66..39f04e7e52 100644 --- a/repos/gems/recipes/pkg/themed_wm/runtime +++ b/repos/gems/recipes/pkg/themed_wm/runtime @@ -3,11 +3,13 @@ - + + + - + diff --git a/repos/gems/recipes/pkg/wm/runtime b/repos/gems/recipes/pkg/wm/runtime index 76bfe5f31e..9c92c01a97 100644 --- a/repos/gems/recipes/pkg/wm/runtime +++ b/repos/gems/recipes/pkg/wm/runtime @@ -3,7 +3,9 @@ - + + + diff --git a/repos/gems/recipes/raw/motif_wm/wm.config b/repos/gems/recipes/raw/motif_wm/wm.config index 0296db9902..0651567530 100644 --- a/repos/gems/recipes/raw/motif_wm/wm.config +++ b/repos/gems/recipes/raw/motif_wm/wm.config @@ -19,7 +19,11 @@ - + + + + + @@ -45,7 +49,7 @@ - + @@ -56,6 +60,8 @@ + + @@ -75,9 +81,9 @@ - - - + + + @@ -92,10 +98,9 @@ + - - - + diff --git a/repos/gems/recipes/raw/wm/wm.config b/repos/gems/recipes/raw/wm/wm.config index 862bf4f98a..080f5dc4e7 100644 --- a/repos/gems/recipes/raw/wm/wm.config +++ b/repos/gems/recipes/raw/wm/wm.config @@ -20,36 +20,39 @@ - + - + - + - + - + - + - + + + - + - + - + - + - + - + - + + @@ -74,7 +77,7 @@ - + @@ -84,8 +87,10 @@ - - + + + + diff --git a/repos/gems/run/launcher.run b/repos/gems/run/launcher.run index 385d081460..e672faa8ad 100644 --- a/repos/gems/run/launcher.run +++ b/repos/gems/run/launcher.run @@ -143,7 +143,7 @@ install_config { - + diff --git a/repos/gems/run/sculpt/leitzentrale.config b/repos/gems/run/sculpt/leitzentrale.config index 6e5a8aecf6..d463d9b094 100644 --- a/repos/gems/run/sculpt/leitzentrale.config +++ b/repos/gems/run/sculpt/leitzentrale.config @@ -107,7 +107,9 @@ - + + + diff --git a/repos/gems/run/wm.run b/repos/gems/run/wm.run index 54f4c7fdb5..d337e6eca5 100644 --- a/repos/gems/run/wm.run +++ b/repos/gems/run/wm.run @@ -74,7 +74,9 @@ install_config { - + + + diff --git a/repos/gems/src/server/wm/main.cc b/repos/gems/src/server/wm/main.cc index 577cff690a..de95b140b1 100644 --- a/repos/gems/src/server/wm/main.cc +++ b/repos/gems/src/server/wm/main.cc @@ -23,6 +23,7 @@ /* local includes */ #include #include +#include namespace Wm { @@ -110,6 +111,7 @@ struct Wm::Main { env.ep(), *this, &Main::handle_resize_request_update }; Report_forwarder _report_forwarder { env, heap }; + Rom_forwarder _rom_forwarder { env, heap }; Main(Genode::Env &env) : env(env) { diff --git a/repos/gems/src/server/wm/report_forwarder.h b/repos/gems/src/server/wm/report_forwarder.h index 3284aa94c1..50c212ee0b 100644 --- a/repos/gems/src/server/wm/report_forwarder.h +++ b/repos/gems/src/server/wm/report_forwarder.h @@ -1,5 +1,5 @@ /* - * \brief Report service for intercepting shape reports + * \brief Report service for intercepting shape and clipboard reports * \author Norman Feske * \date 2019-02-18 * @@ -7,6 +7,9 @@ * policy to an application's shape report as done for the application's * 'Nitpicker' session. This consistency is needed by the pointer to correlate * the currently hovered nitpicker session with the reported shapes. + * Analogously, clipboard reports can be routed through the window + * manager to support the clipboard component with associating its clients + * with nitpicker's reported focus. */ /* diff --git a/repos/gems/src/server/wm/rom_forwarder.h b/repos/gems/src/server/wm/rom_forwarder.h new file mode 100644 index 0000000000..5da945943b --- /dev/null +++ b/repos/gems/src/server/wm/rom_forwarder.h @@ -0,0 +1,96 @@ +/* + * \brief ROM service for intercepting clipboard ROMs + * \author Norman Feske + * \date 2019-06-26 + * + * This ROM service can be used as proxy for clipboard ROMs to ensure the + * consistency of the client labels appearing at the clipboard component + * with the label of the currently focused nitpicker client. + */ + +/* + * Copyright (C) 2019 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 _ROM_FORWARDER_H_ +#define _ROM_FORWARDER_H_ + +/* Genode includes */ +#include +#include + +namespace Wm { struct Rom_forwarder; } + + +struct Wm::Rom_forwarder +{ + struct Session : Genode::Rpc_object + { + Genode::Env &_env; + Genode::Rom_connection _connection; + + Session(Genode::Env &env, Genode::Session_label const &label) + : _env(env), _connection(env, label.string()) + { _env.ep().manage(*this); } + + ~Session() { _env.ep().dissolve(*this); } + + void upgrade(Genode::Session::Resources const &resources) + { + _connection.upgrade(resources); + } + + + /*************************** + ** Rom_session interface ** + ***************************/ + + Genode::Rom_dataspace_capability dataspace() override + { + return _connection.dataspace(); + } + + bool update() override + { + return _connection.update(); + } + + void sigh(Signal_context_capability sigh) override + { + _connection.sigh(sigh); + } + }; + + struct Root : Genode::Root_component + { + Genode::Env &_env; + Genode::Allocator &_alloc; + + Session *_create_session(char const *args) override + { + return new (md_alloc()) Session(_env, Genode::label_from_args(args)); + } + + void _upgrade_session(Session *session, const char *args) override + { + session->upgrade(Genode::session_resources_from_args(args)); + } + + Root(Genode::Env &env, Genode::Allocator &alloc) + : + Genode::Root_component(env.ep(), alloc), + _env(env), _alloc(alloc) + { + _env.parent().announce(env.ep().manage(*this)); + } + + } _root; + + Rom_forwarder(Genode::Env &env, Genode::Allocator &alloc) + : _root(env, alloc) { } +}; + +#endif /* _ROM_FORWARDER_H_ */ diff --git a/repos/libports/run/mupdf.run b/repos/libports/run/mupdf.run index f445562780..f792812138 100644 --- a/repos/libports/run/mupdf.run +++ b/repos/libports/run/mupdf.run @@ -70,7 +70,9 @@ set config { - + + + diff --git a/repos/libports/run/qt5_common.inc b/repos/libports/run/qt5_common.inc index 5137a2e53a..7c1392921a 100644 --- a/repos/libports/run/qt5_common.inc +++ b/repos/libports/run/qt5_common.inc @@ -187,7 +187,7 @@ proc qt5_start_nodes { feature_arg } { - + diff --git a/repos/ports/run/vbox_win.inc b/repos/ports/run/vbox_win.inc index 50db1b3618..2c4cd088a8 100644 --- a/repos/ports/run/vbox_win.inc +++ b/repos/ports/run/vbox_win.inc @@ -144,7 +144,9 @@ if { $use_vms > 1 } { - + + +