/* * \brief Client-side nitpicker session interface * \author Norman Feske * \date 2006-08-23 */ /* * Copyright (C) 2006-2013 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #ifndef _INCLUDE__NITPICKER_SESSION__CLIENT_H_ #define _INCLUDE__NITPICKER_SESSION__CLIENT_H_ #include #include #include namespace Nitpicker { struct Session_client; } class Nitpicker::Session_client : public Genode::Rpc_client { private: Genode::Attached_dataspace _command_ds; Command_buffer &_command_buffer; public: explicit Session_client(Session_capability session) : Rpc_client(session), _command_ds(command_dataspace()), _command_buffer(*_command_ds.local_addr()) { } Framebuffer::Session_capability framebuffer_session() override { return call(); } Input::Session_capability input_session() override { return call(); } View_handle create_view(View_handle parent = View_handle()) override { return call(parent); } void destroy_view(View_handle view) override { call(view); } View_handle view_handle(View_capability view, View_handle handle = View_handle()) override { return call(view, handle); } View_capability view_capability(View_handle handle) override { return call(handle); } void release_view_handle(View_handle handle) override { call(handle); } Genode::Dataspace_capability command_dataspace() override { return call(); } void execute() override { call(); _command_buffer.reset(); } Framebuffer::Mode mode() override { return call(); } void mode_sigh(Genode::Signal_context_capability sigh) override { call(sigh); } void buffer(Framebuffer::Mode mode, bool alpha) override { call(mode, alpha); } void focus(Nitpicker::Session_capability session) override { call(session); } void session_control(Label selector, Session_control operation) override { call(selector, operation); } /** * Enqueue command to command buffer * * The submitted command is not executed immediately. To execute a * batch of enqueued commands, the 'execute' function must be called. * Only in the corner case when there is not space left in the command * buffer, the 'execute' is called to make room in the buffer. */ template void enqueue(ARGS... args) { enqueue(Command( CMD { args... } )); } void enqueue(Command const &command) { if (_command_buffer.is_full()) execute(); _command_buffer.enqueue(command); } }; #endif /* _INCLUDE__NITPICKER_SESSION__CLIENT_H_ */