backdrop: make width and height customizable

This commit is contained in:
Norman Feske 2020-01-27 17:55:34 +01:00 committed by Christian Helmuth
parent 60edfa4d77
commit c25de5dba3
2 changed files with 18 additions and 5 deletions

View File

@ -68,6 +68,14 @@ covering the whole screen or as a single image. The supported attributes are
viewport can be defined via the 'anchor', 'xpos', and 'ypos' attributes.
Customized size
---------------
By default, the backdrop adjusts itself to the physical screen size as
reported by the nitpicker GUI server. This default size can be overridden by
specifying a fixed size as '<config>' attributes 'width' and 'height'.
Example
~~~~~~~

View File

@ -53,8 +53,7 @@ struct Backdrop::Main
{
Nitpicker::Connection &nitpicker;
/* physical screen size */
Framebuffer::Mode const mode = nitpicker.mode();
Framebuffer::Mode const mode;
/**
* Return dataspace capability for virtual framebuffer
@ -84,8 +83,8 @@ struct Backdrop::Main
/**
* Constructor
*/
Buffer(Genode::Env &env, Nitpicker::Connection &nitpicker)
: nitpicker(nitpicker),
Buffer(Genode::Env &env, Nitpicker::Connection &nitpicker, Framebuffer::Mode mode)
: nitpicker(nitpicker), mode(mode),
fb_ds(env.rm(), _ds_cap(nitpicker)),
surface_ds(env.ram(), env.rm(), surface_num_bytes())
{ }
@ -325,7 +324,13 @@ void Backdrop::Main::_handle_config()
{
_config.update();
_buffer.construct(_env, _nitpicker);
Framebuffer::Mode const phys_mode = _nitpicker.mode();
Framebuffer::Mode const
mode(_config.xml().attribute_value("width", (unsigned)phys_mode.width()),
_config.xml().attribute_value("height", (unsigned)phys_mode.height()),
phys_mode.format());
_buffer.construct(_env, _nitpicker, mode);
/* clear surface */
_apply_fill(Xml_node("<fill color=\"#000000\"/>"));