mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 11:55:24 +00:00
parent
887fcecf63
commit
d47f87a768
@ -3,7 +3,6 @@ _/src/coreutils
|
||||
_/src/libc
|
||||
_/src/posix
|
||||
_/src/ncurses
|
||||
_/src/gui_fb
|
||||
_/src/terminal
|
||||
_/src/init
|
||||
_/src/vfs
|
||||
|
@ -16,7 +16,6 @@
|
||||
<rom label="libc.lib.so"/>
|
||||
<rom label="libm.lib.so"/>
|
||||
<rom label="init"/>
|
||||
<rom label="gui_fb"/>
|
||||
<rom label="vfs"/>
|
||||
<rom label="vfs_pipe.lib.so"/>
|
||||
<rom label="cached_fs_rom"/>
|
||||
@ -45,24 +44,16 @@
|
||||
|
||||
<default caps="100"/>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config xpos="10" ypos="10" initial_width="800" initial_height="600"/>
|
||||
<route>
|
||||
<service name="Gui"> <parent label="terminal"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="terminal">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides> <service name="Terminal"/> </provides>
|
||||
<config copy="yes" paste="yes">
|
||||
<initial width="800" height="600"/>
|
||||
<vfs> <dir name="fonts"> <fs/> </dir> </vfs>
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system"> <parent label="fonts"/> </service>
|
||||
<service name="File_system"> <parent label="fonts"/> </service>
|
||||
<service name="Gui"> <parent label="terminal"/> </service>
|
||||
<service name="Report" label="clipboard"> <parent label="clipboard"/> </service>
|
||||
<service name="ROM" label="clipboard"> <parent label="clipboard"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
|
@ -10,7 +10,6 @@ _/src/libcrypto
|
||||
_/src/libssh
|
||||
_/src/libssl
|
||||
_/src/ncurses
|
||||
_/src/gui_fb
|
||||
_/src/posix
|
||||
_/src/report_rom
|
||||
_/src/terminal
|
||||
|
@ -15,7 +15,6 @@
|
||||
<rom label="libc.lib.so"/>
|
||||
<rom label="libm.lib.so"/>
|
||||
<rom label="init"/>
|
||||
<rom label="gui_fb"/>
|
||||
<rom label="terminal"/>
|
||||
<rom label="posix.lib.so"/>
|
||||
<rom label="ncurses.lib.so"/>
|
||||
|
@ -9,8 +9,8 @@ _/src/cached_fs_rom
|
||||
_/src/fs_report
|
||||
_/src/nitpicker
|
||||
_/src/global_keys_handler
|
||||
_/src/gui_fb
|
||||
_/src/gui_fader
|
||||
_/src/gui_fb
|
||||
_/src/rom_filter
|
||||
_/src/terminal_log
|
||||
_/src/file_terminal
|
||||
|
@ -1,6 +1,6 @@
|
||||
<runtime ram="4M" caps="100" binary="terminal" config="terminal.config">
|
||||
<runtime ram="12M" caps="100" binary="terminal" config="terminal.config">
|
||||
|
||||
<requires> <input/> <framebuffer/> </requires>
|
||||
<requires> <gui/> </requires>
|
||||
<provides> <terminal/> </provides>
|
||||
|
||||
<content>
|
||||
|
@ -14,15 +14,6 @@
|
||||
<default-route> <any-service> <parent/> </any-service> </default-route>
|
||||
<default caps="100"/>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides>
|
||||
<service name="Framebuffer"/>
|
||||
<service name="Input"/>
|
||||
</provides>
|
||||
<config xpos="10" ypos="10" initial_width="900" initial_height="200"/>
|
||||
</start>
|
||||
|
||||
<start name="vfs">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<provides><service name="File_system"/></provides>
|
||||
@ -88,14 +79,13 @@ cp /machine.vbox /disk0.vmdk /vm
|
||||
</start>
|
||||
|
||||
<start name="terminal">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides> <service name="Terminal"/> </provides>
|
||||
<config>
|
||||
<initial width="900" height="200"/>
|
||||
<vfs> <dir name="fonts"> <fs/> </dir> </vfs>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Input"> <child name="gui_fb" /> </service>
|
||||
<service name="Framebuffer"> <child name="gui_fb" /> </service>
|
||||
<service name="File_system"> <parent label="fonts"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
|
@ -1,5 +1,6 @@
|
||||
base
|
||||
os
|
||||
gui_session
|
||||
framebuffer_session
|
||||
input_session
|
||||
nitpicker_gfx
|
||||
|
@ -249,20 +249,9 @@
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="log_gui_fb">
|
||||
<binary name="gui_fb"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config origin="top_right" xpos="-412" ypos="2" initial_width="400" initial_height="400"/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="wm" label="log"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="log_terminal">
|
||||
<binary name="terminal"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides> <service name="Terminal"/> </provides>
|
||||
<config>
|
||||
<palette>
|
||||
@ -279,7 +268,8 @@
|
||||
</vfs>
|
||||
</config>
|
||||
<route>
|
||||
<any-service> <child name="log_gui_fb"/> <parent/> </any-service>
|
||||
<service name="Gui"> <child name="wm" label="log"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
|
@ -4,7 +4,6 @@ import_from_depot [depot_user]/src/[base_src] \
|
||||
[depot_user]/pkg/[drivers_interactive_pkg] \
|
||||
[depot_user]/pkg/terminal \
|
||||
[depot_user]/src/nitpicker \
|
||||
[depot_user]/src/gui_fb \
|
||||
[depot_user]/src/init
|
||||
|
||||
install_config {
|
||||
@ -55,21 +54,12 @@ install_config {
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="nitpicker" label="terminal"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="terminal" caps="110">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides><service name="Terminal"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
|
||||
<service name="Gui"> <child name="nitpicker" label="terminal"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
@ -4,7 +4,6 @@ import_from_depot [depot_user]/src/[base_src] \
|
||||
[depot_user]/pkg/[drivers_interactive_pkg] \
|
||||
[depot_user]/pkg/terminal \
|
||||
[depot_user]/src/nitpicker \
|
||||
[depot_user]/src/gui_fb \
|
||||
[depot_user]/src/demo \
|
||||
[depot_user]/src/init
|
||||
|
||||
@ -66,23 +65,12 @@ install_config {
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
</start>
|
||||
|
||||
<start name="terminal_fb">
|
||||
<binary name="gui_fb"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides>
|
||||
<service name="Framebuffer"/>
|
||||
<service name="Input"/>
|
||||
</provides>
|
||||
<config xpos="0" ypos="0" width="640" height="480" refresh_rate="25"/>
|
||||
</start>
|
||||
|
||||
<start name="terminal" caps="110">
|
||||
<resource name="RAM" quantum="3M"/>
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides><service name="Terminal"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
|
||||
<service name="Input"> <child name="terminal_fb"/> </service>
|
||||
<service name="Framebuffer"> <child name="terminal_fb"/> </service>
|
||||
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||
<any-service> <parent/> <any-child/></any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
@ -26,8 +26,7 @@ import_from_depot [depot_user]/pkg/[drivers_interactive_pkg] \
|
||||
[depot_user]/src/ncurses \
|
||||
[depot_user]/src/bash \
|
||||
[depot_user]/src/coreutils \
|
||||
[depot_user]/src/nitpicker \
|
||||
[depot_user]/src/gui_fb
|
||||
[depot_user]/src/nitpicker
|
||||
|
||||
|
||||
build {
|
||||
@ -46,6 +45,7 @@ build {
|
||||
server/log_terminal
|
||||
server/report_rom
|
||||
server/fs_rom
|
||||
app/cbe_init_trust_anchor
|
||||
}
|
||||
|
||||
set config {
|
||||
@ -103,24 +103,13 @@ append_if $use_interactively config {
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="terminal_service" caps="110">
|
||||
<binary name="terminal"/>
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides><service name="Terminal"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
|
||||
<service name="Input"> <child name="gui_fb"/> </service>
|
||||
<service name="Framebuffer"> <child name="gui_fb"/> </service>
|
||||
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
@ -349,7 +338,7 @@ append boot_modules {
|
||||
append boot_modules [cbe_image_file]
|
||||
|
||||
set fd [open [run_dir]/genode/focus w]
|
||||
puts $fd "<focus label=\"gui_fb -> \" domain=\"default\"/>"
|
||||
puts $fd "<focus label=\"terminal_service -> \" domain=\"default\"/>"
|
||||
close $fd
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
@ -26,41 +26,13 @@ static void for_each_inspected_storage_target(Storage_devices const &devices, FN
|
||||
}
|
||||
|
||||
|
||||
static void gen_gui_fb_start(Xml_generator &xml)
|
||||
{
|
||||
gen_common_start_content(xml, "gui_fb", Cap_quota{100}, Ram_quota{18*1024*1024});
|
||||
|
||||
xml.node("provides", [&] () {
|
||||
gen_service_node<Framebuffer::Session>(xml, [&] () {});
|
||||
gen_service_node<Input::Session>(xml, [&] () {});
|
||||
});
|
||||
|
||||
xml.node("config", [&] () { });
|
||||
|
||||
xml.node("route", [&] () {
|
||||
gen_parent_rom_route(xml, "gui_fb");
|
||||
gen_parent_rom_route(xml, "ld.lib.so");
|
||||
gen_parent_route<Cpu_session> (xml);
|
||||
gen_parent_route<Pd_session> (xml);
|
||||
gen_parent_route<Log_session> (xml);
|
||||
gen_parent_route<Gui::Session> (xml);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
static void gen_terminal_start(Xml_generator &xml)
|
||||
{
|
||||
gen_common_start_content(xml, "terminal", Cap_quota{110}, Ram_quota{4*1024*1024});
|
||||
gen_common_start_content(xml, "terminal", Cap_quota{110}, Ram_quota{18*1024*1024});
|
||||
|
||||
gen_provides<Terminal::Session>(xml);
|
||||
|
||||
xml.node("route", [&] () {
|
||||
gen_service_node<Framebuffer::Session>(xml, [&] () {
|
||||
gen_named_node(xml, "child", "gui_fb"); });
|
||||
|
||||
gen_service_node<Input::Session>(xml, [&] () {
|
||||
gen_named_node(xml, "child", "gui_fb"); });
|
||||
|
||||
gen_parent_rom_route(xml, "config", "terminal.config");
|
||||
|
||||
gen_parent_route<Rom_session> (xml);
|
||||
@ -69,6 +41,7 @@ static void gen_terminal_start(Xml_generator &xml)
|
||||
gen_parent_route<Log_session> (xml);
|
||||
gen_parent_route<Timer::Session> (xml);
|
||||
gen_parent_route<Report::Session>(xml);
|
||||
gen_parent_route<Gui::Session> (xml);
|
||||
});
|
||||
}
|
||||
|
||||
@ -251,7 +224,6 @@ void Sculpt::gen_inspect_view(Xml_generator &xml,
|
||||
gen_parent_service<Gui::Session>(xml);
|
||||
});
|
||||
|
||||
xml.node("start", [&] () { gen_gui_fb_start(xml); });
|
||||
xml.node("start", [&] () { gen_terminal_start(xml); });
|
||||
xml.node("start", [&] () { gen_vfs_start(xml, devices, ram_fs_state); });
|
||||
xml.node("start", [&] () { gen_fs_rom_start(xml); });
|
||||
@ -279,7 +251,6 @@ void Sculpt::gen_inspect_view(Xml_generator &xml,
|
||||
gen_parent_rom_route(xml, "init");
|
||||
gen_parent_rom_route(xml, "terminal");
|
||||
gen_parent_rom_route(xml, "vfs");
|
||||
gen_parent_rom_route(xml, "gui_fb");
|
||||
gen_parent_rom_route(xml, "cached_fs_rom");
|
||||
gen_parent_rom_route(xml, "vfs.lib.so");
|
||||
gen_parent_rom_route(xml, "vfs_pipe.lib.so");
|
||||
|
@ -1,5 +1,18 @@
|
||||
This is a graphical terminal implementation. It provides the Terminal
|
||||
service and uses a nitpicker session for screen representation.
|
||||
service and uses a GUI session. The font information must be provided
|
||||
via a VFS configuration like the following.
|
||||
|
||||
! <config>
|
||||
! ...
|
||||
! <vfs>
|
||||
! <rom name="VeraMono.ttf"/>
|
||||
! <dir name="fonts">
|
||||
! <dir name="monospace">
|
||||
! <ttf name="regular" path="/VeraMono.ttf" size_px="16"/>
|
||||
! </dir>
|
||||
! </dir>
|
||||
! </vfs>
|
||||
! </config>
|
||||
|
||||
|
||||
Color configuration
|
||||
@ -14,7 +27,7 @@ index 0-7 normal color and index 8-15 bright (bold) colors.
|
||||
! <color index="0" value="#000000"/> <!-- black is real black -->
|
||||
! <color index="8" value="#101010"/> <!-- bright black stands out a bit -->
|
||||
! </palette>
|
||||
! ...
|
||||
! ...
|
||||
! </config>
|
||||
|
||||
|
||||
@ -31,3 +44,18 @@ button, the selection is reported.
|
||||
Vice versa, with the '<config>' attribute 'paste="yes"' specified, the
|
||||
terminal allows the user to paste the content of a "clipboard" ROM session
|
||||
to the terminal client by pressing the middle mouse button.
|
||||
|
||||
|
||||
Initial terminal size
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The terminal adjusts itself to the mode provided by the used GUI service and
|
||||
responds to mode changes. As a special case, the initial terminal size can be
|
||||
explicitly configured to accommodate situations where the terminal is hosted
|
||||
in a window smaller than the screen.
|
||||
|
||||
! <config>
|
||||
! <initial width="800" height="600"/>
|
||||
! ...
|
||||
! </config>
|
||||
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* \brief Terminal framebuffer output backend
|
||||
* \author Norman Feske
|
||||
* \date 2018-02-06
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _FRAMEBUFFER_H_
|
||||
#define _FRAMEBUFFER_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <framebuffer_session/connection.h>
|
||||
|
||||
/* local includes */
|
||||
#include "types.h"
|
||||
|
||||
namespace Terminal { class Framebuffer; }
|
||||
|
||||
class Terminal::Framebuffer
|
||||
{
|
||||
private:
|
||||
|
||||
Env &_env;
|
||||
|
||||
::Framebuffer::Connection _fb { _env, ::Framebuffer::Mode { } };
|
||||
|
||||
Constructible<Attached_dataspace> _ds { };
|
||||
|
||||
::Framebuffer::Mode _mode { };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param mode_sigh signal handler to be triggered on mode changes
|
||||
*/
|
||||
Framebuffer(Env &env, Signal_context_capability mode_sigh) : _env(env)
|
||||
{
|
||||
switch_to_new_mode();
|
||||
_fb.mode_sigh(mode_sigh);
|
||||
}
|
||||
|
||||
unsigned w() const { return _mode.area.w(); }
|
||||
unsigned h() const { return _mode.area.h(); }
|
||||
|
||||
template <typename PT>
|
||||
PT *pixel() { return _ds->local_addr<PT>(); }
|
||||
|
||||
void refresh(Rect rect)
|
||||
{
|
||||
_fb.refresh(rect.x1(), rect.y1(), rect.w(), rect.h());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the framebuffer mode differs from the current
|
||||
* terminal size.
|
||||
*/
|
||||
bool mode_changed() const
|
||||
{
|
||||
return _fb.mode().area != _mode.area;
|
||||
}
|
||||
|
||||
void switch_to_new_mode()
|
||||
{
|
||||
/*
|
||||
* The mode information must be obtained before updating the
|
||||
* dataspace to ensure that the mode is consistent with the
|
||||
* obtained version of the dataspace.
|
||||
*
|
||||
* Otherwise - if the server happens to change the mode just after
|
||||
* the dataspace update - the mode information may correspond to
|
||||
* the next pending mode at the server while we are operating on
|
||||
* the old (possibly too small) dataspace.
|
||||
*/
|
||||
_mode = _fb.mode();
|
||||
if (_mode.area.count() > 0)
|
||||
_ds.construct(_env.rm(), _fb.dataspace());
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _FRAMEBUFFER_H_ */
|
@ -15,8 +15,7 @@
|
||||
#include <base/component.h>
|
||||
#include <base/log.h>
|
||||
#include <base/heap.h>
|
||||
#include <framebuffer_session/connection.h>
|
||||
#include <input_session/connection.h>
|
||||
#include <gui_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
@ -81,10 +80,23 @@ struct Terminal::Main : Character_consumer
|
||||
Signal_handler<Main> _config_handler {
|
||||
_env.ep(), *this, &Main::_handle_config };
|
||||
|
||||
Input::Connection _input { _env };
|
||||
void _handle_mode_change()
|
||||
{
|
||||
_fb_mode = _gui.mode();
|
||||
_handle_config();
|
||||
}
|
||||
|
||||
Signal_handler<Main> _mode_change_handler {
|
||||
_env.ep(), *this, &Main::_handle_mode_change };
|
||||
|
||||
Gui::Connection _gui { _env };
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Framebuffer _framebuffer { _env, _config_handler };
|
||||
Constructible<Attached_dataspace> _fb_ds { };
|
||||
|
||||
Framebuffer::Mode _fb_mode { };
|
||||
|
||||
Gui::Session::View_handle _view = _gui.create_view();
|
||||
|
||||
Point _pointer { }; /* pointer positon in pixels */
|
||||
|
||||
@ -111,12 +123,31 @@ struct Terminal::Main : Character_consumer
|
||||
|
||||
bool _flush_scheduled = false;
|
||||
|
||||
Framebuffer::Mode _flushed_fb_mode { };
|
||||
|
||||
void _handle_flush()
|
||||
{
|
||||
_flush_scheduled = false;
|
||||
|
||||
if (_text_screen_surface.constructed())
|
||||
_text_screen_surface->redraw();
|
||||
if (_text_screen_surface.constructed() && _fb_ds.constructed()) {
|
||||
|
||||
Surface<PT> surface(_fb_ds->local_addr<PT>(), _fb_mode.area);
|
||||
|
||||
Rect const dirty = _text_screen_surface->redraw(surface);
|
||||
|
||||
_gui.framebuffer()->refresh(dirty.x1(), dirty.y1(), dirty.w(), dirty.h());
|
||||
}
|
||||
|
||||
/* update view geometry after mode change */
|
||||
if (_fb_mode.area != _flushed_fb_mode.area) {
|
||||
|
||||
typedef Gui::Session::Command Command;
|
||||
_gui.enqueue<Command::Geometry>(_view, Rect(Point(0, 0), _fb_mode.area));
|
||||
_gui.enqueue<Command::To_front>(_view, Gui::Session::View_handle());
|
||||
_gui.execute();
|
||||
|
||||
_flushed_fb_mode = _fb_mode;
|
||||
}
|
||||
}
|
||||
|
||||
Signal_handler<Main> _flush_handler {
|
||||
@ -160,7 +191,17 @@ struct Terminal::Main : Character_consumer
|
||||
{
|
||||
_timer .sigh(_flush_handler);
|
||||
_config.sigh(_config_handler);
|
||||
_input .sigh(_input_handler);
|
||||
|
||||
_gui.input()->sigh(_input_handler);
|
||||
_gui.mode_sigh(_mode_change_handler);
|
||||
|
||||
_fb_mode = _gui.mode();
|
||||
|
||||
/* apply initial size from config, if provided */
|
||||
_config.xml().with_sub_node("initial", [&] (Xml_node const &initial) {
|
||||
_fb_mode.area = Area(initial.attribute_value("width", _fb_mode.area.w()),
|
||||
initial.attribute_value("height", _fb_mode.area.h()));
|
||||
});
|
||||
|
||||
_handle_config();
|
||||
|
||||
@ -196,7 +237,10 @@ void Terminal::Main::_handle_config()
|
||||
/*
|
||||
* Adapt terminal to font or framebuffer mode changes
|
||||
*/
|
||||
_framebuffer.switch_to_new_mode();
|
||||
_gui.buffer(_fb_mode, false);
|
||||
|
||||
if (_fb_mode.area.count() > 0)
|
||||
_fb_ds.construct(_env.rm(), _gui.framebuffer()->dataspace());
|
||||
|
||||
/*
|
||||
* Distinguish the case where the framebuffer change affects the character
|
||||
@ -210,7 +254,7 @@ void Terminal::Main::_handle_config()
|
||||
*/
|
||||
|
||||
try {
|
||||
Text_screen_surface<PT>::Geometry const new_geometry(_font->font(), _framebuffer);
|
||||
Text_screen_surface<PT>::Geometry const new_geometry(_font->font(), _fb_mode.area);
|
||||
|
||||
bool const reconstruct = !_text_screen_surface.constructed() ||
|
||||
_text_screen_surface->size() != new_geometry.size();
|
||||
@ -241,7 +285,7 @@ void Terminal::Main::_handle_config()
|
||||
: Position();
|
||||
|
||||
_text_screen_surface.construct(_heap, _font->font(),
|
||||
_color_palette, _framebuffer);
|
||||
_color_palette, _fb_mode.area);
|
||||
|
||||
if (snapshot.constructed())
|
||||
_text_screen_surface->import(*snapshot);
|
||||
@ -273,7 +317,7 @@ void Terminal::Main::_handle_config()
|
||||
|
||||
void Terminal::Main::_handle_input()
|
||||
{
|
||||
_input.for_each_event([&] (Input::Event const &event) {
|
||||
_gui.input()->for_each_event([&] (Input::Event const &event) {
|
||||
|
||||
event.handle_absolute_motion([&] (int x, int y) {
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
/* local includes */
|
||||
#include "color_palette.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
namespace Terminal { template <typename> class Text_screen_surface; }
|
||||
|
||||
@ -62,13 +61,13 @@ class Terminal::Text_screen_surface
|
||||
|
||||
class Invalid : Genode::Exception { };
|
||||
|
||||
Geometry(Font const &font, Framebuffer const &framebuffer)
|
||||
Geometry(Font const &font, Area initial_fb_size)
|
||||
:
|
||||
fb_size(framebuffer.w(), framebuffer.h()),
|
||||
fb_size(initial_fb_size),
|
||||
char_width(font.string_width(Utf8_ptr("M"))),
|
||||
char_height(font.height()),
|
||||
columns((_visible(framebuffer.w()) << 8)/char_width.value),
|
||||
lines(_visible(framebuffer.h())/char_height)
|
||||
columns((_visible(initial_fb_size.w()) << 8)/char_width.value),
|
||||
lines(_visible(initial_fb_size.h())/char_height)
|
||||
{
|
||||
if (columns*lines == 0)
|
||||
throw Invalid();
|
||||
@ -146,8 +145,7 @@ class Terminal::Text_screen_surface
|
||||
|
||||
Font const &_font;
|
||||
Color_palette const &_palette;
|
||||
Framebuffer &_framebuffer;
|
||||
Geometry _geometry { _font, _framebuffer };
|
||||
Geometry _geometry;
|
||||
|
||||
Cell_array<Char_cell> _cell_array;
|
||||
Char_cell_array_character_screen _character_screen { _cell_array };
|
||||
@ -185,11 +183,11 @@ class Terminal::Text_screen_surface
|
||||
* \throw Geometry::Invalid
|
||||
*/
|
||||
Text_screen_surface(Allocator &alloc, Font const &font,
|
||||
Color_palette &palette, Framebuffer &framebuffer)
|
||||
Color_palette &palette, Area initial_fb_size)
|
||||
:
|
||||
_font(font),
|
||||
_palette(palette),
|
||||
_framebuffer(framebuffer),
|
||||
_geometry(font, initial_fb_size),
|
||||
_cell_array(_geometry.columns, _geometry.lines, alloc)
|
||||
{ }
|
||||
|
||||
@ -210,12 +208,8 @@ class Terminal::Text_screen_surface
|
||||
|
||||
void cursor_pos(Position pos) { _character_screen.cursor_pos(pos); }
|
||||
|
||||
void redraw()
|
||||
Rect redraw(Surface<PT> &surface)
|
||||
{
|
||||
PT *fb_base = _framebuffer.pixel<PT>();
|
||||
|
||||
Surface<PT> surface(fb_base, _geometry.fb_size);
|
||||
|
||||
unsigned const fg_alpha = 255;
|
||||
|
||||
/* clear border */
|
||||
@ -303,7 +297,7 @@ class Terminal::Text_screen_surface
|
||||
x.value += (_geometry.char_width.value - (int)((glyph.width - 1)<<8)) >> 1;
|
||||
|
||||
Glyph_painter::paint(Glyph_painter::Position(x, (int)y),
|
||||
glyph, fb_base, _geometry.fb_size.w(),
|
||||
glyph, surface.addr(), _geometry.fb_size.w(),
|
||||
clip_top, clip_bottom, clip_left, clip_right,
|
||||
pixel, fg_alpha);
|
||||
x = next_x;
|
||||
@ -331,9 +325,11 @@ class Terminal::Text_screen_surface
|
||||
+ first_dirty_line*_geometry.char_height;
|
||||
unsigned const h = num_dirty_lines*_geometry.char_height
|
||||
+ _geometry.unused_pixels().h();
|
||||
_framebuffer.refresh(Rect(Point(0, y),
|
||||
Area(_geometry.fb_size.w(), h)));
|
||||
|
||||
return Rect(Point(0, y), Area(_geometry.fb_size.w(),h));
|
||||
}
|
||||
|
||||
return Rect();
|
||||
}
|
||||
|
||||
void apply_character(Character c)
|
||||
|
@ -5,7 +5,6 @@ _/src/coreutils-minimal
|
||||
_/src/libc
|
||||
_/src/posix
|
||||
_/src/ncurses
|
||||
_/src/gui_fb
|
||||
_/src/terminal
|
||||
_/src/init
|
||||
_/src/vfs
|
||||
|
@ -19,7 +19,6 @@
|
||||
<rom label="libc.lib.so"/>
|
||||
<rom label="libm.lib.so"/>
|
||||
<rom label="init"/>
|
||||
<rom label="gui_fb"/>
|
||||
<rom label="vfs"/>
|
||||
<rom label="vfs_pipe.lib.so"/>
|
||||
<rom label="cached_fs_rom"/>
|
||||
|
@ -15,24 +15,16 @@
|
||||
|
||||
<default caps="100"/>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config xpos="10" ypos="10" initial_width="800" initial_height="600"/>
|
||||
<route>
|
||||
<service name="Gui"> <parent label="terminal"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="terminal">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<provides> <service name="Terminal"/> </provides>
|
||||
<config copy="yes" paste="yes">
|
||||
<initial width="800" height="600"/>
|
||||
<vfs> <dir name="fonts"> <fs/> </dir> </vfs>
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system"> <parent label="fonts"/> </service>
|
||||
<service name="File_system"> <parent label="fonts"/> </service>
|
||||
<service name="Gui"> <parent label="terminal"/> </service>
|
||||
<service name="Report" label="clipboard"> <parent label="clipboard"/> </service>
|
||||
<service name="ROM" label="clipboard"> <parent label="clipboard"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
|
@ -12,7 +12,6 @@ import_from_depot [depot_user]/src/[base_src] \
|
||||
[depot_user]/src/vfs \
|
||||
[depot_user]/src/vfs_pipe \
|
||||
[depot_user]/src/nitpicker \
|
||||
[depot_user]/src/gui_fb \
|
||||
[depot_user]/src/fs_rom
|
||||
|
||||
# write default vimrc file
|
||||
@ -77,23 +76,12 @@ install_config {
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="terminal" caps="110">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides><service name="Terminal"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
|
||||
<service name="Input"> <child name="gui_fb"/> </service>
|
||||
<service name="Framebuffer"> <child name="gui_fb"/> </service>
|
||||
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
@ -154,7 +142,7 @@ install_config {
|
||||
</config>}
|
||||
|
||||
set fd [open [run_dir]/genode/focus w]
|
||||
puts $fd "<focus label=\"gui_fb -> \" domain=\"default\"/>"
|
||||
puts $fd "<focus label=\"terminal -> \" domain=\"default\"/>"
|
||||
close $fd
|
||||
|
||||
build { lib/ld test/fork test/execve }
|
||||
|
@ -6,7 +6,6 @@ import_from_depot [depot_user]/src/[base_src] \
|
||||
[depot_user]/pkg/motif_wm \
|
||||
[depot_user]/src/init \
|
||||
[depot_user]/src/nitpicker \
|
||||
[depot_user]/src/gui_fb \
|
||||
[depot_user]/src/clipboard \
|
||||
[depot_user]/src/report_rom \
|
||||
[depot_user]/src/libc \
|
||||
@ -121,20 +120,11 @@ install_config {
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="gui_fb">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config xpos="10" ypos="10" initial_width="800" initial_height="600"/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="wm" label="terminal"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="terminal" caps="110">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides><service name="Terminal"/></provides>
|
||||
<config copy="yes" paste="yes">
|
||||
<initial width="800" height="600"/>
|
||||
<vfs>
|
||||
<rom name="VeraMono.ttf"/>
|
||||
<dir name="fonts">
|
||||
@ -147,8 +137,7 @@ install_config {
|
||||
<route>
|
||||
<service name="ROM" label="clipboard"> <child name="wm"/> </service>
|
||||
<service name="Report" label="clipboard"> <child name="wm"/> </service>
|
||||
<service name="Framebuffer"> <child name="gui_fb"/> </service>
|
||||
<service name="Input"> <child name="gui_fb"/> </service>
|
||||
<service name="Gui"> <child name="wm" label="terminal"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
Loading…
x
Reference in New Issue
Block a user