wm: shape report interception mechanism

This patch simplifies the propagation of pointer shapes from
window-manager clients to the pointer. The "shape" report is routed to
the wm server, which, in turn, reports it to the pointer. This way, the
pointer can easily correlate the label of the application's "shape"
report with the label of the application's Nitpicker session. The
formerly used manual rewriting of the "shape" label is not needed
anymore.

Since the wm server provides a "Report" service now, its <provides>
declaration must cover "Report" in addition to "Nitpicker" to avoid
runtime error messages. Vice versa, the wm is now expected to request
"shape" reports, which should be routed to the pointer (using the
'label_last' routing attribute).

Fixes #3165
This commit is contained in:
Norman Feske 2019-02-18 16:02:29 +01:00 committed by Christian Helmuth
parent 5fa0de95f6
commit d3d6b643f1
16 changed files with 139 additions and 37 deletions

View File

@ -6,6 +6,7 @@
<service name="LOG"/>
<service name="Nitpicker"/>
<service name="Timer"/>
<service name="Report"/>
</parent-provides>
<default-route>
@ -18,6 +19,10 @@
<default-policy> <child name="wm"/> </default-policy>
</service>
<service name="Report"> <!-- for reporting 'shape' reports through the wm -->
<default-policy> <child name="wm"/> </default-policy>
</service>
<start name="report_rom">
<resource name="RAM" quantum="4M"/>
<provides>
@ -40,7 +45,7 @@
<start name="wm" caps="250">
<resource name="RAM" quantum="6M"/>
<provides>
<service name="Nitpicker"/>
<service name="Nitpicker"/> <service name="Report"/>
</provides>
<config>
<policy label_prefix="decorator" role="decorator"/>
@ -50,6 +55,7 @@
<route>
<service name="ROM" label="resize_request"> <child name="report_rom"/> </service>
<service name="ROM" label="focus"> <child name="report_rom"/> </service>
<service name="Report" label_last="shape"> <parent/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<any-service>
<child name="nitpicker"/> <parent/> <any-child/>

View File

@ -6,6 +6,7 @@
<service name="LOG"/>
<service name="Nitpicker"/>
<service name="Timer"/>
<service name="Report"/>
</parent-provides>
<default-route>
@ -48,6 +49,7 @@
<child name="report_rom" label="decorator -> hover"/> </policy>
<policy label_suffix="decorator -> decorator_margins">
<child name="report_rom" label="decorator -> decorator_margins"/> </policy>
<policy label_suffix="-> shape"> <child name="wm"/> </policy>
</service>
<start name="report_rom">
@ -72,7 +74,7 @@
<start name="wm" caps="250">
<resource name="RAM" quantum="8M"/>
<provides>
<service name="Nitpicker"/>
<service name="Nitpicker"/> <service name="Report"/>
</provides>
<config>
<policy label_suffix="decorator -> " role="decorator"/>
@ -82,6 +84,7 @@
<route>
<service name="ROM" label="resize_request"> <child name="report_rom"/> </service>
<service name="ROM" label="focus"> <child name="report_rom"/> </service>
<service name="Report" label_last="shape"> <parent/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent/> </any-service>
</route>

View File

@ -105,6 +105,7 @@ install_config {
</config>
<route>
<service name="ROM" label="hover"> <child name="report_rom"/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<service name="Nitpicker"> <child name="nitpicker"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
@ -142,7 +143,7 @@ install_config {
<start name="wm" caps="200">
<resource name="RAM" quantum="6M"/>
<provides>
<service name="Nitpicker"/>
<service name="Nitpicker"/> <service name="Report"/>
</provides>
<config>
<policy label_prefix="decorator" role="decorator"/>
@ -152,8 +153,9 @@ install_config {
<default-policy/>
</config>
<route>
<service name="ROM" label="focus"> <child name="report_rom"/> </service>
<service name="ROM" label="resize_request"> <child name="report_rom"/> </service>
<service name="ROM" label="focus"> <child name="report_rom"/> </service>
<service name="ROM" label="resize_request"> <child name="report_rom"/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<any-service>
<child name="nitpicker"/> <parent/> <any-child/>
</any-service>

View File

@ -79,9 +79,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> mixer_gui_qt -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="channel_list"> <child name="dynamic_rom" /> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent/> <any-child/> </any-service>

View File

@ -2,7 +2,7 @@
<route>
<service name="Nic"> <child name="nic_router"/> </service>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape"> <parent label="wm -> wm -> arora -> shape"/> </service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="RM"> <parent/> </service>
<service name="Rtc"> <parent/> </service>
</route>

View File

@ -1,7 +1,7 @@
<launcher pkg="qt5_textedit">
<route>
<service name="File_system" label="rw"> <parent label="config"/> </service>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape"> <parent label="wm -> wm -> qt5_textedit -> shape"/> </service>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape"> <child name="wm"/> </service>
</route>
</launcher>

View File

@ -3,7 +3,7 @@
<service name="Nic"> <child name="nic_router"/> </service>
<service name="ROM" label="capslock"> <parent label="capslock"/> </service>
<service name="ROM" label="platform_info"> <parent/> </service>
<service name="Report" label="shape"> <parent label="wm -> wm -> vbox5-tc-browser -> shape"/> </service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="RM"> <parent/> </service>
<service name="Rtc"> <parent/> </service>
<service name="Nitpicker"> <child name="wm"/> </service>

View File

@ -4,7 +4,7 @@
<service name="ROM" label="capslock"> <parent label="capslock"/> </service>
<service name="ROM" label="platform_info"> <parent/> </service>
<service name="ROM" label="usb_devices"> <child name="usb_devices_rom"/> </service>
<service name="Report" label="shape"> <parent label="wm -> wm -> vm -> shape"/> </service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Nic"> <child name="nic_router"/> </service>
<service name="Report"> <parent/> </service>

View File

@ -2,5 +2,6 @@
<route>
<service name="Nitpicker" label="wm -> "> <parent label="focus"/> </service>
<service name="Nitpicker"> <parent/> </service>
<service name="Report" label_last="shape"> <parent/> </service>
</route>
</launcher>

View File

@ -107,7 +107,7 @@
<start name="wm" caps="200">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Nitpicker"/> </provides>
<provides> <service name="Nitpicker"/> <service name="Report"/> </provides>
<config>
<policy label_prefix="decorator" role="decorator"/>
<default-policy/>

View File

@ -122,9 +122,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> test-tiled_wm-panel -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<service name="ROM" label="apps"> <child name="test_reports" /> </service>
@ -148,9 +146,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> test-tiled_wm-overlay -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
@ -171,9 +167,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> test-tiled_wm-app-1 -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
@ -194,9 +188,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> test-tiled_wm-app-2 -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
@ -216,9 +208,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> textedit -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>

View File

@ -74,7 +74,7 @@ install_config {
<start name="wm" caps="1000">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<provides> <service name="Nitpicker"/> </provides>
<provides> <service name="Nitpicker"/> <service name="Report"/> </provides>
<route>
<service name="ROM" label="config"> <parent label="wm.config"/> </service>
<service name="Nitpicker"> <child name="nitpicker"/> </service>

View File

@ -22,6 +22,7 @@
/* local includes */
#include <nitpicker.h>
#include <report_forwarder.h>
namespace Wm {
@ -110,6 +111,8 @@ struct Wm::Main
Genode::Signal_handler<Main> resize_request_handler =
{ env.ep(), *this, &Main::handle_resize_request_update };
Report_forwarder _report_forwarder { env, heap };
Main(Genode::Env &env) : env(env)
{
pointer_reporter.enabled(true);

View File

@ -0,0 +1,102 @@
/*
* \brief Report service for intercepting shape reports
* \author Norman Feske
* \date 2019-02-18
*
* This report service has the sole purpose of applying the same labeling
* 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.
*/
/*
* Copyright (C) 2015-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 _REPORT_FORWARDER_H_
#define _REPORT_FORWARDER_H_
/* Genode includes */
#include <root/component.h>
#include <report_session/connection.h>
namespace Wm { struct Report_forwarder; }
struct Wm::Report_forwarder
{
struct Session : Genode::Rpc_object<Report::Session>
{
Genode::Env &_env;
Report::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);
}
/*******************************
** Report::Session interface **
*******************************/
Genode::Dataspace_capability dataspace() override
{
return _connection.dataspace();
}
void submit(Genode::size_t length) override
{
_connection.submit(length);
}
void response_sigh(Genode::Signal_context_capability sigh) override
{
_connection.response_sigh(sigh);
}
Genode::size_t obtain_response() override
{
return _connection.obtain_response();
}
};
struct Root : Genode::Root_component<Session>
{
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<Session>(env.ep(), alloc),
_env(env), _alloc(alloc)
{
_env.parent().announce(env.ep().manage(*this));
}
} _root;
Report_forwarder(Genode::Env &env, Genode::Allocator &alloc)
: _root(env, alloc) { }
};
#endif /* _REPORT_FORWARDER_H_ */

View File

@ -156,7 +156,7 @@ proc qt5_start_nodes { feature_arg } {
<start name="wm" caps="250">
<resource name="RAM" quantum="8M"/>
<provides>
<service name="Nitpicker"/>
<service name="Nitpicker"/> <service name="Report"/>
</provides>
<config>
<policy label_prefix="decorator" role="decorator"/>
@ -166,6 +166,7 @@ proc qt5_start_nodes { feature_arg } {
<route>
<service name="ROM" label="focus"> <child name="wm_report_rom"/> </service>
<service name="ROM" label="resize_request"> <child name="wm_report_rom"/> </service>
<service name="Report" label_last="shape"> <child name="pointer"/> </service>
<service name="Report"> <child name="wm_report_rom"/> </service>
<any-service>
<child name="nitpicker"/> <parent/> <any-child/>

View File

@ -96,9 +96,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> textedit -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
@ -119,9 +117,7 @@ append config {
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report" label="shape">
<child name="pointer" label="wm -> textedit2 -> shape"/>
</service>
<service name="Report" label="shape"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>