mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 23:28:29 +00:00
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* \brief Nitpicker-based virtual framebuffer
|
||||
* \brief Virtual framebuffer
|
||||
* \author Norman Feske
|
||||
* \date 2006-09-21
|
||||
*/
|
||||
@ -17,7 +17,7 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <input/component.h>
|
||||
#include <scout/user_state.h>
|
||||
#include <scout/nitpicker_graphics_backend.h>
|
||||
#include <scout/graphics_backend_impl.h>
|
||||
|
||||
#include "framebuffer_window.h"
|
||||
#include "services.h"
|
||||
@ -148,9 +148,9 @@ class Liquid_fb::Main : public Scout::Event_handler
|
||||
/* heuristic for allocating the double-buffer backing store */
|
||||
enum { WINBORDER_WIDTH = 10, WINBORDER_HEIGHT = 40 };
|
||||
|
||||
Nitpicker::Connection _nitpicker { _env };
|
||||
Gui::Connection _gui { _env };
|
||||
|
||||
Platform _platform { _env, *_nitpicker.input() };
|
||||
Platform _platform { _env, *_gui.input() };
|
||||
|
||||
bool const _event_handler_registered = (_platform.event_handler(*this), true);
|
||||
|
||||
@ -159,8 +159,8 @@ class Liquid_fb::Main : public Scout::Event_handler
|
||||
Scout::Point const _initial_position { (int)config_fb_x, (int)config_fb_y };
|
||||
Scout::Area const _initial_size = _max_size;
|
||||
|
||||
Nitpicker_graphics_backend
|
||||
_graphics_backend { _env.rm(), _nitpicker, _heap, _max_size,
|
||||
Graphics_backend_impl
|
||||
_graphics_backend { _env.rm(), _gui, _heap, _max_size,
|
||||
_initial_position, _initial_size };
|
||||
|
||||
Input::Session_component _input_session_component { _env, _env.ram() };
|
||||
|
@ -351,22 +351,22 @@ class Log_view
|
||||
{
|
||||
private:
|
||||
|
||||
Nitpicker::Session_client &_nitpicker;
|
||||
Nitpicker::Point _pos;
|
||||
Nitpicker::Area _size;
|
||||
Nitpicker::Session::View_handle _handle;
|
||||
Gui::Session_client &_gui;
|
||||
Gui::Point _pos;
|
||||
Gui::Area _size;
|
||||
Gui::Session::View_handle _handle;
|
||||
|
||||
typedef Nitpicker::Session::Command Command;
|
||||
typedef Nitpicker::Session::View_handle View_handle;
|
||||
typedef Gui::Session::Command Command;
|
||||
typedef Gui::Session::View_handle View_handle;
|
||||
|
||||
public:
|
||||
|
||||
Log_view(Nitpicker::Session_client &nitpicker, Nitpicker::Rect geometry)
|
||||
Log_view(Gui::Session_client &gui, Gui::Rect geometry)
|
||||
:
|
||||
_nitpicker(nitpicker),
|
||||
_gui(gui),
|
||||
_pos(geometry.p1()),
|
||||
_size(geometry.area()),
|
||||
_handle(nitpicker.create_view())
|
||||
_handle(gui.create_view())
|
||||
{
|
||||
move(_pos);
|
||||
top();
|
||||
@ -374,20 +374,20 @@ class Log_view
|
||||
|
||||
void top()
|
||||
{
|
||||
_nitpicker.enqueue<Command::To_front>(_handle, View_handle());
|
||||
_nitpicker.execute();
|
||||
_gui.enqueue<Command::To_front>(_handle, View_handle());
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
void move(Nitpicker::Point pos)
|
||||
void move(Gui::Point pos)
|
||||
{
|
||||
_pos = pos;
|
||||
|
||||
Nitpicker::Rect rect(_pos, _size);
|
||||
_nitpicker.enqueue<Command::Geometry>(_handle, rect);
|
||||
_nitpicker.execute();
|
||||
Gui::Rect rect(_pos, _size);
|
||||
_gui.enqueue<Command::Geometry>(_handle, rect);
|
||||
_gui.execute();
|
||||
}
|
||||
|
||||
Nitpicker::Point pos() const { return _pos; }
|
||||
Gui::Point pos() const { return _pos; }
|
||||
};
|
||||
|
||||
|
||||
@ -404,21 +404,21 @@ struct Nitlog::Main
|
||||
unsigned const _win_h = _font.bounding_box().h() * LOG_H + 2;
|
||||
|
||||
/* init sessions to the required external services */
|
||||
Nitpicker::Connection _nitpicker { _env };
|
||||
Timer::Connection _timer { _env };
|
||||
Gui::Connection _gui { _env };
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
void _init_nitpicker_buffer()
|
||||
void _init_gui_buffer()
|
||||
{
|
||||
_nitpicker.buffer(Framebuffer::Mode(_win_w, _win_h,
|
||||
Framebuffer::Mode::RGB565), false);
|
||||
_gui.buffer(Framebuffer::Mode(_win_w, _win_h,
|
||||
Framebuffer::Mode::RGB565), false);
|
||||
}
|
||||
|
||||
bool const _nitpicker_buffer_initialized = (_init_nitpicker_buffer(), true);
|
||||
bool const _gui_buffer_initialized = (_init_gui_buffer(), true);
|
||||
|
||||
Sliced_heap _sliced_heap { _env.ram(), _env.rm() };
|
||||
|
||||
/* create log window */
|
||||
Attached_dataspace _fb_ds { _env.rm(), _nitpicker.framebuffer()->dataspace() };
|
||||
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer()->dataspace() };
|
||||
|
||||
Canvas<Pixel_rgb565> _canvas { _fb_ds.local_addr<Pixel_rgb565>(),
|
||||
::Area(_win_w, _win_h) };
|
||||
@ -438,18 +438,18 @@ struct Nitlog::Main
|
||||
bool const _canvas_initialized = (_init_canvas(), true);
|
||||
|
||||
/* create view for log window */
|
||||
Nitpicker::Rect const _view_geometry { Nitpicker::Point(20, 20),
|
||||
Nitpicker::Area(_win_w, _win_h) };
|
||||
Log_view _view { _nitpicker, _view_geometry };
|
||||
Gui::Rect const _view_geometry { Gui::Point(20, 20),
|
||||
Gui::Area(_win_w, _win_h) };
|
||||
Log_view _view { _gui, _view_geometry };
|
||||
|
||||
/* create root interface for service */
|
||||
Root _root { _env.ep(), _sliced_heap, _log_window };
|
||||
|
||||
Attached_dataspace _ev_ds { _env.rm(), _nitpicker.input()->dataspace() };
|
||||
Attached_dataspace _ev_ds { _env.rm(), _gui.input()->dataspace() };
|
||||
|
||||
Nitpicker::Point const _initial_mouse_pos { -1, -1 };
|
||||
Gui::Point const _initial_mouse_pos { -1, -1 };
|
||||
|
||||
Nitpicker::Point _old_mouse_pos = _initial_mouse_pos;
|
||||
Gui::Point _old_mouse_pos = _initial_mouse_pos;
|
||||
|
||||
unsigned _key_cnt = 0;
|
||||
|
||||
@ -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 = _nitpicker.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];
|
||||
|
||||
@ -470,7 +470,7 @@ struct Nitlog::Main
|
||||
/* move view */
|
||||
ev.handle_absolute_motion([&] (int x, int y) {
|
||||
|
||||
Nitpicker::Point const mouse_pos(x, y);
|
||||
Gui::Point const mouse_pos(x, y);
|
||||
|
||||
if (_key_cnt && _old_mouse_pos != _initial_mouse_pos)
|
||||
_view.move(_view.pos() + mouse_pos - _old_mouse_pos);
|
||||
@ -491,7 +491,7 @@ struct Nitlog::Main
|
||||
void _handle_timer()
|
||||
{
|
||||
if (_log_window.draw())
|
||||
_nitpicker.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);
|
||||
|
||||
_nitpicker.input()->sigh(_input_handler);
|
||||
_gui.input()->sigh(_input_handler);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user