diff --git a/repos/gems/recipes/pkg/cbe_shell/archives b/repos/gems/recipes/pkg/cbe_shell/archives
index 1b8e26c22e..3dbd837cd5 100644
--- a/repos/gems/recipes/pkg/cbe_shell/archives
+++ b/repos/gems/recipes/pkg/cbe_shell/archives
@@ -3,7 +3,6 @@ _/src/coreutils
_/src/libc
_/src/posix
_/src/ncurses
-_/src/gui_fb
_/src/terminal
_/src/init
_/src/vfs
diff --git a/repos/gems/recipes/pkg/cbe_shell/runtime b/repos/gems/recipes/pkg/cbe_shell/runtime
index 1d64c20ade..67c5cb4f58 100644
--- a/repos/gems/recipes/pkg/cbe_shell/runtime
+++ b/repos/gems/recipes/pkg/cbe_shell/runtime
@@ -16,7 +16,6 @@
-
@@ -45,24 +44,16 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
diff --git a/repos/gems/recipes/pkg/download_coreplus/archives b/repos/gems/recipes/pkg/download_coreplus/archives
index 23b85407a8..9d6368741f 100644
--- a/repos/gems/recipes/pkg/download_coreplus/archives
+++ b/repos/gems/recipes/pkg/download_coreplus/archives
@@ -10,7 +10,6 @@ _/src/libcrypto
_/src/libssh
_/src/libssl
_/src/ncurses
-_/src/gui_fb
_/src/posix
_/src/report_rom
_/src/terminal
diff --git a/repos/gems/recipes/pkg/download_coreplus/runtime b/repos/gems/recipes/pkg/download_coreplus/runtime
index 21bec87756..6d40087146 100644
--- a/repos/gems/recipes/pkg/download_coreplus/runtime
+++ b/repos/gems/recipes/pkg/download_coreplus/runtime
@@ -15,7 +15,6 @@
-
diff --git a/repos/gems/recipes/pkg/sculpt/archives b/repos/gems/recipes/pkg/sculpt/archives
index 5eff5d1e36..0c9a8f5c42 100644
--- a/repos/gems/recipes/pkg/sculpt/archives
+++ b/repos/gems/recipes/pkg/sculpt/archives
@@ -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
diff --git a/repos/gems/recipes/pkg/terminal/runtime b/repos/gems/recipes/pkg/terminal/runtime
index 5c0238c33c..fa2d11abf1 100644
--- a/repos/gems/recipes/pkg/terminal/runtime
+++ b/repos/gems/recipes/pkg/terminal/runtime
@@ -1,6 +1,6 @@
-
+
-
+
diff --git a/repos/gems/recipes/raw/download_coreplus/init.config b/repos/gems/recipes/raw/download_coreplus/init.config
index 8f1275035e..9ec8df6073 100644
--- a/repos/gems/recipes/raw/download_coreplus/init.config
+++ b/repos/gems/recipes/raw/download_coreplus/init.config
@@ -14,15 +14,6 @@
-
-
-
-
-
-
-
-
-
@@ -88,14 +79,13 @@ cp /machine.vbox /disk0.vmdk /vm
-
+
+
-
-
diff --git a/repos/gems/recipes/src/terminal/used_apis b/repos/gems/recipes/src/terminal/used_apis
index ad8294e066..a498c84b88 100644
--- a/repos/gems/recipes/src/terminal/used_apis
+++ b/repos/gems/recipes/src/terminal/used_apis
@@ -1,5 +1,6 @@
base
os
+gui_session
framebuffer_session
input_session
nitpicker_gfx
diff --git a/repos/gems/run/sculpt/leitzentrale.config b/repos/gems/run/sculpt/leitzentrale.config
index f4ac6bb811..9d30992a43 100644
--- a/repos/gems/run/sculpt/leitzentrale.config
+++ b/repos/gems/run/sculpt/leitzentrale.config
@@ -249,20 +249,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -279,7 +268,8 @@
-
+
+
diff --git a/repos/gems/run/terminal_echo.run b/repos/gems/run/terminal_echo.run
index adeb8c5c91..d0506f3ae3 100644
--- a/repos/gems/run/terminal_echo.run
+++ b/repos/gems/run/terminal_echo.run
@@ -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 {
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/repos/gems/run/terminal_log.run b/repos/gems/run/terminal_log.run
index 637b6eaec7..c29495e8f8 100644
--- a/repos/gems/run/terminal_log.run
+++ b/repos/gems/run/terminal_log.run
@@ -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 {
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
diff --git a/repos/gems/run/vfs_cbe.run b/repos/gems/run/vfs_cbe.run
index b72ed8ed3f..01a598620f 100644
--- a/repos/gems/run/vfs_cbe.run
+++ b/repos/gems/run/vfs_cbe.run
@@ -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 {
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
}
@@ -349,7 +338,7 @@ append boot_modules {
append boot_modules [cbe_image_file]
set fd [open [run_dir]/genode/focus w]
-puts $fd " \" domain=\"default\"/>"
+puts $fd " \" domain=\"default\"/>"
close $fd
build_boot_image $boot_modules
diff --git a/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc b/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc
index 7c607f5226..d9fc48f967 100644
--- a/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc
+++ b/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc
@@ -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(xml, [&] () {});
- gen_service_node(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 (xml);
- gen_parent_route (xml);
- gen_parent_route (xml);
- gen_parent_route (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(xml);
xml.node("route", [&] () {
- gen_service_node(xml, [&] () {
- gen_named_node(xml, "child", "gui_fb"); });
-
- gen_service_node(xml, [&] () {
- gen_named_node(xml, "child", "gui_fb"); });
-
gen_parent_rom_route(xml, "config", "terminal.config");
gen_parent_route (xml);
@@ -69,6 +41,7 @@ static void gen_terminal_start(Xml_generator &xml)
gen_parent_route (xml);
gen_parent_route (xml);
gen_parent_route(xml);
+ gen_parent_route (xml);
});
}
@@ -251,7 +224,6 @@ void Sculpt::gen_inspect_view(Xml_generator &xml,
gen_parent_service(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");
diff --git a/repos/gems/src/server/terminal/README b/repos/gems/src/server/terminal/README
index 2a3ec4dbbe..3e10872126 100644
--- a/repos/gems/src/server/terminal/README
+++ b/repos/gems/src/server/terminal/README
@@ -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.
+
+!
+! ...
+!
+!
+!
+!
+!
+!
+!
+!
+!
Color configuration
@@ -14,7 +27,7 @@ index 0-7 normal color and index 8-15 bright (bold) colors.
!
!
!
-! ...
+! ...
!
@@ -31,3 +44,18 @@ button, the selection is reported.
Vice versa, with the '' 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.
+
+!
+!
+! ...
+!
+
diff --git a/repos/gems/src/server/terminal/framebuffer.h b/repos/gems/src/server/terminal/framebuffer.h
deleted file mode 100644
index a9c2784893..0000000000
--- a/repos/gems/src/server/terminal/framebuffer.h
+++ /dev/null
@@ -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
-
-/* local includes */
-#include "types.h"
-
-namespace Terminal { class Framebuffer; }
-
-class Terminal::Framebuffer
-{
- private:
-
- Env &_env;
-
- ::Framebuffer::Connection _fb { _env, ::Framebuffer::Mode { } };
-
- Constructible _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
- PT *pixel() { return _ds->local_addr(); }
-
- 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_ */
diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc
index e3f1ad6367..3af4baebc0 100644
--- a/repos/gems/src/server/terminal/main.cc
+++ b/repos/gems/src/server/terminal/main.cc
@@ -15,8 +15,7 @@
#include
#include
#include
-#include
-#include
+#include
#include
#include
#include
@@ -81,10 +80,23 @@ struct Terminal::Main : Character_consumer
Signal_handler _config_handler {
_env.ep(), *this, &Main::_handle_config };
- Input::Connection _input { _env };
+ void _handle_mode_change()
+ {
+ _fb_mode = _gui.mode();
+ _handle_config();
+ }
+
+ Signal_handler _mode_change_handler {
+ _env.ep(), *this, &Main::_handle_mode_change };
+
+ Gui::Connection _gui { _env };
Timer::Connection _timer { _env };
- Framebuffer _framebuffer { _env, _config_handler };
+ Constructible _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 surface(_fb_ds->local_addr(), _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(_view, Rect(Point(0, 0), _fb_mode.area));
+ _gui.enqueue(_view, Gui::Session::View_handle());
+ _gui.execute();
+
+ _flushed_fb_mode = _fb_mode;
+ }
}
Signal_handler _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::Geometry const new_geometry(_font->font(), _framebuffer);
+ Text_screen_surface::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) {
diff --git a/repos/gems/src/server/terminal/text_screen_surface.h b/repos/gems/src/server/terminal/text_screen_surface.h
index 3be3a25af8..0623da2911 100644
--- a/repos/gems/src/server/terminal/text_screen_surface.h
+++ b/repos/gems/src/server/terminal/text_screen_surface.h
@@ -27,7 +27,6 @@
/* local includes */
#include "color_palette.h"
-#include "framebuffer.h"
namespace Terminal { template 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 _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 &surface)
{
- PT *fb_base = _framebuffer.pixel();
-
- Surface 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)
diff --git a/repos/ports/recipes/pkg/system_shell/archives b/repos/ports/recipes/pkg/system_shell/archives
index b3c762e6b8..8284bc3334 100644
--- a/repos/ports/recipes/pkg/system_shell/archives
+++ b/repos/ports/recipes/pkg/system_shell/archives
@@ -5,7 +5,6 @@ _/src/coreutils-minimal
_/src/libc
_/src/posix
_/src/ncurses
-_/src/gui_fb
_/src/terminal
_/src/init
_/src/vfs
diff --git a/repos/ports/recipes/pkg/system_shell/runtime b/repos/ports/recipes/pkg/system_shell/runtime
index 5bd10eee3c..8f5e8f0be7 100644
--- a/repos/ports/recipes/pkg/system_shell/runtime
+++ b/repos/ports/recipes/pkg/system_shell/runtime
@@ -19,7 +19,6 @@
-
diff --git a/repos/ports/recipes/raw/system_shell/system_shell.config b/repos/ports/recipes/raw/system_shell/system_shell.config
index 6a850205fd..d88cc8ef0c 100644
--- a/repos/ports/recipes/raw/system_shell/system_shell.config
+++ b/repos/ports/recipes/raw/system_shell/system_shell.config
@@ -15,24 +15,16 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
diff --git a/repos/ports/run/bash.run b/repos/ports/run/bash.run
index 5457a74c86..f8d2ed2bc0 100644
--- a/repos/ports/run/bash.run
+++ b/repos/ports/run/bash.run
@@ -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 {
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
@@ -154,7 +142,7 @@ install_config {
}
set fd [open [run_dir]/genode/focus w]
-puts $fd " \" domain=\"default\"/>"
+puts $fd " \" domain=\"default\"/>"
close $fd
build { lib/ld test/fork test/execve }
diff --git a/repos/ports/run/vim.run b/repos/ports/run/vim.run
index 48533ca408..78c5acf630 100644
--- a/repos/ports/run/vim.run
+++ b/repos/ports/run/vim.run
@@ -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 {
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -147,8 +137,7 @@ install_config {
-
-
+