mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-22 16:59:03 +00:00
nitpicker: strictly type command processing
This commit is contained in:
@ -529,49 +529,52 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
|||||||
|
|
||||||
case Command::OP_GEOMETRY:
|
case Command::OP_GEOMETRY:
|
||||||
{
|
{
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.geometry.view));
|
Command::Geometry const &cmd = command.geometry;
|
||||||
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
if (!view.valid())
|
if (!view.valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Point pos = command.geometry.rect.p1();
|
Point pos = cmd.rect.p1();
|
||||||
|
|
||||||
/* transpose position of top-level views by vertical session offset */
|
/* transpose position of top-level views by vertical session offset */
|
||||||
if (view->top_level())
|
if (view->top_level())
|
||||||
pos = ::Session::phys_pos(pos, _view_stack.size());
|
pos = ::Session::phys_pos(pos, _view_stack.size());
|
||||||
|
|
||||||
if (view.valid())
|
if (view.valid())
|
||||||
_view_stack.geometry(*view, Rect(pos, command.geometry.rect.area()));
|
_view_stack.geometry(*view, Rect(pos, cmd.rect.area()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Command::OP_OFFSET:
|
case Command::OP_OFFSET:
|
||||||
{
|
{
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.geometry.view));
|
Command::Offset const &cmd = command.offset;
|
||||||
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
|
|
||||||
if (view.valid())
|
if (view.valid())
|
||||||
_view_stack.buffer_offset(*view, command.offset.offset);
|
_view_stack.buffer_offset(*view, cmd.offset);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Command::OP_TO_FRONT:
|
case Command::OP_TO_FRONT:
|
||||||
{
|
{
|
||||||
if (_views_are_equal(command.to_front.view, command.to_front.neighbor))
|
Command::To_front const &cmd = command.to_front;
|
||||||
|
if (_views_are_equal(cmd.view, cmd.neighbor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_front.view));
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
if (!view.valid())
|
if (!view.valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* bring to front if no neighbor is specified */
|
/* bring to front if no neighbor is specified */
|
||||||
if (!command.to_front.neighbor.valid()) {
|
if (!cmd.neighbor.valid()) {
|
||||||
_view_stack.stack(*view, nullptr, true);
|
_view_stack.stack(*view, nullptr, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stack view relative to neighbor */
|
/* stack view relative to neighbor */
|
||||||
Locked_ptr<View> neighbor(_view_handle_registry.lookup(command.to_front.neighbor));
|
Locked_ptr<View> neighbor(_view_handle_registry.lookup(cmd.neighbor));
|
||||||
if (neighbor.valid())
|
if (neighbor.valid())
|
||||||
_view_stack.stack(*view, &(*neighbor), false);
|
_view_stack.stack(*view, &(*neighbor), false);
|
||||||
|
|
||||||
@ -580,21 +583,22 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
|||||||
|
|
||||||
case Command::OP_TO_BACK:
|
case Command::OP_TO_BACK:
|
||||||
{
|
{
|
||||||
if (_views_are_equal(command.to_front.view, command.to_front.neighbor))
|
Command::To_back const &cmd = command.to_back;
|
||||||
|
if (_views_are_equal(cmd.view, cmd.neighbor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_back.view));
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
if (!view.valid())
|
if (!view.valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* bring to front if no neighbor is specified */
|
/* bring to front if no neighbor is specified */
|
||||||
if (!command.to_front.neighbor.valid()) {
|
if (!cmd.neighbor.valid()) {
|
||||||
_view_stack.stack(*view, nullptr, false);
|
_view_stack.stack(*view, nullptr, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stack view relative to neighbor */
|
/* stack view relative to neighbor */
|
||||||
Locked_ptr<View> neighbor(_view_handle_registry.lookup(command.to_back.neighbor));
|
Locked_ptr<View> neighbor(_view_handle_registry.lookup(cmd.neighbor));
|
||||||
if (neighbor.valid())
|
if (neighbor.valid())
|
||||||
_view_stack.stack(*view, &(*neighbor), true);
|
_view_stack.stack(*view, &(*neighbor), true);
|
||||||
|
|
||||||
@ -603,8 +607,9 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
|||||||
|
|
||||||
case Command::OP_BACKGROUND:
|
case Command::OP_BACKGROUND:
|
||||||
{
|
{
|
||||||
|
Command::Background const &cmd = command.background;
|
||||||
if (_provides_default_bg) {
|
if (_provides_default_bg) {
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_front.view));
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
if (!view.valid())
|
if (!view.valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -618,7 +623,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
|||||||
::Session::background()->background(false);
|
::Session::background()->background(false);
|
||||||
|
|
||||||
/* assign session background */
|
/* assign session background */
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_front.view));
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
if (!view.valid())
|
if (!view.valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -633,10 +638,11 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
|||||||
|
|
||||||
case Command::OP_TITLE:
|
case Command::OP_TITLE:
|
||||||
{
|
{
|
||||||
Locked_ptr<View> view(_view_handle_registry.lookup(command.title.view));
|
Command::Title const &cmd = command.title;
|
||||||
|
Locked_ptr<View> view(_view_handle_registry.lookup(cmd.view));
|
||||||
|
|
||||||
if (view.valid())
|
if (view.valid())
|
||||||
_view_stack.title(*view, command.title.title.string());
|
_view_stack.title(*view, cmd.title.string());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user