diff --git a/repos/ports/src/app/vbox_pointer/main.cc b/repos/ports/src/app/vbox_pointer/main.cc index ed5ad24439..bae7fe5ce9 100644 --- a/repos/ports/src/app/vbox_pointer/main.cc +++ b/repos/ports/src/app/vbox_pointer/main.cc @@ -160,9 +160,10 @@ void Vbox_pointer::Main::_show_shape_pointer(Policy *p) throw; } - Genode::Attached_dataspace ds { _env.rm(), _pointer_ds }; - - p->draw_shape(ds.local_addr()); + if (p->shape_visible()) { + Genode::Attached_dataspace ds { _env.rm(), _pointer_ds }; + p->draw_shape(ds.local_addr()); + } _nitpicker.framebuffer()->refresh(0, 0, p->shape_size().w(), p->shape_size().h()); @@ -180,7 +181,7 @@ void Vbox_pointer::Main::_update_pointer() if (_xray || !(policy = _policy_registry.lookup(_hovered_label, _hovered_domain)) - || !policy->shape_valid()) + || (policy->shape_visible() && !policy->shape_valid())) _show_default_pointer(); else try { diff --git a/repos/ports/src/app/vbox_pointer/policy.cc b/repos/ports/src/app/vbox_pointer/policy.cc index e2c386b7f8..c3dad33382 100644 --- a/repos/ports/src/app/vbox_pointer/policy.cc +++ b/repos/ports/src/app/vbox_pointer/policy.cc @@ -54,6 +54,7 @@ class Vbox_pointer::Policy_entry : public Vbox_pointer::Policy, Genode::Signal_handler _shape_signal_handler { _env.ep(), *this, &Policy_entry::_import_shape }; + bool _shape_visible; Nitpicker::Area _shape_size; Nitpicker::Point _shape_hot; @@ -72,13 +73,16 @@ class Vbox_pointer::Policy_entry : public Vbox_pointer::Policy, Vbox_pointer::Shape_report *shape_report = _shape_ds.local_addr(); - if (!shape_report->visible + _shape_visible = shape_report->visible; + + if (!_shape_visible || shape_report->width == 0 || shape_report->height == 0 || shape_report->width > Vbox_pointer::MAX_WIDTH || shape_report->height > Vbox_pointer::MAX_HEIGHT) { _shape_size = Nitpicker::Area(); _shape_hot = Nitpicker::Point(); _updater.update_pointer(*this); + return; } _shape_size = Nitpicker::Area(shape_report->width, shape_report->height); @@ -154,7 +158,8 @@ class Vbox_pointer::Policy_entry : public Vbox_pointer::Policy, Nitpicker::Area shape_size() const override { return _shape_size; } Nitpicker::Point shape_hot() const override { return _shape_hot; } - bool shape_valid() const override { return _shape_size.valid(); } + bool shape_visible() const override { return _shape_visible; } + bool shape_valid() const override { return _shape_size.valid(); } void draw_shape(Genode::Pixel_rgb565 *pixel) override { diff --git a/repos/ports/src/app/vbox_pointer/policy.h b/repos/ports/src/app/vbox_pointer/policy.h index cf89779c8d..b0d2822fa5 100644 --- a/repos/ports/src/app/vbox_pointer/policy.h +++ b/repos/ports/src/app/vbox_pointer/policy.h @@ -42,6 +42,7 @@ struct Vbox_pointer::Policy { virtual Nitpicker::Area shape_size() const = 0; virtual Nitpicker::Point shape_hot() const = 0; + virtual bool shape_visible() const = 0; virtual bool shape_valid() const = 0; virtual void draw_shape(Genode::Pixel_rgb565 *pixel) = 0;