mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
terminal: use initial mode for undefined size
This commit is contained in:
parent
12fb925555
commit
bc8932e46a
@ -100,11 +100,18 @@ struct Terminal::Main : Character_consumer
|
|||||||
Signal_handler<Main> _config_handler {
|
Signal_handler<Main> _config_handler {
|
||||||
_env.ep(), *this, &Main::_handle_config };
|
_env.ep(), *this, &Main::_handle_config };
|
||||||
|
|
||||||
|
Gui::Area _initial_mode { };
|
||||||
|
|
||||||
Gui::Rect _gui_window_rect()
|
Gui::Rect _gui_window_rect()
|
||||||
{
|
{
|
||||||
return _gui.window().convert<Gui::Rect>(
|
return _gui.window().convert<Gui::Rect>(
|
||||||
[&] (Gui::Rect rect) { return rect; },
|
[&] (Gui::Rect rect) { return rect; },
|
||||||
[&] (Gui::Undefined) { return Gui::Rect { { }, { 1, 1 } }; });
|
[&] (Gui::Undefined) {
|
||||||
|
Gui::Area const area =
|
||||||
|
_initial_mode.valid() ? _initial_mode
|
||||||
|
: Gui::Area { 1, 1 };
|
||||||
|
return Gui::Rect { { }, area };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handle_mode_change()
|
void _handle_mode_change()
|
||||||
@ -224,14 +231,14 @@ struct Terminal::Main : Character_consumer
|
|||||||
_gui.input.sigh(_input_handler);
|
_gui.input.sigh(_input_handler);
|
||||||
_gui.info_sigh(_mode_change_handler);
|
_gui.info_sigh(_mode_change_handler);
|
||||||
|
|
||||||
_win_rect = _gui_window_rect();
|
|
||||||
|
|
||||||
/* apply initial size from config, if provided */
|
/* apply initial size from config, if provided */
|
||||||
_config.xml().with_optional_sub_node("initial", [&] (Xml_node const &initial) {
|
_config.xml().with_optional_sub_node("initial", [&] (Xml_node const &initial) {
|
||||||
_win_rect.area = { initial.attribute_value("width", _win_rect.w()),
|
_initial_mode = { initial.attribute_value("width", _win_rect.w()),
|
||||||
initial.attribute_value("height", _win_rect.h()) };
|
initial.attribute_value("height", _win_rect.h()) };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_win_rect = _gui_window_rect();
|
||||||
|
|
||||||
_handle_config();
|
_handle_config();
|
||||||
|
|
||||||
/* announce service at our parent */
|
/* announce service at our parent */
|
||||||
|
Loading…
Reference in New Issue
Block a user