diff --git a/repos/os/run/pointer.run b/repos/os/run/pointer.run index 25fbfa23f4..210c94bdd7 100644 --- a/repos/os/run/pointer.run +++ b/repos/os/run/pointer.run @@ -157,14 +157,14 @@ set config { - - - - - - - - + + + + + + + + diff --git a/repos/os/src/app/pointer/main.cc b/repos/os/src/app/pointer/main.cc index 5c62a7c1a9..b772e1e4c6 100644 --- a/repos/os/src/app/pointer/main.cc +++ b/repos/os/src/app/pointer/main.cc @@ -260,7 +260,8 @@ void Pointer::Main::_update_pointer() shape_module.read_content(*this, (char*)&shape_report, sizeof(shape_report)); - if (shape_report.visible && + /* show default pointer on invisible/empty/invalid shape report */ + if (!shape_report.visible || ((shape_report.width == 0) || (shape_report.height == 0) || (shape_report.width > MAX_WIDTH) || diff --git a/repos/os/src/test/pointer/main.cc b/repos/os/src/test/pointer/main.cc index 2ed172394f..8bcd98e2f3 100644 --- a/repos/os/src/test/pointer/main.cc +++ b/repos/os/src/test/pointer/main.cc @@ -24,8 +24,11 @@ struct Shape typedef Genode::String<16> Id; Id const id; + bool const visible; unsigned const x_hot; unsigned const y_hot; + unsigned const width; + unsigned const height; unsigned char const map[WIDTH*HEIGHT]; void print(Genode::Output &output) const @@ -36,7 +39,7 @@ struct Shape static Shape const shape[] = { - { "arrow", 0, 0, { + { "arrow", true, 0, 0, Shape::WIDTH, Shape::HEIGHT, { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0, @@ -53,24 +56,19 @@ static Shape const shape[] = { 0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }, - { "blade", 0, 0, { - 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,1,0,1,0,0,0,0,0,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}, - { "smiley", 8, 8, { + { "smiley", true, 8, 8, Shape::WIDTH, Shape::HEIGHT, { 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0, 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -104,7 +102,7 @@ static Shape const shape[] = { 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0, 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0 } }, - { "yelims", 8, 8, { + { "yelims", true, 8, 8, Shape::WIDTH, Shape::HEIGHT, { 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0, 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -120,7 +118,9 @@ static Shape const shape[] = { 0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0, 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0, - 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0 } } + 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0 } }, + { "empty", true, 0, 0, 0, 0, { } }, + { "invisible", false, 0, 0, Shape::WIDTH, Shape::HEIGHT, { } }, }; @@ -158,18 +158,21 @@ struct Main Shape const &shape = select_shape(_config.xml()); - _shape_report.x_hot = shape.x_hot; - _shape_report.y_hot = shape.y_hot; + _shape_report.visible = shape.visible; + _shape_report.x_hot = shape.x_hot; + _shape_report.y_hot = shape.y_hot; + _shape_report.width = shape.width; + _shape_report.height = shape.height; - unsigned const w = Shape::WIDTH; - unsigned const h = Shape::HEIGHT; + unsigned const w = shape.width; + unsigned const h = shape.height; for (unsigned y = 0; y < h; ++y) { for (unsigned x = 0; x < w; ++x) { _shape_report.shape[(y*w + x)*4 + 0] = 0xff; - _shape_report.shape[(y*w + x)*4 + 1] = 0xff; - _shape_report.shape[(y*w + x)*4 + 2] = 0xff; - _shape_report.shape[(y*w + x)*4 + 3] = shape.map[y*w +x] ? 0xe0 : 0; + _shape_report.shape[(y*w + x)*4 + 1] = 0xf2; + _shape_report.shape[(y*w + x)*4 + 2] = 0xac; + _shape_report.shape[(y*w + x)*4 + 3] = shape.map[y*w + x] ? 0xe0 : 0; } }