gui_session: simplify input/framebuffer aggregate

- Rename framebuffer_session to framebuffer and
  input_session to input as those RPC interfaces are no longer
  meant to be used as stand-alone sessions.

- Host Connection::input and Connection::framebuffer as public
  members, thereby removing the use of pointers. This simplifies
  the client-sized code. E.g., '_gui.input()->pending()' becomes
  '_gui.input.pending()'.

Issue #5242
This commit is contained in:
Norman Feske 2024-08-06 12:28:15 +02:00 committed by Christian Helmuth
parent 9823b7dbd0
commit b0803eabdb
48 changed files with 181 additions and 203 deletions

View File

@ -49,7 +49,7 @@ class Scout::Graphics_backend_impl : public Graphics_backend
_gui.buffer(mode, false);
return _gui.framebuffer()->dataspace();
return _gui.framebuffer.dataspace();
}
Area _max_size;
@ -80,8 +80,8 @@ class Scout::Graphics_backend_impl : public Graphics_backend
void _refresh_view(Rect rect)
{
int const y_offset = _flip_state ? _max_size.h : 0;
_gui.framebuffer()->refresh(rect.x1(), rect.y1() + y_offset,
rect.w(), rect.h());
_gui.framebuffer.refresh(rect.x1(), rect.y1() + y_offset,
rect.w(), rect.h());
}
template <typename PT>

View File

@ -86,7 +86,7 @@ struct Main : Scout::Event_handler
Gui::Connection _gui { _env };
Platform _platform { _env, *_gui.input() };
Platform _platform { _env, _gui.input };
bool const _event_handler_registered = (_platform.event_handler(*this), true);

View File

@ -65,7 +65,7 @@ struct Scout::Main : Scout::Event_handler
Gui::Connection _gui { _env };
Platform _platform { _env, *_gui.input() };
Platform _platform { _env, _gui.input };
bool const _event_handler_registered = (_platform.event_handler(*this), true);

View File

@ -150,7 +150,7 @@ class Liquid_fb::Main : public Scout::Event_handler
Gui::Connection _gui { _env };
Platform _platform { _env, *_gui.input() };
Platform _platform { _env, _gui.input };
bool const _event_handler_registered = (_platform.event_handler(*this), true);

View File

@ -418,7 +418,7 @@ struct Nitlog::Main
Sliced_heap _sliced_heap { _env.ram(), _env.rm() };
/* create log window */
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer()->dataspace() };
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer.dataspace() };
Canvas<Pixel_rgb888> _canvas { _fb_ds.local_addr<Pixel_rgb888>(),
::Area(_win_w, _win_h) };
@ -445,7 +445,7 @@ struct Nitlog::Main
/* create root interface for service */
Root _root { _env.ep(), _sliced_heap, _log_window };
Attached_dataspace _ev_ds { _env.rm(), _gui.input()->dataspace() };
Attached_dataspace _ev_ds { _env.rm(), _gui.input.dataspace() };
Gui::Point const _initial_mouse_pos { -1, -1 };
@ -460,7 +460,7 @@ struct Nitlog::Main
{
Input::Event const *ev_buf = _ev_ds.local_addr<Input::Event const>();
for (int i = 0, num_ev = _gui.input()->flush(); i < num_ev; i++) {
for (int i = 0, num_ev = _gui.input.flush(); i < num_ev; i++) {
Input::Event const &ev = ev_buf[i];
@ -491,7 +491,7 @@ struct Nitlog::Main
void _handle_timer()
{
if (_log_window.draw())
_gui.framebuffer()->refresh(0, 0, _win_w, _win_h);
_gui.framebuffer.refresh(0, 0, _win_w, _win_h);
}
Main(Env &env) : _env(env)
@ -502,7 +502,7 @@ struct Nitlog::Main
_timer.sigh(_timer_handler);
_timer.trigger_periodic(20*1000);
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
}
};

View File

@ -56,7 +56,7 @@ struct Gui_buffer : Genode::Noncopyable
/* setup virtual framebuffer mode */
gui.buffer(mode, use_alpha);
return gui.framebuffer()->dataspace();
return gui.framebuffer.dataspace();
}
Genode::Attached_dataspace fb_ds { rm, _ds_cap(gui) };

View File

@ -91,7 +91,7 @@ class Nano3d::Scene
gui.buffer(Framebuffer::Mode { .area = { size.w, height } },
use_alpha);
return *gui.framebuffer();
return gui.framebuffer;
}
Framebuffer::Session &framebuffer;
@ -192,7 +192,7 @@ class Nano3d::Scene
Timer::Connection _timer { _env };
Genode::Attached_dataspace _input_ds { _env.rm(), _gui.input()->dataspace() };
Genode::Attached_dataspace _input_ds { _env.rm(), _gui.input.dataspace() };
Input_handler *_input_handler_callback = nullptr;
@ -201,7 +201,7 @@ class Nano3d::Scene
if (!_input_handler_callback)
return;
while (int num = _gui.input()->flush()) {
while (int num = _gui.input.flush()) {
auto const *ev_buf = _input_ds.local_addr<Input::Event>();
@ -286,7 +286,7 @@ class Nano3d::Scene
_gui.enqueue<Command::To_front>(_view_handle, View_handle());
_gui.execute();
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
_timer.sigh(_periodic_handler);
_timer.trigger_periodic(1000*update_rate_ms);

View File

@ -61,7 +61,7 @@ struct Backdrop::Main
/* setup virtual framebuffer mode */
gui.buffer(mode, false);
return gui.framebuffer()->dataspace();
return gui.framebuffer.dataspace();
}
Attached_dataspace fb_ds;
@ -345,7 +345,7 @@ void Backdrop::Main::_handle_config()
});
/* schedule buffer refresh */
_gui.framebuffer()->sync_sigh(_sync_handler);
_gui.framebuffer.sync_sigh(_sync_handler);
}
@ -357,7 +357,7 @@ void Backdrop::Main::_handle_sync()
});
/* disable sync signal until the next call of 'handle_config' */
_gui.framebuffer()->sync_sigh(Signal_context_capability());
_gui.framebuffer.sync_sigh(Signal_context_capability());
}

View File

@ -51,7 +51,7 @@ struct Decorator::Main : Window_factory_base
:
mode(gui.mode()),
fb_ds(env.rm(),
(gui.buffer(mode, false), gui.framebuffer()->dataspace())),
(gui.buffer(mode, false), gui.framebuffer.dataspace())),
canvas(fb_ds.local_addr<Pixel_rgb888>(), mode.area, env.ram(), env.rm())
{ }
};
@ -69,7 +69,7 @@ struct Decorator::Main : Window_factory_base
Dirty_rect dirty = _window_stack.draw(_canvas->canvas);
dirty.flush([&] (Rect const &r) {
_gui.framebuffer()->refresh(r.x1(), r.y1(), r.w(), r.h()); });
_gui.framebuffer.refresh(r.x1(), r.y1(), r.w(), r.h()); });
}
Window_stack _window_stack = { *this };
@ -125,7 +125,7 @@ struct Decorator::Main : Window_factory_base
void _trigger_sync_handling()
{
_gui.framebuffer()->sync_sigh(_gui_sync_handler);
_gui.framebuffer.sync_sigh(_gui_sync_handler);
}
Signal_handler<Main> _gui_sync_handler = {
@ -318,13 +318,13 @@ void Decorator::Main::_handle_gui_sync()
_gui.execute();
dirty.flush([&] (Rect const &r) {
_gui.framebuffer()->refresh(r.x1(), r.y1(), r.w(), r.h()); });
_gui.framebuffer.refresh(r.x1(), r.y1(), r.w(), r.h()); });
/*
* Disable sync handling when becoming idle
*/
if (!_animator.active())
_gui.framebuffer()->sync_sigh(Signal_context_capability());
_gui.framebuffer.sync_sigh(Signal_context_capability());
}

View File

@ -65,7 +65,7 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
Gui::Connection _gui { _env, _name };
Attached_dataspace _input_ds { _env.rm(), _gui.input()->dataspace() };
Attached_dataspace _input_ds { _env.rm(), _gui.input.dataspace() };
Signal_handler<Dialog> _input_handler = {
_env.ep(), *this, &Dialog::_handle_input};
@ -133,7 +133,7 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
{
_dialog_rom.sigh(_dialog_handler);
_dialog_handler.local_submit();
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
}
Widget::Hovered hovered_widget() const
@ -178,7 +178,7 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
});
_buffer->flush_surface();
_gui.framebuffer()->refresh(0, 0, _buffer->size().w, _buffer->size().h);
_gui.framebuffer.refresh(0, 0, _buffer->size().w, _buffer->size().h);
_update_view(Rect(_position, size));
_redraw_scheduled = false;
@ -244,7 +244,7 @@ void Menu_view::Dialog::_handle_input()
bool seq_number_changed = false;
_gui.input()->for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
ev.handle_seq_number([&] (Input::Seq_number seq_number) {
seq_number_changed = true;

View File

@ -176,7 +176,7 @@ struct Osci::Main
_gui_buffer->flush_surface();
_gui.framebuffer()->refresh(0, 0, _size.w, _size.h);
_gui.framebuffer.refresh(0, 0, _size.w, _size.h);
}
Main(Env &env) : _env(env)

View File

@ -125,7 +125,7 @@ struct Sculpt::Main : Input_event_handler,
void _handle_input()
{
_gui.input()->for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
handle_input_event(ev); });
}
@ -2006,7 +2006,7 @@ struct Sculpt::Main : Input_event_handler,
_drivers.update_options(_driver_options);
_drivers.update_soc(_soc);
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
_gui.mode_sigh(_gui_mode_handler);
_handle_gui_mode();

View File

@ -322,7 +322,7 @@ struct Osci::Main
channel.render(pixel, alpha, phase_lock); }); });
_gui_buffer->flush_surface();
_gui.framebuffer()->refresh(0, 0, _size.w, _size.h);
_gui.framebuffer.refresh(0, 0, _size.w, _size.h);
}
Main(Env &env) : _env(env)

View File

@ -85,7 +85,7 @@ struct Screenshot_trigger::Main
void _handle_input()
{
_gui.input()->for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
if (!_visible) /* ignore events while the view is invisble */
return;
@ -164,7 +164,7 @@ struct Screenshot_trigger::Main
_config.sigh(_config_handler);
_handle_config();
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
_timer.sigh(_timer_handler);
visible(true);

View File

@ -61,7 +61,7 @@ struct Gui::Session_component : Rpc_object<Gui::Session>
Gui::Session_client _gui_session { _connection.cap() };
Input::Session_client _gui_input { _env.rm(), _gui_session.input_session() };
Input::Session_client _gui_input { _env.rm(), _gui_session.input() };
Input::Session_component _input_component { _env, _env.ram() };
@ -115,10 +115,10 @@ struct Gui::Session_component : Rpc_object<Gui::Session>
_connection.upgrade(resources);
}
Framebuffer::Session_capability framebuffer_session() override {
return _gui_session.framebuffer_session(); }
Framebuffer::Session_capability framebuffer() override {
return _gui_session.framebuffer(); }
Input::Session_capability input_session() override {
Input::Session_capability input() override {
return _input_component.cap(); }
Create_view_result create_view() override {

View File

@ -113,7 +113,7 @@ struct Sculpt::Main : Input_event_handler,
void _handle_input()
{
_gui.input()->for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
handle_input_event(ev); });
}
@ -1646,7 +1646,7 @@ struct Sculpt::Main : Input_event_handler,
Main(Env &env) : _env(env)
{
_drivers.update_soc(_soc);
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
_gui.mode_sigh(_gui_mode_handler);
_handle_gui_mode();
_fb_config.trigger_update();

View File

@ -101,7 +101,7 @@ struct Decorator::Main : Window_factory_base
void _trigger_sync_handling()
{
_gui.framebuffer()->sync_sigh(_gui_sync_handler);
_gui.framebuffer.sync_sigh(_gui_sync_handler);
}
Attached_rom_dataspace _config { _env, "config" };
@ -304,7 +304,7 @@ void Decorator::Main::_handle_gui_sync()
* Disable sync handling when becoming idle
*/
if (!_animator.active())
_gui.framebuffer()->sync_sigh(Signal_context_capability());
_gui.framebuffer.sync_sigh(Signal_context_capability());
}

View File

@ -300,7 +300,7 @@ class Decorator::Window : public Window_base, public Animator::Item
buffer.flush_surface();
buffer.gui.framebuffer()->refresh(0, 0, buffer.size().w, buffer.size().h);
buffer.gui.framebuffer.refresh(0, 0, buffer.size().w, buffer.size().h);
}
void _repaint_decorations()

View File

@ -312,9 +312,9 @@ struct Window_layouter::Main : Operations,
void _handle_input()
{
while (_input.pending())
while (_gui.input.pending())
_user_state.handle_input(_input_ds.local_addr<Input::Event>(),
_input.flush(), _config.xml());
_gui.input.flush(), _config.xml());
}
Signal_handler<Main> _input_handler {
@ -336,9 +336,7 @@ struct Window_layouter::Main : Operations,
_env.ep(), *this, &Main::_handle_mode_change };
Input::Session_client &_input = *_gui.input();
Attached_dataspace _input_ds { _env.rm(), _input.dataspace() };
Attached_dataspace _input_ds { _env.rm(), _gui.input.dataspace() };
Expanding_reporter _window_layout_reporter { _env, "window_layout", "window_layout"};
Expanding_reporter _resize_request_reporter { _env, "resize_request", "resize_request"};
@ -382,7 +380,7 @@ struct Window_layouter::Main : Operations,
_hover.sigh(_hover_handler);
_decorator_margins_rom.sigh(_decorator_margins_handler);
_input.sigh(_input_handler);
_gui.input.sigh(_input_handler);
_focus_request.sigh(_focus_request_handler);
_window_list.initial_import();

View File

@ -63,7 +63,7 @@ struct Sandboxed_runtime::Gui_session : Session_object<Gui::Session>
Gui::Session_client _gui_session { _connection.cap() };
Input::Session_client _gui_input { _env.rm(), _gui_session.input_session() };
Input::Session_client _gui_input { _env.rm(), _gui_session.input() };
Input::Session_component _input_component { _env, _env.ram() };
@ -119,10 +119,10 @@ struct Sandboxed_runtime::Gui_session : Session_object<Gui::Session>
_connection.upgrade(resources);
}
Framebuffer::Session_capability framebuffer_session() override {
return _gui_session.framebuffer_session(); }
Framebuffer::Session_capability framebuffer() override {
return _gui_session.framebuffer(); }
Input::Session_capability input_session() override {
Input::Session_capability input() override {
return _input_component.cap(); }
Create_view_result create_view() override {

View File

@ -207,7 +207,7 @@ class Gui_fader::Framebuffer_session_component
transfer_src_to_dst_alpha(rect);
_gui.framebuffer()->refresh(rect.x1(), rect.y1(), rect.w(), rect.h());
_gui.framebuffer.refresh(rect.x1(), rect.y1(), rect.w(), rect.h());
/* keep animating as long as the destination value is not reached */
return _fade != _fade.dst();
@ -230,12 +230,12 @@ class Gui_fader::Framebuffer_session_component
Framebuffer::Mode mode() const override
{
return _gui.framebuffer()->mode();
return _gui.framebuffer.mode();
}
void mode_sigh(Genode::Signal_context_capability sigh) override
{
_gui.framebuffer()->mode_sigh(sigh);
_gui.framebuffer.mode_sigh(sigh);
}
void refresh(int x, int y, int w, int h) override
@ -243,12 +243,12 @@ class Gui_fader::Framebuffer_session_component
transfer_src_to_dst_pixel(Rect(Point(x, y), Area(w, h)));
transfer_src_to_dst_alpha(Rect(Point(x, y), Area(w, h)));
_gui.framebuffer()->refresh(x, y, w, h);
_gui.framebuffer.refresh(x, y, w, h);
}
void sync_sigh(Genode::Signal_context_capability sigh) override
{
_gui.framebuffer()->sync_sigh(sigh);
_gui.framebuffer.sync_sigh(sigh);
}
};
@ -335,14 +335,14 @@ class Gui_fader::Gui_session_component
** Gui::Session interface **
****************************/
Framebuffer::Session_capability framebuffer_session() override
Framebuffer::Session_capability framebuffer() override
{
return _fb_cap;
}
Input::Session_capability input_session() override
Input::Session_capability input() override
{
return _gui.cap().call<Gui::Session::Rpc_input_session>();
return _gui.input.rpc_cap();
}
Create_view_result create_view() override
@ -428,7 +428,7 @@ class Gui_fader::Gui_session_component
_gui.buffer(mode, true);
_fb_session.dst_buffer(_gui.framebuffer()->dataspace(), size);
_fb_session.dst_buffer(_gui.framebuffer.dataspace(), size);
return Buffer_result::OK;
}

View File

@ -155,7 +155,7 @@ struct Terminal::Main : Character_consumer
Rect const dirty = _text_screen_surface->redraw(surface);
_gui.framebuffer()->refresh(dirty.x1(), dirty.y1(), dirty.w(), dirty.h());
_gui.framebuffer.refresh(dirty.x1(), dirty.y1(), dirty.w(), dirty.h());
}
/* update view geometry after mode change */
@ -212,7 +212,7 @@ struct Terminal::Main : Character_consumer
_timer .sigh(_flush_handler);
_config.sigh(_config_handler);
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
_gui.mode_sigh(_mode_change_handler);
_fb_mode = _gui.mode();
@ -260,7 +260,7 @@ void Terminal::Main::_handle_config()
_gui.buffer(_fb_mode, false);
if (_fb_mode.area.count() > 0)
_fb_ds.construct(_env.rm(), _gui.framebuffer()->dataspace());
_fb_ds.construct(_env.rm(), _gui.framebuffer.dataspace());
/*
* Distinguish the case where the framebuffer change affects the character
@ -337,7 +337,7 @@ void Terminal::Main::_handle_config()
void Terminal::Main::_handle_input()
{
_gui.input()->for_each_event([&] (Input::Event const &event) {
_gui.input.for_each_event([&] (Input::Event const &event) {
event.handle_absolute_motion([&] (int x, int y) {

View File

@ -167,7 +167,7 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
Real_gui _gui { _env, "decorator" };
Input::Session_client _input_session { _env.rm(), _gui.session.input_session() };
Input::Session_client _input_session { _env.rm(), _gui.session.input() };
Genode::Signal_context_capability _mode_sigh { };
@ -344,12 +344,12 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
** GUI session interface **
***************************/
Framebuffer::Session_capability framebuffer_session() override
Framebuffer::Session_capability framebuffer() override
{
return _gui.session.framebuffer_session();
return _gui.session.framebuffer();
}
Input::Session_capability input_session() override
Input::Session_capability input() override
{
/*
* Deny input to the decorator. User input referring to the

View File

@ -55,14 +55,14 @@ class Wm::Direct_gui_session : public Genode::Rpc_object<Gui::Session>
** GUI session interface **
***************************/
Framebuffer::Session_capability framebuffer_session() override
Framebuffer::Session_capability framebuffer() override
{
return _session.framebuffer_session();
return _session.framebuffer();
}
Input::Session_capability input_session() override
Input::Session_capability input() override
{
return _session.input_session();
return _session.input();
}
Create_view_result create_view() override

View File

@ -538,7 +538,7 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
/*
* Input
*/
Input::Session_client _gui_input { _env.rm(), _real_gui.session.input_session() };
Input::Session_client _gui_input { _env.rm(), _real_gui.session.input() };
Attached_dataspace _gui_input_ds { _env.rm(), _gui_input.dataspace() };
Signal_handler<Session_component> _input_handler {
@ -943,12 +943,12 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
** GUI session interface **
***************************/
Framebuffer::Session_capability framebuffer_session() override
Framebuffer::Session_capability framebuffer() override
{
return _real_gui.session.framebuffer_session();
return _real_gui.session.framebuffer();
}
Input::Session_capability input_session() override
Input::Session_capability input() override
{
return _input_session_cap;
}

View File

@ -52,12 +52,12 @@ struct Wm::Layouter_gui_session : Genode::Rpc_object<Gui::Session>
** GUI session interface **
***************************/
Framebuffer::Session_capability framebuffer_session() override
Framebuffer::Session_capability framebuffer() override
{
return Framebuffer::Session_capability();
}
Input::Session_capability input_session() override
Input::Session_capability input() override
{
return _input_session_cap;
}

View File

@ -91,9 +91,7 @@ class Pdf_view
Genode::Env &_env;
Gui::Connection _gui { _env };
Framebuffer::Session &_framebuffer = *_gui.framebuffer();
Input::Session_client &_input = *_gui.input();
Gui::Connection _gui { _env };
Framebuffer::Mode _nit_mode = _gui.mode();
Framebuffer::Mode _fb_mode {};
@ -127,7 +125,7 @@ class Pdf_view
_gui.buffer(_fb_mode, NO_ALPHA);
if (_fb_ds.constructed())
_fb_ds.destruct();
_fb_ds.construct(_env.rm(), _framebuffer.dataspace());
_fb_ds.construct(_env.rm(), _gui.framebuffer.dataspace());
}
_pdfapp.scrw = _nit_mode.area.w;
@ -213,16 +211,16 @@ class Pdf_view
void _handle_input_events()
{
Libc::with_libc([&] () {
_input.for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
_handle_input_event(ev); }); });
}
void _refresh()
{
_framebuffer.refresh(0, 0, _nit_mode.area.w, _nit_mode.area.h);
_gui.framebuffer.refresh(0, 0, _nit_mode.area.w, _nit_mode.area.h);
/* handle one sync signal only */
_framebuffer.sync_sigh(Genode::Signal_context_capability());
_gui.framebuffer.sync_sigh(Genode::Signal_context_capability());
}
public:
@ -236,7 +234,7 @@ class Pdf_view
Pdf_view(Genode::Env &env) : _env(env)
{
_gui.mode_sigh(_nit_mode_handler);
_input.sigh(_input_handler);
_gui.input.sigh(_input_handler);
pdfapp_init(&_pdfapp);
_pdfapp.userdata = this;
@ -322,7 +320,7 @@ void Pdf_view::show()
}
/* refresh after the next sync signal */
_framebuffer.sync_sigh(_sync_handler);
_gui.framebuffer.sync_sigh(_sync_handler);
}

View File

@ -63,7 +63,7 @@ class Viewer
{
_gui.buffer(mode, false);
_fb_ds.construct(_env.rm(), _gui.framebuffer()->dataspace());
_fb_ds.construct(_env.rm(), _gui.framebuffer.dataspace());
_framebuffer = _fb_ds->local_addr<uint8_t>();
using Command = Gui::Session::Command;
@ -78,7 +78,7 @@ class Viewer
uint8_t *framebuffer() { return _framebuffer; }
void refresh() {
_gui.framebuffer()->refresh(0, 0, _mode.area.w, _mode.area.h);
_gui.framebuffer.refresh(0, 0, _mode.area.w, _mode.area.h);
}
Framebuffer::Mode const &mode() { return _mode; }

View File

@ -78,7 +78,7 @@ struct Window : Genode_egl_window
if (ds.constructed())
ds.destruct();
ds.construct(env.rm(), gui.framebuffer()->dataspace());
ds.construct(env.rm(), gui.framebuffer.dataspace());
addr = ds->local_addr<unsigned char>();
@ -89,7 +89,7 @@ struct Window : Genode_egl_window
void refresh()
{
gui.framebuffer()->refresh(0, 0, mode.area.w, mode.area.h);
gui.framebuffer.refresh(0, 0, mode.area.w, mode.area.h);
}
};

View File

@ -16,62 +16,57 @@
#include <gui_session/capability.h>
#include <base/rpc_client.h>
#include <base/attached_dataspace.h>
namespace Gui { struct Session_client; }
struct Gui::Session_client : Rpc_client<Session>
{
/**
* Constructor
*/
Session_client(Session_capability session) : Rpc_client<Session>(session) { }
Session_client(Capability<Session> session) : Rpc_client<Session>(session) { }
Framebuffer::Session_capability framebuffer_session() override {
return call<Rpc_framebuffer_session>(); }
Framebuffer::Session_capability framebuffer() override {
return call<Rpc_framebuffer>(); }
Input::Session_capability input_session() override {
return call<Rpc_input_session>(); }
Input::Session_capability input() override {
return call<Rpc_input>(); }
Create_view_result create_view() override {
return call<Rpc_create_view>(); }
Create_view_result create_view() override {
return call<Rpc_create_view>(); }
Create_child_view_result create_child_view(View_handle parent) override {
return call<Rpc_create_child_view>(parent); }
Create_child_view_result create_child_view(View_handle parent) override {
return call<Rpc_create_child_view>(parent); }
void destroy_view(View_handle view) override {
call<Rpc_destroy_view>(view); }
void destroy_view(View_handle view) override {
call<Rpc_destroy_view>(view); }
View_handle_result view_handle(View_capability view,
View_handle handle = View_handle()) override
{
return call<Rpc_view_handle>(view, handle);
}
View_handle_result view_handle(View_capability view,
View_handle handle = View_handle()) override
{
return call<Rpc_view_handle>(view, handle);
}
View_capability view_capability(View_handle handle) override {
return call<Rpc_view_capability>(handle); }
View_capability view_capability(View_handle handle) override {
return call<Rpc_view_capability>(handle); }
void release_view_handle(View_handle handle) override {
call<Rpc_release_view_handle>(handle); }
void release_view_handle(View_handle handle) override {
call<Rpc_release_view_handle>(handle); }
Dataspace_capability command_dataspace() override {
return call<Rpc_command_dataspace>(); }
Dataspace_capability command_dataspace() override {
return call<Rpc_command_dataspace>(); }
void execute() override { call<Rpc_execute>(); }
void execute() override { call<Rpc_execute>(); }
Framebuffer::Mode mode() override {
return call<Rpc_mode>(); }
Framebuffer::Mode mode() override {
return call<Rpc_mode>(); }
void mode_sigh(Signal_context_capability sigh) override {
call<Rpc_mode_sigh>(sigh); }
void mode_sigh(Signal_context_capability sigh) override {
call<Rpc_mode_sigh>(sigh); }
Buffer_result buffer(Framebuffer::Mode mode, bool alpha) override {
return call<Rpc_buffer>(mode, alpha); }
void focus(Gui::Session_capability session) override {
call<Rpc_focus>(session); }
Buffer_result buffer(Framebuffer::Mode mode, bool alpha) override {
return call<Rpc_buffer>(mode, alpha); }
void focus(Gui::Session_capability session) override {
call<Rpc_focus>(session); }
};
#endif /* _INCLUDE__GUI_SESSION__CLIENT_H_ */

View File

@ -36,14 +36,20 @@ class Gui::Connection : private Genode::Connection<Session>
Command_buffer &_command_buffer { *_command_ds.local_addr<Command_buffer>() };
Framebuffer::Session_client _framebuffer { _client.framebuffer_session() };
Input::Session_client _input { _env.rm(), _client.input_session() };
Ram_quota _ram_quota { }; /* session quota donated for virtual frame buffer */
public:
/**
* Framebuffer access
*/
Framebuffer::Session_client framebuffer { _client.framebuffer() };
/**
* Input access
*/
Input::Session_client input { _env.rm(), _client.input() };
using View_handle = Session::View_handle;
using Genode::Connection<Session>::cap;
using Genode::Connection<Session>::upgrade;
@ -59,16 +65,6 @@ class Gui::Connection : private Genode::Connection<Session>
_env(env)
{ }
/**
* Return sub session for GUI's input service
*/
Input::Session_client *input() { return &_input; }
/**
* Return sub session for session's frame buffer
*/
Framebuffer::Session *framebuffer() { return &_framebuffer; }
View_handle create_view()
{
View_handle result { };

View File

@ -186,14 +186,14 @@ struct Gui::Session : Genode::Session
virtual ~Session() { }
/**
* Request framebuffer sub-session
* Request framebuffer RPC interface
*/
virtual Framebuffer::Session_capability framebuffer_session() = 0;
virtual Framebuffer::Session_capability framebuffer() = 0;
/**
* Request input sub-session
* Request input RPC interface
*/
virtual Input::Session_capability input_session() = 0;
virtual Input::Session_capability input() = 0;
enum class Create_view_error { OUT_OF_RAM, OUT_OF_CAPS };
using Create_view_result = Attempt<View_handle, Create_view_error>;
@ -309,8 +309,8 @@ struct Gui::Session : Genode::Session
** RPC declaration **
*********************/
GENODE_RPC(Rpc_framebuffer_session, Framebuffer::Session_capability, framebuffer_session);
GENODE_RPC(Rpc_input_session, Input::Session_capability, input_session);
GENODE_RPC(Rpc_framebuffer, Framebuffer::Session_capability, framebuffer);
GENODE_RPC(Rpc_input, Input::Session_capability, input);
GENODE_RPC(Rpc_create_view, Create_view_result, create_view);
GENODE_RPC(Rpc_create_child_view, Create_child_view_result, create_child_view, View_handle);
GENODE_RPC(Rpc_destroy_view, void, destroy_view, View_handle);
@ -325,7 +325,7 @@ struct Gui::Session : Genode::Session
GENODE_RPC(Rpc_focus, void, focus, Capability<Session>);
GENODE_RPC(Rpc_buffer, Buffer_result, buffer, Framebuffer::Mode, bool);
GENODE_RPC_INTERFACE(Rpc_framebuffer_session, Rpc_input_session,
GENODE_RPC_INTERFACE(Rpc_framebuffer, Rpc_input,
Rpc_create_view, Rpc_create_child_view, Rpc_destroy_view,
Rpc_view_handle, Rpc_view_capability, Rpc_release_view_handle,
Rpc_command_dataspace, Rpc_execute, Rpc_mode,

View File

@ -48,7 +48,7 @@ struct Global_keys_handler::Main
/**
* Input-event buffer
*/
Attached_dataspace _ev_ds { _env.rm(), _nitpicker.input()->dataspace() };
Attached_dataspace _ev_ds { _env.rm(), _nitpicker.input.dataspace() };
/**
* Number of pressed keys, used to distinguish primary keys from key
@ -277,7 +277,7 @@ struct Global_keys_handler::Main
Main(Env &env) : _env(env)
{
_config_ds.sigh(_config_handler);
_nitpicker.input()->sigh(_input_handler);
_nitpicker.input.sigh(_input_handler);
_handle_config();
_handle_input();
@ -398,7 +398,7 @@ void Global_keys_handler::Main::_handle_config()
void Global_keys_handler::Main::_handle_input()
{
while (unsigned const num_ev = _nitpicker.input()->flush())
while (unsigned const num_ev = _nitpicker.input.flush())
_apply_input_events(num_ev, _ev_ds.local_addr<Input::Event const>());
/* determine currently hovered domain */

View File

@ -137,7 +137,7 @@ void Pointer::Main::_resize_gui_buffer_if_needed(Gui::Area pointer_size)
_gui.buffer(mode, true /* use alpha */);
_pointer_ds = _gui.framebuffer()->dataspace();
_pointer_ds = _gui.framebuffer.dataspace();
_current_pointer_size = pointer_size;
}
@ -163,7 +163,7 @@ void Pointer::Main::_show_default_pointer()
convert_default_pointer_data_to_pixels(ds.local_addr<Genode::Pixel_rgb888>(),
pointer_size);
_gui.framebuffer()->refresh(0, 0, pointer_size.w, pointer_size.h);
_gui.framebuffer.refresh(0, 0, pointer_size.w, pointer_size.h);
Gui::Rect geometry(Gui::Point(0, 0), pointer_size);
_gui.enqueue<Gui::Session::Command::Geometry>(_view, geometry);
@ -224,7 +224,7 @@ void Pointer::Main::_show_shape_pointer(Shape_report &shape_report)
Dither_painter::paint(alpha_surface, texture);
}
_gui.framebuffer()->refresh(0, 0, shape_size.w, shape_size.h);
_gui.framebuffer.refresh(0, 0, shape_size.w, shape_size.h);
Gui::Rect geometry(shape_hot, shape_size);
_gui.enqueue<Gui::Session::Command::Geometry>(_view, geometry);

View File

@ -56,7 +56,7 @@ struct Status_bar::Buffer
Dataspace_capability _init_buffer()
{
_gui.buffer(_mode, false);
return _gui.framebuffer()->dataspace();
return _gui.framebuffer.dataspace();
}
Attached_dataspace _fb_ds;
@ -157,7 +157,7 @@ void Status_bar::Buffer::draw(Domain_name const &domain_name,
_draw_label(surface, view_rect.center(_label_size(domain_name, label)),
domain_name, label, color);
_gui.framebuffer()->refresh(0, 0, area.w, area.h);
_gui.framebuffer.refresh(0, 0, area.w, area.h);
}

View File

@ -89,8 +89,6 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
Gui::Connection &_gui;
Framebuffer::Session &_gui_fb = *_gui.framebuffer();
Genode::Signal_context_capability _mode_sigh { };
Genode::Signal_context_capability _sync_sigh { };
@ -189,7 +187,7 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
*/
_dataspace_is_new = true;
return _gui_fb.dataspace();
return _gui.framebuffer.dataspace();
}
Mode mode() const override
@ -210,7 +208,7 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
_dataspace_is_new = false;
}
_gui_fb.refresh(x, y, w, h);
_gui.framebuffer.refresh(x, y, w, h);
}
void sync_sigh(Genode::Signal_context_capability sigh) override
@ -223,7 +221,7 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
*/
_sync_sigh = sigh;
_gui_fb.sync_sigh(sigh);
_gui.framebuffer.sync_sigh(sigh);
}
};
@ -248,7 +246,7 @@ struct Nit_fb::Main : View_updater
View_handle view = gui.create_view();
Genode::Attached_dataspace input_ds { env.rm(), gui.input()->dataspace() };
Genode::Attached_dataspace input_ds { env.rm(), gui.input.dataspace() };
struct Initial_size
{
@ -397,7 +395,7 @@ struct Nit_fb::Main : View_updater
{
Input::Event const * const events = input_ds.local_addr<Input::Event>();
unsigned const num = gui.input()->flush();
unsigned const num = gui.input.flush();
bool update = false;
for (unsigned i = 0; i < num; i++) {
@ -436,7 +434,7 @@ struct Nit_fb::Main : View_updater
*/
config_rom.sigh(config_update_handler);
gui.mode_sigh(mode_update_handler);
gui.input()->sigh(input_handler);
gui.input.sigh(input_handler);
}
};

View File

@ -338,14 +338,14 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
}
/*********************************
/***************************
** GUI session interface **
*********************************/
***************************/
Framebuffer::Session_capability framebuffer_session() override {
Framebuffer::Session_capability framebuffer() override {
return _framebuffer_session_cap; }
Input::Session_capability input_session() override {
Input::Session_capability input() override {
return _input_session_cap; }
Create_view_result create_view() override;

View File

@ -223,7 +223,7 @@ void Vmm::Virtio_gpu_control_request::_resource_flush()
uint32_t line_dst = _device._fb_mode.area.w * BYTES_PER_PIXEL;
blit(src, line_src, dst, line_dst, w*BYTES_PER_PIXEL, h);
_device._gui.framebuffer()->refresh(x, y, w, h);
_device._gui.framebuffer.refresh(x, y, w, h);
});
}

View File

@ -462,8 +462,7 @@ class Vmm::Virtio_gpu_device : public Virtio_device<Virtio_gpu_queue, 2>
_gui.buffer(_fb_mode, false);
if (_fb_mode.area.count() > 0)
_fb_ds.construct(_env.rm(),
_gui.framebuffer()->dataspace());
_fb_ds.construct(_env.rm(), _gui.framebuffer.dataspace());
using Command = Gui::Session::Command;
_gui.enqueue<Command::Geometry>(_view, Rect(Point(0, 0), _fb_mode.area));

View File

@ -150,7 +150,7 @@ Vm::Vm(Genode::Env & env, Heap & heap, Config & config)
Virtio_input_device(dev.name.string(), (uint64_t)dev.mmio_start,
dev.mmio_size, dev.irq, boot_cpu(),
_bus, _ram, _device_list, env,
heap, *_gui->input());
heap, _gui->input);
default:
return;
};

View File

@ -94,7 +94,7 @@ struct Test::Main
bool _gui_buffer_init = ( _validate_mode(), _gui.buffer(_mode, false), true );
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer()->dataspace() };
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer.dataspace() };
Registry<Registered<View>> _views { };
@ -190,8 +190,8 @@ struct Test::Main
});
affected.for_each_rect([&] (Gui::Rect const rect) {
_output->_gui.framebuffer()->refresh(rect.x1(), rect.y1(),
rect.w(), rect.h());
_output->_gui.framebuffer.refresh(rect.x1(), rect.y1(),
rect.w(), rect.h());
});
});
});

View File

@ -247,7 +247,7 @@ struct Test::Main
Test::Main::Main(Genode::Env &env) : _env(env)
{
_gui.input()->sigh(_input_handler);
_gui.input.sigh(_input_handler);
Gui::Area const size { 256, 256 };
@ -257,7 +257,7 @@ Test::Main::Main(Genode::Env &env) : _env(env)
_gui.buffer(mode, _config.alpha);
_fb_ds.construct(_env.rm(), _gui.framebuffer()->dataspace());
_fb_ds.construct(_env.rm(), _gui.framebuffer.dataspace());
/*
* Paint into pixel buffer, fill alpha channel and input-mask buffer
@ -291,9 +291,9 @@ Test::Main::Main(Genode::Env &env) : _env(env)
void Test::Main::_handle_input()
{
while (_gui.input()->pending()) {
while (_gui.input.pending()) {
_gui.input()->for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
if (ev.press()) _key_cnt++;
if (ev.release()) _key_cnt--;

View File

@ -98,7 +98,7 @@ struct Test::Main
bool _gui_buffer_init = ( _validate_mode(), _gui.buffer(_mode, false), true );
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer()->dataspace() };
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer.dataspace() };
Registry<Registered<View>> _views { };
@ -205,8 +205,8 @@ struct Test::Main
});
affected.for_each_rect([&] (Gui::Rect const rect) {
_output->_gui.framebuffer()->refresh(rect.x1(), rect.y1(),
rect.w(), rect.h());
_output->_gui.framebuffer.refresh(rect.x1(), rect.y1(),
rect.w(), rect.h());
});
});
});

View File

@ -131,7 +131,7 @@ void GenodeConsole::_handle_input()
if (vm_down && (_vbox_mouse || _vbox_keyboard)) {
_vbox_mouse = nullptr;
_vbox_keyboard = nullptr;
_input.sigh(Genode::Signal_context_capability());
_gui.input.sigh(Genode::Signal_context_capability());
}
static LONG64 mt_events [64];
@ -145,7 +145,7 @@ void GenodeConsole::_handle_input()
_vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi);
}
_input.for_each_event([&] (Input::Event const &ev) {
_gui.input.for_each_event([&] (Input::Event const &ev) {
/* if keyboard/mouse not available, consume input events and drop it */
if (!_vbox_keyboard || !_vbox_mouse)
return;

View File

@ -114,7 +114,6 @@ class GenodeConsole : public Console {
private:
Gui::Connection _gui;
Input::Session_client &_input;
unsigned _ax, _ay;
bool _last_received_motion_event_was_absolute;
Report::Connection _shape_report_connection;
@ -143,7 +142,6 @@ class GenodeConsole : public Console {
:
Console(),
_gui(genode_env()),
_input(*_gui.input()),
_ax(0), _ay(0),
_last_received_motion_event_was_absolute(false),
_shape_report_connection(genode_env(), "shape",
@ -162,7 +160,7 @@ class GenodeConsole : public Console {
for (unsigned i = 0; i <= Input::KEY_MAX; i++)
_key_status[i] = false;
_input.sigh(_input_signal_dispatcher);
_gui.input.sigh(_input_signal_dispatcher);
Genode::Attached_rom_dataspace config(genode_env(), "config");

View File

@ -35,7 +35,6 @@ class Genodefb :
Genode::Env &_env;
Gui::Connection &_gui;
Fb_Genode::Session &_fb;
View_handle _view;
Fb_Genode::Mode _fb_mode { .area = { 1024, 768 } };
@ -47,7 +46,7 @@ class Genodefb :
void *_attach()
{
return _env.rm().attach(_fb.dataspace(), {
return _env.rm().attach(_gui.framebuffer.dataspace(), {
.size = { }, .offset = { }, .use_at = { },
.at = { }, .executable = { }, .writeable = true
}).convert<void *>(
@ -70,7 +69,7 @@ class Genodefb :
size_t const max_h = Genode::min(_fb_mode.area.h, _virtual_fb_mode.area.h);
size_t const num_pixels = _fb_mode.area.w * max_h;
memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
_fb.refresh(0, 0, _virtual_fb_mode.area.w, _virtual_fb_mode.area.h);
_gui.framebuffer.refresh(0, 0, _virtual_fb_mode.area.w, _virtual_fb_mode.area.h);
}
void _adjust_buffer()
@ -105,7 +104,6 @@ class Genodefb :
:
_env(env),
_gui(gui),
_fb(*gui.framebuffer()),
_virtual_fb_mode(_initial_setup()),
_display(display)
{
@ -252,7 +250,7 @@ class Genodefb :
Texture_painter::SOLID,
false);
_fb.refresh(o_x, o_y, width, height);
_gui.framebuffer.refresh(o_x, o_y, width, height);
Unlock();
@ -286,7 +284,7 @@ class Genodefb :
Texture_painter::SOLID,
false);
_fb.refresh(o_x, o_y, area_vm.w, area_vm.h);
_gui.framebuffer.refresh(o_x, o_y, area_vm.w, area_vm.h);
Unlock();

View File

@ -34,7 +34,6 @@ class Genodefb :
Genode::Env &_env;
Gui::Connection &_gui;
Fb_Genode::Session &_fb;
View_handle _view;
Fb_Genode::Mode _fb_mode { .area = { 1024, 768 } };
@ -46,7 +45,7 @@ class Genodefb :
void *_attach()
{
return _env.rm().attach(_fb.dataspace(), {
return _env.rm().attach(_gui.framebuffer.dataspace(), {
.size = { }, .offset = { }, .use_at = { },
.at = { }, .executable = { }, .writeable = true
}).convert<void *>(
@ -68,7 +67,7 @@ class Genodefb :
size_t const max_h = Genode::min(_fb_mode.area.h, _virtual_fb_mode.area.h);
size_t const num_pixels = _fb_mode.area.w * max_h;
memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
_fb.refresh(0, 0, _virtual_fb_mode.area.w, _virtual_fb_mode.area.h);
_gui.framebuffer.refresh(0, 0, _virtual_fb_mode.area.w, _virtual_fb_mode.area.h);
}
void _adjust_buffer()
@ -105,7 +104,6 @@ class Genodefb :
:
_env(env),
_gui(gui),
_fb(*gui.framebuffer()),
_virtual_fb_mode(_initial_setup()),
_display(display)
{
@ -254,7 +252,7 @@ class Genodefb :
Texture_painter::SOLID,
false);
_fb.refresh(o_x, o_y, width, height);
_gui.framebuffer.refresh(o_x, o_y, width, height);
Unlock();
@ -288,7 +286,7 @@ class Genodefb :
Texture_painter::SOLID,
false);
_fb.refresh(o_x, o_y, area_vm.w, area_vm.h);
_gui.framebuffer.refresh(o_x, o_y, area_vm.w, area_vm.h);
Unlock();

View File

@ -301,7 +301,7 @@ struct Main : Event_handler
Gui::Connection &gui = *new Registered<Gui::Connection>(_gui_connections, _env, label.string());
gui.input()->sigh(_input_handler);
gui.input.sigh(_input_handler);
gui.mode_sigh(_fb_mode_handler);
Genodefb *fb = new Genodefb(_env, gui, _idisplay);
@ -423,7 +423,7 @@ void Main::_handle_input()
Libc::with_libc([&] {
_gui_connections.for_each([&] (Gui::Connection &gui) {
gui.input()->for_each_event([&] (Input::Event const &ev) {
gui.input.for_each_event([&] (Input::Event const &ev) {
handle_one_event(ev); }); }); });
}