mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
wm: support clients in "direct" role
This commit is contained in:
parent
e27ebd0368
commit
0efd908e27
@ -47,7 +47,6 @@ namespace Wm { class Main;
|
||||
namespace Wm {
|
||||
|
||||
struct Decorator_nitpicker_session;
|
||||
struct Decorator_nitpicker_service;
|
||||
struct Decorator_content_callback;
|
||||
struct Decorator_content_registry;
|
||||
}
|
||||
|
117
repos/gems/src/server/wm/direct_nitpicker.h
Normal file
117
repos/gems/src/server/wm/direct_nitpicker.h
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* \brief Pass-through nitpicker service announced to the outside world
|
||||
* \author Norman Feske
|
||||
* \date 2015-09-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _DIRECT_NITPICKER_H_
|
||||
#define _DIRECT_NITPICKER_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/session_policy.h>
|
||||
#include <nitpicker_session/connection.h>
|
||||
|
||||
namespace Wm { class Direct_nitpicker_session; }
|
||||
|
||||
|
||||
class Wm::Direct_nitpicker_session : public Genode::Rpc_object<Nitpicker::Session>
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Session_label _session_label;
|
||||
Nitpicker::Connection _session { _session_label.string() };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Direct_nitpicker_session(Genode::Session_label const &session_label)
|
||||
:
|
||||
_session_label(session_label)
|
||||
{ }
|
||||
|
||||
void upgrade(char const *args)
|
||||
{
|
||||
Genode::env()->parent()->upgrade(_session, args);
|
||||
}
|
||||
|
||||
|
||||
/*********************************
|
||||
** Nitpicker session interface **
|
||||
*********************************/
|
||||
|
||||
Framebuffer::Session_capability framebuffer_session() override
|
||||
{
|
||||
return _session.framebuffer_session();
|
||||
}
|
||||
|
||||
Input::Session_capability input_session() override
|
||||
{
|
||||
return _session.input_session();
|
||||
}
|
||||
|
||||
View_handle create_view(View_handle parent) override
|
||||
{
|
||||
return _session.create_view(parent);
|
||||
}
|
||||
|
||||
void destroy_view(View_handle view) override
|
||||
{
|
||||
_session.destroy_view(view);
|
||||
}
|
||||
|
||||
View_handle view_handle(Nitpicker::View_capability view_cap, View_handle handle) override
|
||||
{
|
||||
return _session.view_handle(view_cap, handle);
|
||||
}
|
||||
|
||||
Nitpicker::View_capability view_capability(View_handle view) override
|
||||
{
|
||||
return _session.view_capability(view);
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle view) override
|
||||
{
|
||||
_session.release_view_handle(view);
|
||||
}
|
||||
|
||||
Genode::Dataspace_capability command_dataspace() override
|
||||
{
|
||||
return _session.command_dataspace();
|
||||
}
|
||||
|
||||
void execute() override
|
||||
{
|
||||
_session.execute();
|
||||
}
|
||||
|
||||
Framebuffer::Mode mode() override
|
||||
{
|
||||
return _session.mode();
|
||||
}
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability sigh) override
|
||||
{
|
||||
_session.mode_sigh(sigh);
|
||||
}
|
||||
|
||||
void buffer(Framebuffer::Mode mode, bool use_alpha) override
|
||||
{
|
||||
_session.buffer(mode, use_alpha);
|
||||
}
|
||||
|
||||
void focus(Genode::Capability<Nitpicker::Session> session)
|
||||
{
|
||||
_session.focus(session);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _DIRECT_NITPICKER_H_ */
|
@ -59,11 +59,12 @@ struct Wm::Main
|
||||
|
||||
Window_registry window_registry { *env()->heap(), window_list_reporter };
|
||||
|
||||
Nitpicker::Connection focus_nitpicker_session;
|
||||
|
||||
Nitpicker::Root nitpicker_root { ep, window_registry,
|
||||
*env()->heap(), env()->ram_session_cap(),
|
||||
pointer_reporter, focus_request_reporter };
|
||||
|
||||
Nitpicker::Connection focus_nitpicker_session;
|
||||
pointer_reporter, focus_request_reporter,
|
||||
focus_nitpicker_session };
|
||||
|
||||
void handle_focus_update(unsigned)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <window_registry.h>
|
||||
#include <decorator_nitpicker.h>
|
||||
#include <layouter_nitpicker.h>
|
||||
#include <direct_nitpicker.h>
|
||||
|
||||
|
||||
namespace Wm {
|
||||
@ -675,8 +676,7 @@ class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param nitpicker real nitpicker service
|
||||
* \param ep entrypoint used for managing the views
|
||||
* \param ep entrypoint used for managing the views
|
||||
*/
|
||||
Session_component(Ram_session_capability ram,
|
||||
Window_registry &window_registry,
|
||||
@ -1027,6 +1027,11 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
|
||||
Decorator_nitpicker_session *_decorator_session = nullptr;
|
||||
|
||||
/**
|
||||
* Nitpicker session used to perform session-control operations
|
||||
*/
|
||||
Nitpicker::Session &_focus_nitpicker_session;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -1035,12 +1040,14 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
Root(Entrypoint &ep,
|
||||
Window_registry &window_registry, Allocator &md_alloc,
|
||||
Ram_session_capability ram,
|
||||
Reporter &pointer_reporter, Reporter &focus_request_reporter)
|
||||
Reporter &pointer_reporter, Reporter &focus_request_reporter,
|
||||
Nitpicker::Session &focus_nitpicker_session)
|
||||
:
|
||||
_ep(ep), _md_alloc(md_alloc), _ram(ram),
|
||||
_pointer_reporter(pointer_reporter),
|
||||
_focus_request_reporter(focus_request_reporter),
|
||||
_window_registry(window_registry)
|
||||
_window_registry(window_registry),
|
||||
_focus_nitpicker_session(focus_nitpicker_session)
|
||||
{
|
||||
_window_layouter_input.event_queue().enabled(true);
|
||||
|
||||
@ -1057,7 +1064,8 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
{
|
||||
Genode::Session_label session_label(args.string());
|
||||
|
||||
enum Role { ROLE_DECORATOR, ROLE_LAYOUTER, ROLE_REGULAR };
|
||||
|
||||
enum Role { ROLE_DECORATOR, ROLE_LAYOUTER, ROLE_REGULAR, ROLE_DIRECT };
|
||||
Role role = ROLE_REGULAR;
|
||||
|
||||
/*
|
||||
@ -1074,6 +1082,9 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
|
||||
if (policy.attribute(role_attr).has_value("decorator"))
|
||||
role = ROLE_DECORATOR;
|
||||
|
||||
if (policy.attribute(role_attr).has_value("direct"))
|
||||
role = ROLE_DIRECT;
|
||||
}
|
||||
}
|
||||
catch (...) { }
|
||||
@ -1109,6 +1120,14 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
|
||||
return _ep.manage(*_layouter_session);
|
||||
}
|
||||
|
||||
case ROLE_DIRECT:
|
||||
{
|
||||
Direct_nitpicker_session *session = new (_md_alloc)
|
||||
Direct_nitpicker_session(session_label);
|
||||
|
||||
return _ep.manage(*session);
|
||||
}
|
||||
}
|
||||
|
||||
return Session_capability();
|
||||
@ -1135,6 +1154,12 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
|
||||
if (decorator_session)
|
||||
decorator_session->upgrade(args.string());
|
||||
|
||||
Direct_nitpicker_session *direct_session =
|
||||
dynamic_cast<Direct_nitpicker_session *>(session);
|
||||
|
||||
if (direct_session)
|
||||
direct_session->upgrade(args.string());
|
||||
};
|
||||
_ep.rpc_ep().apply(session_cap, lambda);
|
||||
}
|
||||
@ -1156,6 +1181,18 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
return;
|
||||
}
|
||||
|
||||
Direct_nitpicker_session *direct_session =
|
||||
ep.apply(session_cap, [this] (Direct_nitpicker_session *session) {
|
||||
if (session) {
|
||||
_ep.dissolve(*session);
|
||||
}
|
||||
return session;
|
||||
});
|
||||
if (direct_session) {
|
||||
Genode::destroy(_md_alloc, direct_session);
|
||||
return;
|
||||
}
|
||||
|
||||
auto decorator_lambda = [this] (Decorator_nitpicker_session *session) {
|
||||
_ep.dissolve(*_decorator_session);
|
||||
_decorator_session = nullptr;
|
||||
@ -1212,6 +1249,13 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Forward the request to the nitpicker control session to apply
|
||||
* the show/hide/to-front operations on "direct" nitpicker
|
||||
* sessions.
|
||||
*/
|
||||
_focus_nitpicker_session.session_control(selector, operation);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user