mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
gui_session: rename View_handle to View_id
The former Gui::Session::View_handle is not called Gui::View_id. Issue #5242
This commit is contained in:
parent
d02a3d25d0
commit
24378ac873
@ -56,11 +56,9 @@ class Scout::Graphics_backend_impl : public Graphics_backend
|
||||
|
||||
Genode::Attached_dataspace _fb_ds { _local_rm, _init_fb_ds(_max_size) };
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
Point _position;
|
||||
Area _view_size;
|
||||
View_handle _view { _gui.create_view() };
|
||||
Gui::View_id _view { _gui.create_view() };
|
||||
Canvas_base *_canvas[2];
|
||||
bool _flip_state = { false };
|
||||
|
||||
|
@ -355,10 +355,9 @@ class Log_view
|
||||
Gui::Connection &_gui;
|
||||
Gui::Point _pos;
|
||||
Gui::Area _size;
|
||||
Gui::Session::View_handle _handle;
|
||||
Gui::View_id const _view = _gui.create_view();
|
||||
|
||||
using Command = Gui::Session::Command;
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
public:
|
||||
|
||||
@ -366,8 +365,7 @@ class Log_view
|
||||
:
|
||||
_gui(gui),
|
||||
_pos(geometry.at),
|
||||
_size(geometry.area),
|
||||
_handle(gui.create_view())
|
||||
_size(geometry.area)
|
||||
{
|
||||
move(_pos);
|
||||
top();
|
||||
@ -375,7 +373,7 @@ class Log_view
|
||||
|
||||
void top()
|
||||
{
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Front>(_view);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
@ -384,7 +382,7 @@ class Log_view
|
||||
_pos = pos;
|
||||
|
||||
Gui::Rect rect(_pos, _size);
|
||||
_gui.enqueue<Command::Geometry>(_handle, rect);
|
||||
_gui.enqueue<Command::Geometry>(_view, rect);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ class Nano3d::Scene
|
||||
|
||||
} _framebuffer { _gui, _size, _env.rm() };
|
||||
|
||||
Gui::Session::View_handle _view_handle = _gui.create_view();
|
||||
Gui::View_id _view_id = _gui.create_view();
|
||||
|
||||
using Pixel_surface = Genode::Surface<PT>;
|
||||
using Alpha_surface = Genode::Surface<Genode::Pixel_alpha8>;
|
||||
@ -261,7 +261,7 @@ class Nano3d::Scene
|
||||
: -2*h;
|
||||
|
||||
Gui::Point const offset(0, buf_y);
|
||||
_gui.enqueue<Command::Offset>(_view_handle, offset);
|
||||
_gui.enqueue<Command::Offset>(_view_id, offset);
|
||||
_gui.execute();
|
||||
|
||||
_do_sync = false;
|
||||
@ -280,8 +280,8 @@ class Nano3d::Scene
|
||||
_env(env), _pos(pos), _size(size)
|
||||
{
|
||||
Gui::Rect rect(_pos, _size);
|
||||
_gui.enqueue<Command::Geometry>(_view_handle, rect);
|
||||
_gui.enqueue<Command::Front>(_view_handle);
|
||||
_gui.enqueue<Command::Geometry>(_view_id, rect);
|
||||
_gui.enqueue<Command::Front>(_view_id);
|
||||
_gui.execute();
|
||||
|
||||
_gui.input.sigh(_input_handler);
|
||||
|
@ -110,17 +110,17 @@ struct Backdrop::Main
|
||||
|
||||
Constructible<Buffer> _buffer { };
|
||||
|
||||
Gui::Session::View_handle _view_handle = _gui.create_view();
|
||||
Gui::View_id _view_id = _gui.create_view();
|
||||
|
||||
void _update_view()
|
||||
{
|
||||
/* display view behind all others */
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
_gui.enqueue<Command::Background>(_view_handle);
|
||||
_gui.enqueue<Command::Background>(_view_id);
|
||||
Gui::Rect rect(Gui::Point(), _buffer->size());
|
||||
_gui.enqueue<Command::Geometry>(_view_handle, rect);
|
||||
_gui.enqueue<Command::Back>(_view_handle);
|
||||
_gui.enqueue<Command::Geometry>(_view_id, rect);
|
||||
_gui.enqueue<Command::Back>(_view_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class Decorator::Window : public Window_base
|
||||
{
|
||||
Gui::Connection &_gui;
|
||||
|
||||
View_handle _handle { _gui.create_view() };
|
||||
Gui::View_id _id { _gui.create_view() };
|
||||
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
@ -54,31 +54,30 @@ class Decorator::Window : public Window_base
|
||||
* We supply the window ID as label for the anchor view.
|
||||
*/
|
||||
if (id)
|
||||
_gui.enqueue<Command::Title>(_handle,
|
||||
Genode::String<128>(id).string());
|
||||
_gui.enqueue<Command::Title>(_id, Genode::String<128>(id).string());
|
||||
}
|
||||
|
||||
~Gui_view()
|
||||
{
|
||||
_gui.destroy_view(_handle);
|
||||
_gui.destroy_view(_id);
|
||||
}
|
||||
|
||||
View_handle handle() const { return _handle; }
|
||||
Gui::View_id id() const { return _id; }
|
||||
|
||||
void stack(View_handle neighbor)
|
||||
void stack(Gui::View_id neighbor)
|
||||
{
|
||||
_gui.enqueue<Command::Front_of>(_handle, neighbor);
|
||||
_gui.enqueue<Command::Front_of>(_id, neighbor);
|
||||
}
|
||||
|
||||
void stack_front_most() { _gui.enqueue<Command::Front>(_handle); }
|
||||
void stack_front_most() { _gui.enqueue<Command::Front>(_id); }
|
||||
|
||||
void stack_back_most() { _gui.enqueue<Command::Back>(_handle); }
|
||||
void stack_back_most() { _gui.enqueue<Command::Back>(_id); }
|
||||
|
||||
void place(Rect rect)
|
||||
{
|
||||
_gui.enqueue<Command::Geometry>(_handle, rect);
|
||||
_gui.enqueue<Command::Geometry>(_id, rect);
|
||||
Point offset = Point(0, 0) - rect.at;
|
||||
_gui.enqueue<Command::Offset>(_handle, offset);
|
||||
_gui.enqueue<Command::Offset>(_id, offset);
|
||||
}
|
||||
};
|
||||
|
||||
@ -411,10 +410,10 @@ class Decorator::Window : public Window_base
|
||||
|
||||
void _stack_decoration_views()
|
||||
{
|
||||
_top_view.stack(_content_view.handle());
|
||||
_left_view.stack(_top_view.handle());
|
||||
_right_view.stack(_left_view.handle());
|
||||
_bottom_view.stack(_right_view.handle());
|
||||
_top_view.stack(_content_view.id());
|
||||
_left_view.stack(_top_view.id());
|
||||
_right_view.stack(_left_view.id());
|
||||
_bottom_view.stack(_right_view.id());
|
||||
}
|
||||
|
||||
public:
|
||||
@ -436,7 +435,7 @@ class Decorator::Window : public Window_base
|
||||
_border_size, _border_size, _border_size);
|
||||
}
|
||||
|
||||
void stack(View_handle neighbor) override
|
||||
void stack(Gui::View_id neighbor) override
|
||||
{
|
||||
_content_view.stack(neighbor);
|
||||
_stack_decoration_views();
|
||||
@ -454,9 +453,9 @@ class Decorator::Window : public Window_base
|
||||
_stack_decoration_views();
|
||||
}
|
||||
|
||||
View_handle frontmost_view() const override
|
||||
Gui::View_id frontmost_view() const override
|
||||
{
|
||||
return _bottom_view.handle();
|
||||
return _bottom_view.id();
|
||||
}
|
||||
|
||||
Rect outer_geometry() const override
|
||||
|
@ -74,7 +74,7 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
|
||||
|
||||
Constructible<Gui_buffer> _buffer { };
|
||||
|
||||
Gui::Session::View_handle const _view_handle = _gui.create_view();
|
||||
Gui::View_id const _view_id = _gui.create_view();
|
||||
|
||||
Point _position { };
|
||||
|
||||
@ -110,8 +110,8 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
_view_geometry = geometry;
|
||||
_gui.enqueue<Command::Geometry>(_view_handle, _view_geometry);
|
||||
_gui.enqueue<Command::Front>(_view_handle);
|
||||
_gui.enqueue<Command::Geometry>(_view_id, _view_geometry);
|
||||
_gui.enqueue<Command::Front>(_view_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
|
@ -53,17 +53,17 @@ struct Osci::Main
|
||||
{
|
||||
Gui::Connection &_gui;
|
||||
|
||||
Gui::Session::View_handle _handle { _gui.create_view() };
|
||||
Gui::View_id _id { _gui.create_view() };
|
||||
|
||||
View(Gui::Connection &gui, Point position, Area size) : _gui(gui)
|
||||
{
|
||||
using Command = Gui::Session::Command;
|
||||
_gui.enqueue<Command::Geometry>(_handle, Rect(position, size));
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Geometry>(_id, Rect(position, size));
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
~View() { _gui.destroy_view(_handle); }
|
||||
~View() { _gui.destroy_view(_id); }
|
||||
};
|
||||
|
||||
Constructible<View> _view { };
|
||||
|
@ -90,17 +90,17 @@ struct Osci::Main
|
||||
{
|
||||
Gui::Connection &_gui;
|
||||
|
||||
Gui::Session::View_handle _handle { _gui.create_view() };
|
||||
Gui::View_id _id { _gui.create_view() };
|
||||
|
||||
View(Gui::Connection &gui, Point position, Area size) : _gui(gui)
|
||||
{
|
||||
using Command = Gui::Session::Command;
|
||||
_gui.enqueue<Command::Geometry>(_handle, Rect(position, size));
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Geometry>(_id, Rect(position, size));
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
~View() { _gui.destroy_view(_handle); }
|
||||
~View() { _gui.destroy_view(_id); }
|
||||
};
|
||||
|
||||
Constructible<View> _view { };
|
||||
|
@ -56,17 +56,17 @@ struct Screenshot_trigger::Main
|
||||
{
|
||||
Gui::Connection &_gui;
|
||||
|
||||
Gui::Session::View_handle _handle { _gui.create_view() };
|
||||
Gui::View_id _id { _gui.create_view() };
|
||||
|
||||
View(Gui::Connection &gui, Point position, Area size) : _gui(gui)
|
||||
{
|
||||
using Command = Gui::Session::Command;
|
||||
_gui.enqueue<Command::Geometry>(_handle, Rect(position, size));
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Geometry>(_id, Rect(position, size));
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
~View() { _gui.destroy_view(_handle); }
|
||||
~View() { _gui.destroy_view(_id); }
|
||||
};
|
||||
|
||||
Constructible<View> _view { };
|
||||
|
@ -124,23 +124,23 @@ struct Gui::Session_component : Rpc_object<Gui::Session>
|
||||
Create_view_result create_view() override {
|
||||
return _gui_session.create_view(); }
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent) override {
|
||||
Create_child_view_result create_child_view(View_id parent) override {
|
||||
return _gui_session.create_child_view(parent); }
|
||||
|
||||
void destroy_view(View_handle view) override {
|
||||
void destroy_view(View_id view) override {
|
||||
_gui_session.destroy_view(view); }
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view_cap) override {
|
||||
return _gui_session.alloc_view_handle(view_cap); }
|
||||
Alloc_view_id_result alloc_view_id(View_capability view_cap) override {
|
||||
return _gui_session.alloc_view_id(view_cap); }
|
||||
|
||||
View_handle_result view_handle(View_capability view_cap, View_handle handle) override {
|
||||
return _gui_session.view_handle(view_cap, handle); }
|
||||
View_id_result view_id(View_capability view_cap, View_id id) override {
|
||||
return _gui_session.view_id(view_cap, id); }
|
||||
|
||||
View_capability view_capability(View_handle view) override {
|
||||
View_capability view_capability(View_id view) override {
|
||||
return _gui_session.view_capability(view); }
|
||||
|
||||
void release_view_handle(View_handle view) override {
|
||||
_gui_session.release_view_handle(view); }
|
||||
void release_view_id(View_id view) override {
|
||||
_gui_session.release_view_id(view); }
|
||||
|
||||
Dataspace_capability command_dataspace() override {
|
||||
return _gui_session.command_dataspace(); }
|
||||
|
@ -149,30 +149,30 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
|
||||
Gui::Connection &_gui;
|
||||
|
||||
View_handle _handle;
|
||||
Gui::View_id _id;
|
||||
|
||||
Gui_view(Gui::Connection &gui, unsigned id = 0)
|
||||
Gui_view(Gui::Connection &gui, unsigned win_id = 0)
|
||||
:
|
||||
_view_is_remote(false),
|
||||
_gui(gui),
|
||||
_handle(_gui.create_view())
|
||||
_id(_gui.create_view())
|
||||
{
|
||||
/*
|
||||
* We supply the window ID as label for the anchor view.
|
||||
*/
|
||||
if (id)
|
||||
_gui.enqueue<Command::Title>(_handle,
|
||||
Genode::String<128>(id).string());
|
||||
if (win_id)
|
||||
_gui.enqueue<Command::Title>(_id,
|
||||
Genode::String<128>(win_id).string());
|
||||
}
|
||||
|
||||
View_handle _create_remote_view(Gui::Connection &remote_gui)
|
||||
Gui::View_id _create_remote_view(Gui::Connection &remote_gui)
|
||||
{
|
||||
/* create view at the remote GUI session */
|
||||
View_handle handle = remote_gui.create_view();
|
||||
Gui::View_capability view_cap = remote_gui.view_capability(handle);
|
||||
Gui::View_id id = remote_gui.create_view();
|
||||
Gui::View_capability view_cap = remote_gui.view_capability(id);
|
||||
|
||||
/* import remote view into local GUI session */
|
||||
return _gui.alloc_view_handle(view_cap);
|
||||
return _gui.alloc_view_id(view_cap);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,37 +184,37 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
:
|
||||
_view_is_remote(true),
|
||||
_gui(gui),
|
||||
_handle(_create_remote_view(remote_gui))
|
||||
_id(_create_remote_view(remote_gui))
|
||||
{ }
|
||||
|
||||
~Gui_view()
|
||||
{
|
||||
if (_view_is_remote)
|
||||
_gui.release_view_handle(_handle);
|
||||
_gui.release_view_id(_id);
|
||||
else
|
||||
_gui.destroy_view(_handle);
|
||||
_gui.destroy_view(_id);
|
||||
}
|
||||
|
||||
View_handle handle() const { return _handle; }
|
||||
Gui::View_id id() const { return _id; }
|
||||
|
||||
void stack(View_handle neighbor)
|
||||
void stack(Gui::View_id neighbor)
|
||||
{
|
||||
_gui.enqueue<Command::Front_of>(_handle, neighbor);
|
||||
_gui.enqueue<Command::Front_of>(_id, neighbor);
|
||||
}
|
||||
|
||||
void stack_front_most() { _gui.enqueue<Command::Front>(_handle); }
|
||||
void stack_front_most() { _gui.enqueue<Command::Front>(_id); }
|
||||
|
||||
void stack_back_most() { _gui.enqueue<Command::Back>(_handle); }
|
||||
void stack_back_most() { _gui.enqueue<Command::Back>(_id); }
|
||||
|
||||
void place(Rect rect, Point offset)
|
||||
{
|
||||
_gui.enqueue<Command::Geometry>(_handle, rect);
|
||||
_gui.enqueue<Command::Offset>(_handle, offset);
|
||||
_gui.enqueue<Command::Geometry>(_id, rect);
|
||||
_gui.enqueue<Command::Offset>(_id, offset);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* GUI session used as a global namespace of view handles
|
||||
* GUI session used as a global namespace of view ID
|
||||
*/
|
||||
Gui::Connection &_gui;
|
||||
|
||||
@ -359,10 +359,10 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
void _stack_decoration_views()
|
||||
{
|
||||
if (_show_decoration) {
|
||||
_top_view.stack(_content_view.handle());
|
||||
_left_view.stack(_top_view.handle());
|
||||
_right_view.stack(_left_view.handle());
|
||||
_bottom_view.stack(_right_view.handle());
|
||||
_top_view.stack(_content_view.id());
|
||||
_left_view.stack(_top_view.id());
|
||||
_right_view.stack(_left_view.id());
|
||||
_bottom_view.stack(_right_view.id());
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
animate();
|
||||
}
|
||||
|
||||
void stack(View_handle neighbor) override
|
||||
void stack(Gui::View_id neighbor) override
|
||||
{
|
||||
_content_view.stack(neighbor);
|
||||
_stack_decoration_views();
|
||||
@ -399,9 +399,9 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
_stack_decoration_views();
|
||||
}
|
||||
|
||||
View_handle frontmost_view() const override
|
||||
Gui::View_id frontmost_view() const override
|
||||
{
|
||||
return _show_decoration ? _bottom_view.handle() : _content_view.handle();
|
||||
return _show_decoration ? _bottom_view.id() : _content_view.id();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,23 +128,23 @@ struct Sandboxed_runtime::Gui_session : Session_object<Gui::Session>
|
||||
Create_view_result create_view() override {
|
||||
return _gui_session.create_view(); }
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent) override {
|
||||
Create_child_view_result create_child_view(Gui::View_id parent) override {
|
||||
return _gui_session.create_child_view(parent); }
|
||||
|
||||
void destroy_view(View_handle view) override {
|
||||
void destroy_view(Gui::View_id view) override {
|
||||
_gui_session.destroy_view(view); }
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view_cap) override {
|
||||
return _gui_session.alloc_view_handle(view_cap); }
|
||||
Alloc_view_id_result alloc_view_id(View_capability view_cap) override {
|
||||
return _gui_session.alloc_view_id(view_cap); }
|
||||
|
||||
View_handle_result view_handle(View_capability view_cap, View_handle handle) override {
|
||||
return _gui_session.view_handle(view_cap, handle); }
|
||||
View_id_result view_id(View_capability view_cap, Gui::View_id id) override {
|
||||
return _gui_session.view_id(view_cap, id); }
|
||||
|
||||
View_capability view_capability(View_handle view) override {
|
||||
View_capability view_capability(Gui::View_id view) override {
|
||||
return _gui_session.view_capability(view); }
|
||||
|
||||
void release_view_handle(View_handle view) override {
|
||||
_gui_session.release_view_handle(view); }
|
||||
void release_view_id(Gui::View_id view) override {
|
||||
_gui_session.release_view_id(view); }
|
||||
|
||||
Dataspace_capability command_dataspace() override {
|
||||
return _gui_session.command_dataspace(); }
|
||||
|
@ -260,7 +260,7 @@ class Gui_fader::Gui_session_component
|
||||
private:
|
||||
|
||||
using View_capability = Gui::View_capability;
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using View_id = Gui::View_id;
|
||||
|
||||
Genode::Env &_env;
|
||||
|
||||
@ -278,22 +278,22 @@ class Gui_fader::Gui_session_component
|
||||
|
||||
Framebuffer::Session_capability _fb_cap { _env.ep().manage(_fb_session) };
|
||||
|
||||
Constructible<Gui::Session::View_handle> _view_handle { };
|
||||
Constructible<Gui::View_id> _view_id { };
|
||||
|
||||
bool _view_visible = false;
|
||||
Rect _view_geometry { };
|
||||
|
||||
void _update_view_visibility()
|
||||
{
|
||||
if (!_view_handle.constructed() || (_view_visible == _fb_session.visible()))
|
||||
if (!_view_id.constructed() || (_view_visible == _fb_session.visible()))
|
||||
return;
|
||||
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
if (_fb_session.visible())
|
||||
_gui.enqueue<Command::Geometry>(*_view_handle, _view_geometry);
|
||||
_gui.enqueue<Command::Geometry>(*_view_id, _view_geometry);
|
||||
else
|
||||
_gui.enqueue<Command::Geometry>(*_view_handle, Rect());
|
||||
_gui.enqueue<Command::Geometry>(*_view_id, Rect());
|
||||
|
||||
_gui.execute();
|
||||
|
||||
@ -347,43 +347,42 @@ class Gui_fader::Gui_session_component
|
||||
|
||||
Create_view_result create_view() override
|
||||
{
|
||||
_view_handle.construct(_gui.create_view());
|
||||
_view_id.construct(_gui.create_view());
|
||||
_update_view_visibility();
|
||||
return *_view_handle;
|
||||
return *_view_id;
|
||||
}
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent) override
|
||||
Create_child_view_result create_child_view(View_id parent) override
|
||||
{
|
||||
_view_handle.construct(_gui.create_child_view(parent));
|
||||
_view_id.construct(_gui.create_child_view(parent));
|
||||
_update_view_visibility();
|
||||
return *_view_handle;
|
||||
return *_view_id;
|
||||
}
|
||||
|
||||
void destroy_view(View_handle handle) override
|
||||
void destroy_view(View_id id) override
|
||||
{
|
||||
return _gui.destroy_view(handle);
|
||||
return _gui.destroy_view(id);
|
||||
}
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view_cap) override
|
||||
Alloc_view_id_result alloc_view_id(View_capability view_cap) override
|
||||
{
|
||||
return _gui.alloc_view_handle(view_cap);
|
||||
return _gui.alloc_view_id(view_cap);
|
||||
}
|
||||
|
||||
View_handle_result view_handle(View_capability view_cap,
|
||||
View_handle handle) override
|
||||
View_id_result view_id(View_capability view_cap, View_id id) override
|
||||
{
|
||||
_gui.view_handle(view_cap, handle);
|
||||
return View_handle_result::OK;
|
||||
_gui.view_id(view_cap, id);
|
||||
return View_id_result::OK;
|
||||
}
|
||||
|
||||
View_capability view_capability(View_handle handle) override
|
||||
View_capability view_capability(View_id id) override
|
||||
{
|
||||
return _gui.view_capability(handle);
|
||||
return _gui.view_capability(id);
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle handle) override
|
||||
void release_view_id(View_id id) override
|
||||
{
|
||||
_gui.release_view_handle(handle);
|
||||
_gui.release_view_id(id);
|
||||
}
|
||||
|
||||
Dataspace_capability command_dataspace() override
|
||||
|
@ -116,7 +116,7 @@ struct Terminal::Main : Character_consumer
|
||||
|
||||
Framebuffer::Mode _fb_mode { };
|
||||
|
||||
Gui::Session::View_handle _view = _gui.create_view();
|
||||
Gui::View_id _view = _gui.create_view();
|
||||
|
||||
Point _pointer { }; /* pointer positon in pixels */
|
||||
|
||||
|
@ -69,16 +69,16 @@ class Wm::Decorator_content_registry
|
||||
|
||||
private:
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using View_id = Gui::View_id;
|
||||
|
||||
struct Entry : List<Entry>::Element
|
||||
{
|
||||
View_handle const decorator_view_handle;
|
||||
View_id const decorator_view_id;
|
||||
Window_registry::Id const win_id;
|
||||
|
||||
Entry(View_handle decorator_view_handle, Window_registry::Id win_id)
|
||||
Entry(View_id decorator_view_id, Window_registry::Id win_id)
|
||||
:
|
||||
decorator_view_handle(decorator_view_handle),
|
||||
decorator_view_id(decorator_view_id),
|
||||
win_id(win_id)
|
||||
{ }
|
||||
};
|
||||
@ -86,10 +86,10 @@ class Wm::Decorator_content_registry
|
||||
List<Entry> _list { };
|
||||
Allocator &_entry_alloc;
|
||||
|
||||
Entry const &_lookup(View_handle view_handle) const
|
||||
Entry const &_lookup(View_id view_id) const
|
||||
{
|
||||
for (Entry const *e = _list.first(); e; e = e->next()) {
|
||||
if (e->decorator_view_handle == view_handle)
|
||||
if (e->decorator_view_id == view_id)
|
||||
return *e;
|
||||
}
|
||||
|
||||
@ -115,9 +115,9 @@ class Wm::Decorator_content_registry
|
||||
_remove(*e);
|
||||
}
|
||||
|
||||
void insert(View_handle decorator_view_handle, Window_registry::Id win_id)
|
||||
void insert(View_id decorator_view_id, Window_registry::Id win_id)
|
||||
{
|
||||
Entry *e = new (_entry_alloc) Entry(decorator_view_handle, win_id);
|
||||
Entry *e = new (_entry_alloc) Entry(decorator_view_id, win_id);
|
||||
_list.insert(e);
|
||||
}
|
||||
|
||||
@ -126,14 +126,14 @@ class Wm::Decorator_content_registry
|
||||
*
|
||||
* \throw Lookup_failed
|
||||
*/
|
||||
Window_registry::Id lookup(View_handle view_handle) const
|
||||
Window_registry::Id lookup(View_id view_id) const
|
||||
{
|
||||
return _lookup(view_handle).win_id;
|
||||
return _lookup(view_id).win_id;
|
||||
}
|
||||
|
||||
bool registered(View_handle view_handle) const
|
||||
bool registered(View_id view_id) const
|
||||
{
|
||||
try { lookup(view_handle); return true; } catch (...) { }
|
||||
try { lookup(view_id); return true; } catch (...) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -142,9 +142,9 @@ class Wm::Decorator_content_registry
|
||||
*
|
||||
* \throw Lookup_failed
|
||||
*/
|
||||
void remove(View_handle view_handle)
|
||||
void remove(View_id view_id)
|
||||
{
|
||||
_remove(_lookup(view_handle));
|
||||
_remove(_lookup(view_id));
|
||||
}
|
||||
};
|
||||
|
||||
@ -156,7 +156,7 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
using List<Decorator_gui_session>::Element::next;
|
||||
|
||||
using View_capability = Gui::View_capability;
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using View_id = Gui::View_id;
|
||||
using Command_buffer = Gui::Session::Command_buffer;
|
||||
|
||||
Genode::Env &_env;
|
||||
@ -252,7 +252,7 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
try {
|
||||
|
||||
/* the first argument is the same for all stacking operations */
|
||||
View_handle const view_handle = cmd.front.view;
|
||||
View_id const view_id = cmd.front.view;
|
||||
|
||||
/*
|
||||
* If the content view is re-stacked, replace it by the real
|
||||
@ -261,7 +261,7 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
* The lookup fails with an exception for non-content views.
|
||||
* In this case, forward the command.
|
||||
*/
|
||||
Window_registry::Id win_id = _content_registry.lookup(view_handle);
|
||||
Window_registry::Id win_id = _content_registry.lookup(view_id);
|
||||
|
||||
/*
|
||||
* Replace content view originally created by the decorator
|
||||
@ -269,8 +269,8 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
*/
|
||||
View_capability view_cap = _content_callback.content_view(win_id);
|
||||
|
||||
_gui.session.destroy_view(view_handle);
|
||||
_gui.session.view_handle(view_cap, view_handle);
|
||||
_gui.session.destroy_view(view_id);
|
||||
_gui.session.view_id(view_cap, view_id);
|
||||
|
||||
_gui.enqueue(cmd);
|
||||
_gui.execute();
|
||||
@ -364,12 +364,12 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
return _gui.session.create_view();
|
||||
}
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent) override
|
||||
Create_child_view_result create_child_view(View_id parent) override
|
||||
{
|
||||
return _gui.session.create_child_view(parent);
|
||||
}
|
||||
|
||||
void destroy_view(View_handle view) override
|
||||
void destroy_view(View_id view) override
|
||||
{
|
||||
/*
|
||||
* Reset view geometry when destroying a content view
|
||||
@ -386,25 +386,25 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
_gui.session.destroy_view(view);
|
||||
}
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view_cap) override
|
||||
Alloc_view_id_result alloc_view_id(View_capability view_cap) override
|
||||
{
|
||||
return _gui.session.alloc_view_handle(view_cap);
|
||||
return _gui.session.alloc_view_id(view_cap);
|
||||
}
|
||||
|
||||
View_handle_result view_handle(View_capability view_cap, View_handle handle) override
|
||||
View_id_result view_id(View_capability view_cap, View_id id) override
|
||||
{
|
||||
return _gui.session.view_handle(view_cap, handle);
|
||||
return _gui.session.view_id(view_cap, id);
|
||||
}
|
||||
|
||||
View_capability view_capability(View_handle view) override
|
||||
View_capability view_capability(View_id view) override
|
||||
{
|
||||
return _gui.session.view_capability(view);
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle view) override
|
||||
void release_view_id(View_id view) override
|
||||
{
|
||||
/* XXX dealloc View_ptr */
|
||||
_gui.session.release_view_handle(view);
|
||||
_gui.session.release_view_id(view);
|
||||
}
|
||||
|
||||
Genode::Dataspace_capability command_dataspace() override
|
||||
|
@ -34,6 +34,9 @@ class Wm::Direct_gui_session : public Genode::Rpc_object<Gui::Session>
|
||||
|
||||
Gui::Session_client _session { _connection.cap() };
|
||||
|
||||
using View_capability = Gui::View_capability;
|
||||
using View_id = Gui::View_id;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -70,34 +73,34 @@ class Wm::Direct_gui_session : public Genode::Rpc_object<Gui::Session>
|
||||
return _session.create_view();
|
||||
}
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent) override
|
||||
Create_child_view_result create_child_view(View_id parent) override
|
||||
{
|
||||
return _session.create_child_view(parent);
|
||||
}
|
||||
|
||||
void destroy_view(View_handle view) override
|
||||
void destroy_view(View_id view) override
|
||||
{
|
||||
_session.destroy_view(view);
|
||||
}
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(Gui::View_capability view_cap) override
|
||||
Alloc_view_id_result alloc_view_id(View_capability view_cap) override
|
||||
{
|
||||
return _session.alloc_view_handle(view_cap);
|
||||
return _session.alloc_view_id(view_cap);
|
||||
}
|
||||
|
||||
View_handle_result view_handle(Gui::View_capability view_cap, View_handle handle) override
|
||||
View_id_result view_id(View_capability view_cap, View_id id) override
|
||||
{
|
||||
return _session.view_handle(view_cap, handle);
|
||||
return _session.view_id(view_cap, id);
|
||||
}
|
||||
|
||||
Gui::View_capability view_capability(View_handle view) override
|
||||
View_capability view_capability(View_id view) override
|
||||
{
|
||||
return _session.view_capability(view);
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle view) override
|
||||
void release_view_id(View_id view) override
|
||||
{
|
||||
_session.release_view_handle(view);
|
||||
_session.release_view_id(view);
|
||||
}
|
||||
|
||||
Genode::Dataspace_capability command_dataspace() override
|
||||
|
@ -59,7 +59,6 @@ namespace Wm { namespace Gui {
|
||||
|
||||
class Click_handler;
|
||||
class Input_origin_changed_handler;
|
||||
class View_handle_ctx;
|
||||
class View;
|
||||
class Top_level_view;
|
||||
class Child_view;
|
||||
@ -110,11 +109,11 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
|
||||
using Title = Genode::String<100>;
|
||||
using Command = Gui::Session::Command;
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using View_id = Gui::View_id;
|
||||
|
||||
Session_label _session_label;
|
||||
Real_gui &_real_gui;
|
||||
Constructible<View_handle> _real_handle { };
|
||||
Constructible<View_id> _real_view { };
|
||||
Title _title { };
|
||||
Rect _geometry { };
|
||||
Point _buffer_offset { };
|
||||
@ -140,37 +139,37 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
*/
|
||||
void _unsynchronized_apply_view_config(Locked_ptr<View> &neighbor)
|
||||
{
|
||||
if (!_real_handle.constructed())
|
||||
if (!_real_view.constructed())
|
||||
return;
|
||||
|
||||
_propagate_view_geometry();
|
||||
_real_gui.enqueue<Command::Offset>(*_real_handle, _buffer_offset);
|
||||
_real_gui.enqueue<Command::Title> (*_real_handle, _title.string());
|
||||
_real_gui.enqueue<Command::Offset>(*_real_view, _buffer_offset);
|
||||
_real_gui.enqueue<Command::Title> (*_real_view, _title.string());
|
||||
|
||||
Constructible<View_handle> real_neighbor_handle { };
|
||||
Constructible<View_id> real_neighbor_id { };
|
||||
|
||||
if (neighbor.valid())
|
||||
_real_gui.session.alloc_view_handle(neighbor->real_view_cap()).with_result(
|
||||
[&] (View_handle handle) { real_neighbor_handle.construct(handle); },
|
||||
[&] (auto) { warning("unable to obtain real_neighbor_handle"); }
|
||||
_real_gui.session.alloc_view_id(neighbor->real_view_cap()).with_result(
|
||||
[&] (View_id id) { real_neighbor_id.construct(id); },
|
||||
[&] (auto) { warning("unable to obtain real_neighbor_id"); }
|
||||
);
|
||||
|
||||
if (real_neighbor_handle.constructed()) {
|
||||
if (real_neighbor_id.constructed()) {
|
||||
if (_neighbor_behind)
|
||||
_real_gui.enqueue<Command::Front_of>(*_real_handle, *real_neighbor_handle);
|
||||
_real_gui.enqueue<Command::Front_of>(*_real_view, *real_neighbor_id);
|
||||
else
|
||||
_real_gui.enqueue<Command::Behind_of>(*_real_handle, *real_neighbor_handle);
|
||||
_real_gui.enqueue<Command::Behind_of>(*_real_view, *real_neighbor_id);
|
||||
} else {
|
||||
if (_neighbor_behind)
|
||||
_real_gui.enqueue<Command::Front>(*_real_handle);
|
||||
_real_gui.enqueue<Command::Front>(*_real_view);
|
||||
else
|
||||
_real_gui.enqueue<Command::Back>(*_real_handle);
|
||||
_real_gui.enqueue<Command::Back>(*_real_view);
|
||||
}
|
||||
|
||||
_real_gui.execute();
|
||||
|
||||
if (real_neighbor_handle.constructed())
|
||||
_real_gui.session.release_view_handle(*real_neighbor_handle);
|
||||
if (real_neighbor_id.constructed())
|
||||
_real_gui.session.release_view_id(*real_neighbor_id);
|
||||
}
|
||||
|
||||
void _apply_view_config()
|
||||
@ -183,8 +182,8 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
|
||||
~View()
|
||||
{
|
||||
if (_real_handle.constructed())
|
||||
_real_gui.session.destroy_view(*_real_handle);
|
||||
if (_real_view.constructed())
|
||||
_real_gui.session.destroy_view(*_real_view);
|
||||
}
|
||||
|
||||
using Genode::Weak_object<View>::weak_ptr;
|
||||
@ -201,7 +200,7 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
/*
|
||||
* Propagate new size to real GUI view but
|
||||
*/
|
||||
if (_real_handle.constructed()) {
|
||||
if (_real_view.constructed()) {
|
||||
_propagate_view_geometry();
|
||||
_real_gui.execute();
|
||||
}
|
||||
@ -211,8 +210,8 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
{
|
||||
_title = Title(title);
|
||||
|
||||
if (_real_handle.constructed()) {
|
||||
_real_gui.enqueue<Command::Title>(*_real_handle, title);
|
||||
if (_real_view.constructed()) {
|
||||
_real_gui.enqueue<Command::Title>(*_real_view, title);
|
||||
_real_gui.execute();
|
||||
}
|
||||
}
|
||||
@ -223,8 +222,8 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
|
||||
View_capability real_view_cap()
|
||||
{
|
||||
return _real_handle.constructed()
|
||||
? _real_gui.session.view_capability(*_real_handle)
|
||||
return _real_view.constructed()
|
||||
? _real_gui.session.view_capability(*_real_view)
|
||||
: View_capability();
|
||||
}
|
||||
|
||||
@ -232,8 +231,8 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
|
||||
{
|
||||
_buffer_offset = buffer_offset;
|
||||
|
||||
if (_real_handle.constructed()) {
|
||||
_real_gui.enqueue<Command::Offset>(*_real_handle, _buffer_offset);
|
||||
if (_real_view.constructed()) {
|
||||
_real_gui.enqueue<Command::Offset>(*_real_view, _buffer_offset);
|
||||
_real_gui.execute();
|
||||
}
|
||||
}
|
||||
@ -293,17 +292,17 @@ class Wm::Gui::Top_level_view : public View, private List<Top_level_view>::Eleme
|
||||
|
||||
void init_real_gui_view()
|
||||
{
|
||||
if (_real_handle.constructed())
|
||||
if (_real_view.constructed())
|
||||
return;
|
||||
|
||||
/*
|
||||
* Create and configure physical GUI view.
|
||||
*/
|
||||
_real_gui.session.create_view().with_result(
|
||||
[&] (View_handle handle) {
|
||||
_real_handle.construct(handle);
|
||||
_real_gui.enqueue<Command::Offset>(handle, _buffer_offset);
|
||||
_real_gui.enqueue<Command::Title> (handle, _title.string());
|
||||
[&] (View_id id) {
|
||||
_real_view.construct(id);
|
||||
_real_gui.enqueue<Command::Offset>(id, _buffer_offset);
|
||||
_real_gui.enqueue<Command::Title> (id, _title.string());
|
||||
_real_gui.execute();
|
||||
},
|
||||
[&] (Gui::Session::Create_view_error) {
|
||||
@ -311,7 +310,7 @@ class Wm::Gui::Top_level_view : public View, private List<Top_level_view>::Eleme
|
||||
}
|
||||
);
|
||||
|
||||
if (!_real_handle.constructed()) {
|
||||
if (!_real_view.constructed()) {
|
||||
warning("failed to created content view for ", _title);
|
||||
}
|
||||
}
|
||||
@ -376,8 +375,8 @@ class Wm::Gui::Top_level_view : public View, private List<Top_level_view>::Eleme
|
||||
{
|
||||
init_real_gui_view();
|
||||
|
||||
if (_real_handle.constructed())
|
||||
return _real_gui.session.view_capability(*_real_handle);
|
||||
if (_real_view.constructed())
|
||||
return _real_gui.session.view_capability(*_real_view);
|
||||
|
||||
error("content_view was unable to obtain real view");
|
||||
return { };
|
||||
@ -423,8 +422,8 @@ class Wm::Gui::Child_view : public View, private List<Child_view>::Element
|
||||
|
||||
void _propagate_view_geometry() override
|
||||
{
|
||||
if (_real_handle.constructed())
|
||||
_real_gui.enqueue<Command::Geometry>(*_real_handle, _geometry);
|
||||
if (_real_view.constructed())
|
||||
_real_gui.enqueue<Command::Geometry>(*_real_view, _geometry);
|
||||
}
|
||||
|
||||
void stack(Weak_ptr<View> neighbor_ptr, bool behind) override
|
||||
@ -452,35 +451,35 @@ class Wm::Gui::Child_view : public View, private List<Child_view>::Element
|
||||
|
||||
void try_to_init_real_view()
|
||||
{
|
||||
if (_real_handle.constructed())
|
||||
if (_real_view.constructed())
|
||||
return;
|
||||
|
||||
Locked_ptr<View> parent(_parent);
|
||||
if (!parent.valid())
|
||||
return;
|
||||
|
||||
Constructible<View_handle> parent_handle { };
|
||||
_real_gui.session.alloc_view_handle(parent->real_view_cap()).with_result(
|
||||
[&] (View_handle handle) { parent_handle.construct(handle); },
|
||||
[&] (Gui::Session::Alloc_view_handle_error e) {
|
||||
warning("try_to_init_real_view could not alloc parent handle e=", (int)e);
|
||||
Constructible<View_id> parent_id { };
|
||||
_real_gui.session.alloc_view_id(parent->real_view_cap()).with_result(
|
||||
[&] (View_id id) { parent_id.construct(id); },
|
||||
[&] (Gui::Session::Alloc_view_id_error e) {
|
||||
warning("try_to_init_real_view could not alloc parent ID e=", (int)e);
|
||||
}
|
||||
);
|
||||
if (!parent_handle.constructed()) {
|
||||
warning("try_to_init_real_view failed to obtain parent handle");
|
||||
if (!parent_id.constructed()) {
|
||||
warning("try_to_init_real_view failed to obtain parent ID");
|
||||
return;
|
||||
}
|
||||
|
||||
_real_gui.session.create_child_view(*parent_handle).with_result(
|
||||
[&] (View_handle handle) { _real_handle.construct(handle); },
|
||||
_real_gui.session.create_child_view(*parent_id).with_result(
|
||||
[&] (View_id id) { _real_view.construct(id); },
|
||||
[&] (Gui::Session::Create_child_view_error) { }
|
||||
);
|
||||
if (!_real_handle.constructed()) {
|
||||
if (!_real_view.constructed()) {
|
||||
warning("try_to_init_real_view failed to create child view");
|
||||
return;
|
||||
}
|
||||
|
||||
_real_gui.session.release_view_handle(*parent_handle);
|
||||
_real_gui.session.release_view_id(*parent_id);
|
||||
|
||||
if (_neighbor_ptr == _parent)
|
||||
_unsynchronized_apply_view_config(parent);
|
||||
@ -495,11 +494,11 @@ class Wm::Gui::Child_view : public View, private List<Child_view>::Element
|
||||
|
||||
void hide()
|
||||
{
|
||||
if (!_real_handle.constructed())
|
||||
if (!_real_view.constructed())
|
||||
return;
|
||||
|
||||
_real_gui.session.destroy_view(*_real_handle);
|
||||
_real_handle.destruct();
|
||||
_real_gui.session.destroy_view(*_real_view);
|
||||
_real_view.destruct();
|
||||
}
|
||||
};
|
||||
|
||||
@ -512,8 +511,7 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
|
||||
friend class List<Session_component>;
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
using View_id = Gui::View_id;
|
||||
using View_ids = Id_space<Gui::View_ref>;
|
||||
|
||||
struct View_ref : Gui::View_ref
|
||||
@ -525,7 +523,7 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
View_ref(Weak_ptr<View> view, View_ids &ids)
|
||||
: _weak_ptr(view), id(*this, ids) { }
|
||||
|
||||
View_ref(Weak_ptr<View> view, View_ids &ids, View_handle id)
|
||||
View_ref(Weak_ptr<View> view, View_ids &ids, View_id id)
|
||||
: _weak_ptr(view), id(*this, ids, id) { }
|
||||
|
||||
auto with_view(auto const &fn, auto const &missing_fn) -> decltype(missing_fn())
|
||||
@ -570,10 +568,10 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
Point _virtual_pointer_pos { };
|
||||
unsigned _key_cnt = 0;
|
||||
|
||||
auto _with_view(View_handle handle, auto const &fn, auto const &missing_fn)
|
||||
auto _with_view(View_id id, auto const &fn, auto const &missing_fn)
|
||||
-> decltype(missing_fn())
|
||||
{
|
||||
return _view_ids.apply<View_ref>(handle,
|
||||
return _view_ids.apply<View_ref>(id,
|
||||
[&] (View_ref &view_ref) {
|
||||
return view_ref.with_view(
|
||||
[&] (View &view) { return fn(view); },
|
||||
@ -1027,7 +1025,7 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
return result;
|
||||
}
|
||||
|
||||
Create_child_view_result create_child_view(View_handle const parent) override
|
||||
Create_child_view_result create_child_view(View_id const parent) override
|
||||
{
|
||||
using Error = Create_child_view_error;
|
||||
return _with_view(parent,
|
||||
@ -1044,10 +1042,10 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
});
|
||||
|
||||
return result.convert<Create_child_view_result>(
|
||||
[&] (View_handle handle) {
|
||||
[&] (View_id id) {
|
||||
if (view_ptr)
|
||||
_child_views.insert(view_ptr);
|
||||
return handle;
|
||||
return id;
|
||||
},
|
||||
[&] (Create_view_error e) {
|
||||
switch (e) {
|
||||
@ -1061,9 +1059,9 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
[&] () -> Create_child_view_result { return Error::INVALID; });
|
||||
}
|
||||
|
||||
void destroy_view(View_handle handle) override
|
||||
void destroy_view(View_id id) override
|
||||
{
|
||||
_with_view(handle,
|
||||
_with_view(id,
|
||||
[&] (View &view) {
|
||||
for (Child_view *v = _child_views.first(); v; v = v->next())
|
||||
if (&view == v) {
|
||||
@ -1078,53 +1076,53 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
},
|
||||
[&] /* ID exists but view vanished */ { }
|
||||
);
|
||||
release_view_handle(handle);
|
||||
release_view_id(id);
|
||||
}
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view_cap) override
|
||||
Alloc_view_id_result alloc_view_id(View_capability view_cap) override
|
||||
{
|
||||
return _env.ep().rpc_ep().apply(view_cap,
|
||||
[&] (View *view_ptr) -> Alloc_view_handle_result {
|
||||
[&] (View *view_ptr) -> Alloc_view_id_result {
|
||||
if (!view_ptr)
|
||||
return Alloc_view_handle_error::INVALID;
|
||||
return Alloc_view_id_error::INVALID;
|
||||
try {
|
||||
View_ref &view_ref = *new (_view_ref_alloc)
|
||||
View_ref(view_ptr->weak_ptr(), _view_ids);
|
||||
return view_ref.id.id();
|
||||
}
|
||||
catch (Out_of_ram) { return Alloc_view_handle_error::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return Alloc_view_handle_error::OUT_OF_CAPS; }
|
||||
catch (Out_of_ram) { return Alloc_view_id_error::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return Alloc_view_id_error::OUT_OF_CAPS; }
|
||||
});
|
||||
}
|
||||
|
||||
View_handle_result view_handle(View_capability view_cap, View_handle handle) override
|
||||
View_id_result view_id(View_capability view_cap, View_id id) override
|
||||
{
|
||||
/* prevent ID conflict in 'View_ids::Element' constructor */
|
||||
release_view_handle(handle);
|
||||
release_view_id(id);
|
||||
|
||||
return _env.ep().rpc_ep().apply(view_cap,
|
||||
[&] (View *view_ptr) -> View_handle_result {
|
||||
[&] (View *view_ptr) -> View_id_result {
|
||||
if (!view_ptr)
|
||||
return View_handle_result::INVALID;
|
||||
return View_id_result::INVALID;
|
||||
try {
|
||||
new (_view_ref_alloc) View_ref(view_ptr->weak_ptr(), _view_ids, handle);
|
||||
return View_handle_result::OK;
|
||||
new (_view_ref_alloc) View_ref(view_ptr->weak_ptr(), _view_ids, id);
|
||||
return View_id_result::OK;
|
||||
}
|
||||
catch (Out_of_ram) { return View_handle_result::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return View_handle_result::OUT_OF_CAPS; }
|
||||
catch (Out_of_ram) { return View_id_result::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return View_id_result::OUT_OF_CAPS; }
|
||||
});
|
||||
}
|
||||
|
||||
View_capability view_capability(View_handle handle) override
|
||||
View_capability view_capability(View_id id) override
|
||||
{
|
||||
return _with_view(handle,
|
||||
return _with_view(id,
|
||||
[&] (View &view) { return view.cap(); },
|
||||
[&] /* view does not exist */ { return View_capability(); });
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle handle) override
|
||||
void release_view_id(View_id id) override
|
||||
{
|
||||
_view_ids.apply<View_ref>(handle,
|
||||
_view_ids.apply<View_ref>(id,
|
||||
[&] (View_ref &view_ref) { destroy(_view_ref_alloc, &view_ref); },
|
||||
[&] { });
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace Wm {
|
||||
struct Wm::Layouter_gui_session : Genode::Rpc_object<Gui::Session>
|
||||
{
|
||||
using View_capability = Gui::View_capability;
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using View_id = Gui::View_id;
|
||||
|
||||
Input::Session_capability _input_session_cap;
|
||||
|
||||
@ -62,28 +62,28 @@ struct Wm::Layouter_gui_session : Genode::Rpc_object<Gui::Session>
|
||||
return _input_session_cap;
|
||||
}
|
||||
|
||||
Create_view_result create_view() override { return View_handle(); }
|
||||
Create_view_result create_view() override { return View_id(); }
|
||||
|
||||
Create_child_view_result create_child_view(View_handle) override { return View_handle(); }
|
||||
Create_child_view_result create_child_view(View_id) override { return View_id(); }
|
||||
|
||||
void destroy_view(View_handle) override { }
|
||||
void destroy_view(View_id) override { }
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability) override
|
||||
Alloc_view_id_result alloc_view_id(View_capability) override
|
||||
{
|
||||
return View_handle();
|
||||
return View_id();
|
||||
}
|
||||
|
||||
View_handle_result view_handle(View_capability, View_handle) override
|
||||
View_id_result view_id(View_capability, View_id) override
|
||||
{
|
||||
return View_handle_result::OK;
|
||||
return View_id_result::OK;
|
||||
}
|
||||
|
||||
View_capability view_capability(View_handle) override
|
||||
View_capability view_capability(View_id) override
|
||||
{
|
||||
return View_capability();
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle) override { }
|
||||
void release_view_id(View_id) override { }
|
||||
|
||||
Genode::Dataspace_capability command_dataspace() override
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ class QGenodeViewWidget : public QEmbeddedViewWidget
|
||||
protected:
|
||||
|
||||
Gui::Connection *gui;
|
||||
Gui::Session::View_handle view_handle;
|
||||
Gui::View_id view_id;
|
||||
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void hideEvent(QHideEvent *event);
|
||||
@ -78,8 +78,7 @@ public:
|
||||
|
||||
QGenodeViewWidget(QWidget *parent =0);
|
||||
~QGenodeViewWidget();
|
||||
void setGenodeView(Gui::Connection *gui,
|
||||
Gui::Session::View_handle view_handle,
|
||||
void setGenodeView(Gui::Connection *gui, Gui::View_id view_id,
|
||||
int buf_x, int buf_y, int w, int h);
|
||||
};
|
||||
|
||||
|
@ -107,7 +107,7 @@ class Pdf_view
|
||||
Genode::Signal_handler<Pdf_view> _input_handler {
|
||||
_env.ep(), *this, &Pdf_view::_handle_input_events };
|
||||
|
||||
Gui::Session::View_handle _view = _gui.create_view();
|
||||
Gui::View_id _view = _gui.create_view();
|
||||
|
||||
pixel_t *_fb_base() { return _fb_ds->local_addr<pixel_t>(); }
|
||||
|
||||
|
@ -48,7 +48,7 @@ class Viewer
|
||||
|
||||
Genode::Env &_env;
|
||||
Gui::Connection _gui { _env, "webcam" };
|
||||
Gui::Session::View_handle _view { _gui.create_view() };
|
||||
Gui::View_id _view { _gui.create_view() };
|
||||
Framebuffer::Mode const _mode;
|
||||
|
||||
Constructible<Genode::Attached_dataspace> _fb_ds { };
|
||||
|
@ -138,13 +138,13 @@ QGenodeViewWidget::QGenodeViewWidget(QWidget *parent)
|
||||
|
||||
|
||||
void QGenodeViewWidget::setGenodeView(Gui::Connection *new_gui,
|
||||
Gui::Session::View_handle new_view_handle,
|
||||
Gui::View_id new_view_id,
|
||||
int buf_x, int buf_y, int w, int h)
|
||||
{
|
||||
QEmbeddedViewWidget::_orig_geometry(w, h, buf_x, buf_y);
|
||||
|
||||
gui = new_gui;
|
||||
view_handle = new_view_handle;
|
||||
view_id = new_view_id;
|
||||
setFixedSize(w, h);
|
||||
}
|
||||
|
||||
@ -172,10 +172,10 @@ void QGenodeViewWidget::hideEvent(QHideEvent *event)
|
||||
Gui::Rect const geometry(Gui::Point(mapToGlobal(pos()).x(),
|
||||
mapToGlobal(pos()).y()),
|
||||
Gui::Area(0, 0));
|
||||
gui->enqueue<Command::Geometry>(view_handle, geometry);
|
||||
gui->enqueue<Command::Geometry>(view_id, geometry);
|
||||
|
||||
Gui::Point const offset(view_geometry.buf_x, view_geometry.buf_y);
|
||||
gui->enqueue<Command::Offset>(view_handle, offset);
|
||||
gui->enqueue<Command::Offset>(view_id, offset);
|
||||
|
||||
gui->execute();
|
||||
}
|
||||
@ -201,9 +201,9 @@ void QGenodeViewWidget::paintEvent(QPaintEvent *event)
|
||||
|
||||
Gui::Rect const geometry(Gui::Point(view_geometry.x, view_geometry.y),
|
||||
Gui::Area(view_geometry.w, view_geometry.h));
|
||||
gui->enqueue<Command::Geometry>(view_handle, geometry);
|
||||
gui->enqueue<Command::Geometry>(view_id, geometry);
|
||||
Gui::Point const offset(view_geometry.buf_x, view_geometry.buf_y);
|
||||
gui->enqueue<Command::Offset>(view_handle, offset);
|
||||
gui->enqueue<Command::Offset>(view_id, offset);
|
||||
} else {
|
||||
|
||||
Gui::Rect const
|
||||
@ -211,23 +211,23 @@ void QGenodeViewWidget::paintEvent(QPaintEvent *event)
|
||||
mapToGlobal(mask().boundingRect().topLeft()).y()),
|
||||
Gui::Area(mask().boundingRect().width(),
|
||||
mask().boundingRect().height()));
|
||||
gui->enqueue<Command::Geometry>(view_handle, geometry);
|
||||
gui->enqueue<Command::Geometry>(view_id, geometry);
|
||||
|
||||
Gui::Point const offset(view_geometry.buf_x, view_geometry.buf_y);
|
||||
gui->enqueue<Command::Offset>(view_handle, offset);
|
||||
gui->enqueue<Command::Offset>(view_id, offset);
|
||||
}
|
||||
|
||||
/* bring the plugin view to the front of the Qt window */
|
||||
QGenodePlatformWindow *platform_window =
|
||||
dynamic_cast<QGenodePlatformWindow*>(window()->windowHandle()->handle());
|
||||
|
||||
Gui::Session::View_handle const neighbor_handle =
|
||||
gui->alloc_view_handle(platform_window->view_cap());
|
||||
Gui::View_id const neighbor_id =
|
||||
gui->alloc_view_id(platform_window->view_cap());
|
||||
|
||||
gui->enqueue<Command::Front_of>(view_handle, neighbor_handle);
|
||||
gui->enqueue<Command::Front_of>(view_id, neighbor_id);
|
||||
gui->execute();
|
||||
|
||||
gui->release_view_handle(neighbor_handle);
|
||||
gui->release_view_id(neighbor_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,14 +42,13 @@ Genode::Env *genode_env;
|
||||
|
||||
struct Window : Genode_egl_window
|
||||
{
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
Genode::Env &env;
|
||||
Framebuffer::Mode mode;
|
||||
Gui::Connection gui { env };
|
||||
Genode::Constructible<Genode::Attached_dataspace> ds { };
|
||||
View_handle view { };
|
||||
Gui::View_id view { };
|
||||
|
||||
Genode::addr_t fb_addr { 0 };
|
||||
Genode::addr_t fb_size { 0 };
|
||||
|
@ -39,8 +39,6 @@ class Decorator::Window_base : private Genode::List_model<Window_base>::Element
|
||||
{
|
||||
public:
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
struct Border
|
||||
{
|
||||
unsigned top, left, right, bottom;
|
||||
@ -110,7 +108,7 @@ class Decorator::Window_base : private Genode::List_model<Window_base>::Element
|
||||
/*
|
||||
* View immediately behind the window
|
||||
*/
|
||||
Genode::Constructible<View_handle> _neighbor { };
|
||||
Genode::Constructible<Gui::View_id> _neighbor { };
|
||||
|
||||
Genode::List_element<Window_base> _abandoned { this };
|
||||
|
||||
@ -137,7 +135,7 @@ class Decorator::Window_base : private Genode::List_model<Window_base>::Element
|
||||
unsigned id() const { return _id; }
|
||||
Rect geometry() const { return _geometry; }
|
||||
|
||||
void stacking_neighbor(View_handle neighbor)
|
||||
void stacking_neighbor(Gui::View_id neighbor)
|
||||
{
|
||||
_neighbor.construct(neighbor);
|
||||
_stacked = true;
|
||||
@ -159,13 +157,13 @@ class Decorator::Window_base : private Genode::List_model<Window_base>::Element
|
||||
|
||||
virtual Rect outer_geometry() const = 0;
|
||||
|
||||
virtual void stack(View_handle neighbor) = 0;
|
||||
virtual void stack(Gui::View_id neighbor) = 0;
|
||||
|
||||
virtual void stack_front_most() = 0;
|
||||
|
||||
virtual void stack_back_most() = 0;
|
||||
|
||||
virtual View_handle frontmost_view() const = 0;
|
||||
virtual Gui::View_id frontmost_view() const = 0;
|
||||
|
||||
/**
|
||||
* Draw window elements
|
||||
|
@ -257,7 +257,7 @@ void Decorator::Window_stack::update_model(Genode::Xml_node root_node,
|
||||
reversed.remove(back_most);
|
||||
Window_base &window = *back_most->object();
|
||||
stack_back_most_window(window);
|
||||
window.stacking_neighbor(Window_base::View_handle());
|
||||
window.stacking_neighbor(Gui::View_id());
|
||||
|
||||
Window_base *neighbor = &window;
|
||||
|
||||
|
@ -33,27 +33,23 @@ struct Gui::Session_client : Rpc_client<Session>
|
||||
Create_view_result create_view() override {
|
||||
return call<Rpc_create_view>(); }
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent) override {
|
||||
Create_child_view_result create_child_view(View_id parent) override {
|
||||
return call<Rpc_create_child_view>(parent); }
|
||||
|
||||
void destroy_view(View_handle view) override {
|
||||
void destroy_view(View_id view) override {
|
||||
call<Rpc_destroy_view>(view); }
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view) override
|
||||
{
|
||||
return call<Rpc_alloc_view_handle>(view);
|
||||
}
|
||||
Alloc_view_id_result alloc_view_id(View_capability view) override {
|
||||
return call<Rpc_alloc_view_id>(view); }
|
||||
|
||||
View_handle_result view_handle(View_capability view, View_handle handle) override
|
||||
{
|
||||
return call<Rpc_view_handle>(view, handle);
|
||||
}
|
||||
View_id_result view_id(View_capability view, View_id id) override {
|
||||
return call<Rpc_view_id>(view, id); }
|
||||
|
||||
View_capability view_capability(View_handle handle) override {
|
||||
return call<Rpc_view_capability>(handle); }
|
||||
View_capability view_capability(View_id id) override {
|
||||
return call<Rpc_view_capability>(id); }
|
||||
|
||||
void release_view_handle(View_handle handle) override {
|
||||
call<Rpc_release_view_handle>(handle); }
|
||||
void release_view_id(View_id id) override {
|
||||
call<Rpc_release_view_id>(id); }
|
||||
|
||||
Dataspace_capability command_dataspace() override {
|
||||
return call<Rpc_command_dataspace>(); }
|
||||
|
@ -64,13 +64,13 @@ class Gui::Connection : private Genode::Connection<Session>
|
||||
_env(env)
|
||||
{ }
|
||||
|
||||
View_handle create_view()
|
||||
View_id create_view()
|
||||
{
|
||||
View_handle result { };
|
||||
View_id result { };
|
||||
for (bool retry = false; ; ) {
|
||||
using Error = Session_client::Create_view_error;
|
||||
_client.create_view().with_result(
|
||||
[&] (View_handle handle) { result = handle; },
|
||||
[&] (View_id id) { result = id; },
|
||||
[&] (Error e) {
|
||||
switch (e) {
|
||||
case Error::OUT_OF_RAM: upgrade_ram(8*1024); retry = true; return;
|
||||
@ -83,13 +83,13 @@ class Gui::Connection : private Genode::Connection<Session>
|
||||
return result;
|
||||
}
|
||||
|
||||
View_handle create_child_view(View_handle parent)
|
||||
View_id create_child_view(View_id parent)
|
||||
{
|
||||
View_handle result { };
|
||||
View_id result { };
|
||||
for (bool retry = false; ; ) {
|
||||
using Error = Session_client::Create_child_view_error;
|
||||
_client.create_child_view(parent).with_result(
|
||||
[&] (View_handle handle) { result = handle; },
|
||||
[&] (View_id id) { result = id; },
|
||||
[&] (Error e) {
|
||||
switch (e) {
|
||||
case Error::OUT_OF_RAM: upgrade_ram(8*1024); retry = true; return;
|
||||
@ -104,35 +104,35 @@ class Gui::Connection : private Genode::Connection<Session>
|
||||
return result;
|
||||
}
|
||||
|
||||
void destroy_view(View_handle view)
|
||||
void destroy_view(View_id view)
|
||||
{
|
||||
_client.destroy_view(view);
|
||||
}
|
||||
|
||||
void release_view_handle(View_handle handle)
|
||||
void release_view_id(View_id id)
|
||||
{
|
||||
_client.release_view_handle(handle);
|
||||
_client.release_view_id(id);
|
||||
}
|
||||
|
||||
View_capability view_capability(View_handle handle)
|
||||
View_capability view_capability(View_id id)
|
||||
{
|
||||
return _client.view_capability(handle);
|
||||
return _client.view_capability(id);
|
||||
}
|
||||
|
||||
View_handle alloc_view_handle(View_capability view)
|
||||
View_id alloc_view_id(View_capability view)
|
||||
{
|
||||
View_handle result { };
|
||||
View_id result { };
|
||||
for (bool retry = false; ; ) {
|
||||
using Error = Session_client::Alloc_view_handle_error;
|
||||
_client.alloc_view_handle(view).with_result(
|
||||
[&] (View_handle handle) { result = handle; },
|
||||
using Error = Session_client::Alloc_view_id_error;
|
||||
_client.alloc_view_id(view).with_result(
|
||||
[&] (View_id id) { result = id; },
|
||||
[&] (Error e) {
|
||||
switch (e) {
|
||||
case Error::OUT_OF_RAM: upgrade_ram(8*1024); retry = true; return;
|
||||
case Error::OUT_OF_CAPS: upgrade_caps(2); retry = true; return;
|
||||
case Error::INVALID: break;
|
||||
}
|
||||
warning("attempt to alloc handle for invalid view");
|
||||
warning("attempt to alloc ID for invalid view");
|
||||
});
|
||||
if (!retry)
|
||||
break;
|
||||
@ -140,16 +140,16 @@ class Gui::Connection : private Genode::Connection<Session>
|
||||
return result;
|
||||
}
|
||||
|
||||
void view_handle(View_capability view, View_handle handle)
|
||||
void view_id(View_capability view, View_id id)
|
||||
{
|
||||
using Result = Session::View_handle_result;
|
||||
using Result = Session::View_id_result;
|
||||
for (;;) {
|
||||
switch (_client.view_handle(view, handle)) {
|
||||
switch (_client.view_id(view, id)) {
|
||||
case Result::OUT_OF_RAM: upgrade_ram(8*1024); break;
|
||||
case Result::OUT_OF_CAPS: upgrade_caps(2); break;
|
||||
case Result::OK: return;
|
||||
case Result::INVALID:
|
||||
warning("attempt to create handle for invalid view");
|
||||
warning("attempt to create ID for invalid view");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Gui {
|
||||
struct View_ref : Interface { };
|
||||
|
||||
using View_capability = Capability<View>;
|
||||
using View_handle = Id_space<View_ref>::Id;
|
||||
using View_id = Id_space<View_ref>::Id;
|
||||
|
||||
using Rect = Surface_base::Rect;
|
||||
using Point = Surface_base::Point;
|
||||
@ -61,8 +61,6 @@ struct Gui::Session : Genode::Session
|
||||
static constexpr unsigned CAP_QUOTA = Framebuffer::Session::CAP_QUOTA
|
||||
+ Input::Session::CAP_QUOTA + 3;
|
||||
|
||||
using View_handle = Gui::View_handle;
|
||||
|
||||
struct Command
|
||||
{
|
||||
enum Opcode { GEOMETRY, OFFSET, FRONT, BACK, FRONT_OF, BEHIND_OF,
|
||||
@ -77,15 +75,15 @@ struct Gui::Session : Genode::Session
|
||||
struct View_op
|
||||
{
|
||||
static constexpr Opcode opcode = OPCODE;
|
||||
View_handle view;
|
||||
View_id view;
|
||||
};
|
||||
|
||||
struct Geometry : View_op<GEOMETRY> { Rect rect; };
|
||||
struct Offset : View_op<OFFSET> { Point offset; };
|
||||
struct Front : View_op<FRONT> { };
|
||||
struct Back : View_op<BACK> { };
|
||||
struct Front_of : View_op<FRONT_OF> { View_handle neighbor; };
|
||||
struct Behind_of : View_op<BEHIND_OF> { View_handle neighbor; };
|
||||
struct Front_of : View_op<FRONT_OF> { View_id neighbor; };
|
||||
struct Behind_of : View_op<BEHIND_OF> { View_id neighbor; };
|
||||
struct Background : View_op<BACKGROUND> { };
|
||||
struct Title : View_op<TITLE> { String<64> title; };
|
||||
|
||||
@ -159,11 +157,6 @@ struct Gui::Session : Genode::Session
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Exception types
|
||||
*/
|
||||
struct Invalid_handle : Exception { };
|
||||
|
||||
virtual ~Session() { }
|
||||
|
||||
/**
|
||||
@ -177,7 +170,7 @@ struct Gui::Session : Genode::Session
|
||||
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>;
|
||||
using Create_view_result = Attempt<View_id, Create_view_error>;
|
||||
|
||||
/**
|
||||
* Create a new top-level view at the buffer
|
||||
@ -185,54 +178,51 @@ struct Gui::Session : Genode::Session
|
||||
virtual Create_view_result create_view() = 0;
|
||||
|
||||
enum class Create_child_view_error { OUT_OF_RAM, OUT_OF_CAPS, INVALID };
|
||||
using Create_child_view_result = Attempt<View_handle, Create_child_view_error>;
|
||||
using Create_child_view_result = Attempt<View_id, Create_child_view_error>;
|
||||
|
||||
/**
|
||||
* Create a new child view at the buffer
|
||||
*
|
||||
* \param parent parent view
|
||||
* \return handle for new view
|
||||
*
|
||||
* The 'parent' argument allows the client to use the location of an
|
||||
* existing view as the coordinate origin for the to-be-created view.
|
||||
*/
|
||||
virtual Create_child_view_result create_child_view(View_handle parent) = 0;
|
||||
virtual Create_child_view_result create_child_view(View_id parent) = 0;
|
||||
|
||||
/**
|
||||
* Destroy view
|
||||
*/
|
||||
virtual void destroy_view(View_handle) = 0;
|
||||
virtual void destroy_view(View_id) = 0;
|
||||
|
||||
enum class Alloc_view_handle_error { OUT_OF_RAM, OUT_OF_CAPS, INVALID };
|
||||
using Alloc_view_handle_result = Attempt<View_handle, Alloc_view_handle_error>;
|
||||
enum class Alloc_view_id_error { OUT_OF_RAM, OUT_OF_CAPS, INVALID };
|
||||
using Alloc_view_id_result = Attempt<View_id, Alloc_view_id_error>;
|
||||
|
||||
/**
|
||||
* Return session-local handle for the specified view
|
||||
* Return session-local ID for the specified view
|
||||
*
|
||||
* The handle returned by this method can be used to issue commands
|
||||
* via the 'execute' method.
|
||||
* The ID returned by this method can be used to issue commands via the
|
||||
* 'execute' method.
|
||||
*/
|
||||
virtual Alloc_view_handle_result alloc_view_handle(View_capability) = 0;
|
||||
virtual Alloc_view_id_result alloc_view_id(View_capability) = 0;
|
||||
|
||||
enum class View_handle_result { OK, OUT_OF_RAM, OUT_OF_CAPS, INVALID };
|
||||
enum class View_id_result { OK, OUT_OF_RAM, OUT_OF_CAPS, INVALID };
|
||||
|
||||
/**
|
||||
* Associate view with the specified handle
|
||||
* Associate view with the specified ID
|
||||
*/
|
||||
virtual View_handle_result view_handle(View_capability, View_handle) = 0;
|
||||
virtual View_id_result view_id(View_capability, View_id) = 0;
|
||||
|
||||
/**
|
||||
* Request view capability for a given handle
|
||||
* Request view capability for a given ID
|
||||
*
|
||||
* The returned view capability can be used to share the view with another
|
||||
* session.
|
||||
*/
|
||||
virtual View_capability view_capability(View_handle) = 0;
|
||||
virtual View_capability view_capability(View_id) = 0;
|
||||
|
||||
/**
|
||||
* Release session-local view handle
|
||||
* Release session-local view ID
|
||||
*/
|
||||
virtual void release_view_handle(View_handle) = 0;
|
||||
virtual void release_view_id(View_id) = 0;
|
||||
|
||||
/**
|
||||
* Request dataspace used for issuing view commands to nitpicker
|
||||
@ -296,12 +286,12 @@ struct Gui::Session : Genode::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);
|
||||
GENODE_RPC(Rpc_alloc_view_handle, Alloc_view_handle_result, alloc_view_handle, View_capability);
|
||||
GENODE_RPC(Rpc_view_handle, View_handle_result, view_handle, View_capability, View_handle);
|
||||
GENODE_RPC(Rpc_view_capability, View_capability, view_capability, View_handle);
|
||||
GENODE_RPC(Rpc_release_view_handle, void, release_view_handle, View_handle);
|
||||
GENODE_RPC(Rpc_create_child_view, Create_child_view_result, create_child_view, View_id);
|
||||
GENODE_RPC(Rpc_destroy_view, void, destroy_view, View_id);
|
||||
GENODE_RPC(Rpc_alloc_view_id, Alloc_view_id_result, alloc_view_id, View_capability);
|
||||
GENODE_RPC(Rpc_view_id, View_id_result, view_id, View_capability, View_id);
|
||||
GENODE_RPC(Rpc_view_capability, View_capability, view_capability, View_id);
|
||||
GENODE_RPC(Rpc_release_view_id, void, release_view_id, View_id);
|
||||
GENODE_RPC(Rpc_command_dataspace, Dataspace_capability, command_dataspace);
|
||||
GENODE_RPC(Rpc_execute, void, execute);
|
||||
GENODE_RPC(Rpc_background, int, background, View_capability);
|
||||
@ -312,8 +302,8 @@ struct Gui::Session : Genode::Session
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_framebuffer, Rpc_input,
|
||||
Rpc_create_view, Rpc_create_child_view, Rpc_destroy_view,
|
||||
Rpc_alloc_view_handle, Rpc_view_handle,
|
||||
Rpc_view_capability, Rpc_release_view_handle,
|
||||
Rpc_alloc_view_id, Rpc_view_id,
|
||||
Rpc_view_capability, Rpc_release_view_id,
|
||||
Rpc_command_dataspace, Rpc_execute, Rpc_mode,
|
||||
Rpc_mode_sigh, Rpc_buffer, Rpc_focus);
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ class Pointer::Main : public Rom::Reader
|
||||
|
||||
Gui::Connection _gui { _env };
|
||||
|
||||
Gui::Session::View_handle _view = _gui.create_view();
|
||||
Gui::View_id _view = _gui.create_view();
|
||||
|
||||
bool _default_pointer_visible = false;
|
||||
|
||||
|
@ -186,7 +186,7 @@ struct Status_bar::Main
|
||||
|
||||
Reconstructible<Buffer> _buffer { _env.rm(), _gui };
|
||||
|
||||
Gui::Session::View_handle const _view { _gui.create_view() };
|
||||
Gui::View_id const _view { _gui.create_view() };
|
||||
|
||||
void _draw_status_bar()
|
||||
{
|
||||
|
@ -242,9 +242,7 @@ struct Nit_fb::Main : View_updater
|
||||
|
||||
unsigned refresh_rate = 0;
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
View_handle view = gui.create_view();
|
||||
Gui::View_id view = gui.create_view();
|
||||
|
||||
Genode::Attached_dataspace input_ds { env.rm(), gui.input.dataspace() };
|
||||
|
||||
|
@ -230,7 +230,7 @@ Gui_session::Create_view_result Gui_session::create_view()
|
||||
}
|
||||
|
||||
|
||||
Gui_session::Create_child_view_result Gui_session::create_child_view(View_handle const parent)
|
||||
Gui_session::Create_child_view_result Gui_session::create_child_view(View_id const parent)
|
||||
{
|
||||
using Error = Create_child_view_error;
|
||||
|
||||
@ -248,10 +248,10 @@ Gui_session::Create_child_view_result Gui_session::create_child_view(View_handle
|
||||
});
|
||||
|
||||
return result.convert<Create_child_view_result>(
|
||||
[&] (View_handle handle) {
|
||||
[&] (View_id id) {
|
||||
if (view_ptr)
|
||||
parent.add_child(*view_ptr);
|
||||
return handle;
|
||||
return id;
|
||||
},
|
||||
[&] (Create_view_error e) {
|
||||
switch (e) {
|
||||
@ -296,12 +296,12 @@ void Gui_session::apply_session_policy(Xml_node config,
|
||||
}
|
||||
|
||||
|
||||
void Gui_session::destroy_view(View_handle const handle)
|
||||
void Gui_session::destroy_view(View_id const id)
|
||||
{
|
||||
/*
|
||||
* Search among the session's own views the one with the given handle
|
||||
* Search among the session's own views the one with the given ID
|
||||
*/
|
||||
_with_view(handle,
|
||||
_with_view(id,
|
||||
[&] (View &view) {
|
||||
for (Session_view_list_elem *v = _view_list.first(); v; v = v->next())
|
||||
if (&view == v) {
|
||||
@ -311,61 +311,61 @@ void Gui_session::destroy_view(View_handle const handle)
|
||||
},
|
||||
[&] /* ID exists but view vanished */ { }
|
||||
);
|
||||
release_view_handle(handle);
|
||||
release_view_id(id);
|
||||
|
||||
_hover_updater.update_hover();
|
||||
}
|
||||
|
||||
|
||||
Gui_session::Alloc_view_handle_result
|
||||
Gui_session::alloc_view_handle(View_capability view_cap)
|
||||
Gui_session::Alloc_view_id_result
|
||||
Gui_session::alloc_view_id(View_capability view_cap)
|
||||
{
|
||||
return _env.ep().rpc_ep().apply(view_cap,
|
||||
[&] (View *view_ptr) -> Alloc_view_handle_result {
|
||||
[&] (View *view_ptr) -> Alloc_view_id_result {
|
||||
if (!view_ptr)
|
||||
return Alloc_view_handle_error::INVALID;
|
||||
return Alloc_view_id_error::INVALID;
|
||||
try {
|
||||
View_ref &view_ref = *new (_view_ref_alloc)
|
||||
View_ref(view_ptr->weak_ptr(), _view_ids);
|
||||
return view_ref.id.id();
|
||||
}
|
||||
catch (Out_of_ram) { return Alloc_view_handle_error::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return Alloc_view_handle_error::OUT_OF_CAPS; }
|
||||
catch (Out_of_ram) { return Alloc_view_id_error::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return Alloc_view_id_error::OUT_OF_CAPS; }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Gui_session::View_handle_result
|
||||
Gui_session::view_handle(View_capability view_cap, View_handle handle)
|
||||
Gui_session::View_id_result
|
||||
Gui_session::view_id(View_capability view_cap, View_id id)
|
||||
{
|
||||
/* prevent ID conflict in 'View_ids::Element' constructor */
|
||||
release_view_handle(handle);
|
||||
release_view_id(id);
|
||||
|
||||
return _env.ep().rpc_ep().apply(view_cap,
|
||||
[&] (View *view_ptr) -> View_handle_result {
|
||||
[&] (View *view_ptr) -> View_id_result {
|
||||
if (!view_ptr)
|
||||
return View_handle_result::INVALID;
|
||||
return View_id_result::INVALID;
|
||||
try {
|
||||
new (_view_ref_alloc) View_ref(view_ptr->weak_ptr(), _view_ids, handle);
|
||||
return View_handle_result::OK;
|
||||
new (_view_ref_alloc) View_ref(view_ptr->weak_ptr(), _view_ids, id);
|
||||
return View_id_result::OK;
|
||||
}
|
||||
catch (Out_of_ram) { return View_handle_result::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return View_handle_result::OUT_OF_CAPS; }
|
||||
catch (Out_of_ram) { return View_id_result::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return View_id_result::OUT_OF_CAPS; }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
View_capability Gui_session::view_capability(View_handle handle)
|
||||
View_capability Gui_session::view_capability(View_id id)
|
||||
{
|
||||
return _with_view(handle,
|
||||
return _with_view(id,
|
||||
[&] (View &view) { return view.cap(); },
|
||||
[&] /* view does not exist */ { return View_capability(); });
|
||||
}
|
||||
|
||||
|
||||
void Gui_session::release_view_handle(View_handle handle)
|
||||
void Gui_session::release_view_id(View_id id)
|
||||
{
|
||||
_view_ids.apply<View_ref>(handle,
|
||||
_view_ids.apply<View_ref>(id,
|
||||
[&] (View_ref &view_ref) { destroy(_view_ref_alloc, &view_ref); },
|
||||
[&] { });
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
|
||||
View_ref(Weak_ptr<View> view, View_ids &ids)
|
||||
: _weak_ptr(view), id(*this, ids) { }
|
||||
|
||||
View_ref(Weak_ptr<View> view, View_ids &ids, View_handle id)
|
||||
View_ref(Weak_ptr<View> view, View_ids &ids, View_id id)
|
||||
: _weak_ptr(view), id(*this, ids, id) { }
|
||||
|
||||
auto with_view(auto const &fn, auto const &missing_fn) -> decltype(missing_fn())
|
||||
@ -172,15 +172,6 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
|
||||
return _domain ? _domain->phys_pos(pos, screen_area) : Point(0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for performing sanity checks in OP_TO_FRONT and OP_TO_BACK
|
||||
*
|
||||
* We have to check for the equality of both the specified view and
|
||||
* neighbor. If both arguments refer to the same view, the creation of
|
||||
* locked pointers for both views would result in a deadlock.
|
||||
*/
|
||||
bool _views_are_equal(View_handle, View_handle);
|
||||
|
||||
void _execute_command(Command const &);
|
||||
|
||||
void _destroy_view(View &);
|
||||
@ -189,10 +180,10 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
|
||||
|
||||
Create_view_result _create_view_with_id(auto const &);
|
||||
|
||||
auto _with_view(View_handle handle, auto const &fn, auto const &missing_fn)
|
||||
auto _with_view(View_id id, auto const &fn, auto const &missing_fn)
|
||||
-> decltype(missing_fn())
|
||||
{
|
||||
return _view_ids.apply<View_ref>(handle,
|
||||
return _view_ids.apply<View_ref>(id,
|
||||
[&] (View_ref &view_ref) {
|
||||
return view_ref.with_view(
|
||||
[&] (View &view) { return fn(view); },
|
||||
@ -397,17 +388,17 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
|
||||
|
||||
Create_view_result create_view() override;
|
||||
|
||||
Create_child_view_result create_child_view(View_handle parent_handle) override;
|
||||
Create_child_view_result create_child_view(View_id) override;
|
||||
|
||||
void destroy_view(View_handle handle) override;
|
||||
void destroy_view(View_id) override;
|
||||
|
||||
Alloc_view_handle_result alloc_view_handle(View_capability view_cap) override;
|
||||
Alloc_view_id_result alloc_view_id(View_capability) override;
|
||||
|
||||
View_handle_result view_handle(View_capability view_cap, View_handle handle) override;
|
||||
View_id_result view_id(View_capability, View_id) override;
|
||||
|
||||
View_capability view_capability(View_handle handle) override;
|
||||
View_capability view_capability(View_id) override;
|
||||
|
||||
void release_view_handle(View_handle handle) override;
|
||||
void release_view_id(View_id) override;
|
||||
|
||||
Dataspace_capability command_dataspace() override { return _command_ds.cap(); }
|
||||
|
||||
@ -417,9 +408,9 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
|
||||
|
||||
void mode_sigh(Signal_context_capability sigh) override { _mode_sigh = sigh; }
|
||||
|
||||
Buffer_result buffer(Framebuffer::Mode mode, bool use_alpha) override;
|
||||
Buffer_result buffer(Framebuffer::Mode, bool) override;
|
||||
|
||||
void focus(Capability<Gui::Session> session_cap) override;
|
||||
void focus(Capability<Gui::Session>) override;
|
||||
|
||||
|
||||
/*******************************
|
||||
|
@ -297,7 +297,7 @@ class Vmm::Virtio_gpu_device : public Virtio_device<Virtio_gpu_queue, 2>
|
||||
Cpu::Signal_handler<Virtio_gpu_device> _handler;
|
||||
Constructible<Attached_dataspace> _fb_ds { };
|
||||
Framebuffer::Mode _fb_mode { _gui.mode() };
|
||||
Gui::Session::View_handle _view = _gui.create_view();
|
||||
Gui::View_id _view = _gui.create_view();
|
||||
|
||||
using Area = Genode::Area<>;
|
||||
using Rect = Genode::Rect<>;
|
||||
|
@ -34,10 +34,8 @@ class Test::View
|
||||
{
|
||||
private:
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
Gui::Connection &_gui;
|
||||
View_handle const _handle = _gui.create_view();
|
||||
Gui::View_id const _id = _gui.create_view();
|
||||
Gui::Rect const _rect;
|
||||
|
||||
public:
|
||||
@ -46,8 +44,8 @@ class Test::View
|
||||
{
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
_gui.enqueue<Command::Geometry>(_handle, rect);
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Geometry>(_id, rect);
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
|
@ -48,11 +48,10 @@ class Test::View : private List<View>::Element, Interface
|
||||
friend class View_stack;
|
||||
friend class List<View>;
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
Gui::Connection &_gui;
|
||||
View_handle const _handle;
|
||||
Gui::View_id const _id;
|
||||
Attr const _attr;
|
||||
Gui::Point _pos = _attr.pos;
|
||||
|
||||
@ -60,31 +59,31 @@ class Test::View : private List<View>::Element, Interface
|
||||
|
||||
View(Gui::Connection &gui, Attr const attr, auto const &create_fn)
|
||||
:
|
||||
_gui(gui), _handle(create_fn()), _attr(attr)
|
||||
_gui(gui), _id(create_fn()), _attr(attr)
|
||||
{
|
||||
using namespace Gui;
|
||||
|
||||
_gui.enqueue<Command::Geometry>(_handle, Gui::Rect { _pos, _attr.size });
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Title>(_handle, _attr.title);
|
||||
_gui.enqueue<Command::Geometry>(_id, Gui::Rect { _pos, _attr.size });
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.enqueue<Command::Title>(_id, _attr.title);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
Gui::View_capability view_cap()
|
||||
{
|
||||
return _gui.view_capability(_handle);
|
||||
return _gui.view_capability(_id);
|
||||
}
|
||||
|
||||
void top()
|
||||
{
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
virtual void move(Gui::Point const pos)
|
||||
{
|
||||
_pos = pos;
|
||||
_gui.enqueue<Command::Geometry>(_handle, Gui::Rect { _pos, _attr.size });
|
||||
_gui.enqueue<Command::Geometry>(_id, Gui::Rect { _pos, _attr.size });
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
@ -113,11 +112,10 @@ struct Test::Child_view : View
|
||||
:
|
||||
View(gui, attr,
|
||||
[&] /* create_fn */ {
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
View_handle const parent_handle = gui.alloc_view_handle(parent.view_cap());
|
||||
View_handle const handle = gui.create_child_view(parent_handle);
|
||||
gui.release_view_handle(parent_handle);
|
||||
return handle;
|
||||
Gui::View_id const parent_id = gui.alloc_view_id(parent.view_cap());
|
||||
Gui::View_id const id = gui.create_child_view(parent_id);
|
||||
gui.release_view_id(parent_id);
|
||||
return id;
|
||||
}
|
||||
), _parent(parent)
|
||||
{ }
|
||||
|
@ -36,10 +36,8 @@ class Test::View
|
||||
{
|
||||
private:
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
Gui::Connection &_gui;
|
||||
View_handle const _handle = _gui.create_view();
|
||||
Gui::View_id const _id = _gui.create_view();
|
||||
Gui::Rect const _rect;
|
||||
|
||||
public:
|
||||
@ -48,8 +46,8 @@ class Test::View
|
||||
{
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
_gui.enqueue<Command::Geometry>(_handle, rect);
|
||||
_gui.enqueue<Command::Front>(_handle);
|
||||
_gui.enqueue<Command::Geometry>(_id, rect);
|
||||
_gui.enqueue<Command::Front>(_id);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "VirtualBoxBase.h"
|
||||
#include "DisplayWrap.h"
|
||||
|
||||
typedef Gui::Session::View_handle View_handle;
|
||||
|
||||
class Genodefb :
|
||||
VBOX_SCRIPTABLE_IMPL(IFramebuffer)
|
||||
{
|
||||
@ -35,7 +33,7 @@ class Genodefb :
|
||||
|
||||
Genode::Env &_env;
|
||||
Gui::Connection &_gui;
|
||||
View_handle _view;
|
||||
Gui::View_id _view;
|
||||
Fb_Genode::Mode _fb_mode { .area = { 1024, 768 } };
|
||||
|
||||
/*
|
||||
|
@ -25,8 +25,6 @@
|
||||
#include <VirtualBoxBase.h>
|
||||
#include <DisplayWrap.h>
|
||||
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
|
||||
class Genodefb :
|
||||
VBOX_SCRIPTABLE_IMPL(IFramebuffer)
|
||||
{
|
||||
@ -34,7 +32,7 @@ class Genodefb :
|
||||
|
||||
Genode::Env &_env;
|
||||
Gui::Connection &_gui;
|
||||
View_handle _view;
|
||||
Gui::View_id _view;
|
||||
Fb_Genode::Mode _fb_mode { .area = { 1024, 768 } };
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user