vbox_pointer: fix visibility flag handling

Fixes #2580
This commit is contained in:
Christian Prochaska 2017-11-16 15:04:44 +01:00 committed by Christian Helmuth
parent 5e4b523357
commit c6718677b2
3 changed files with 13 additions and 6 deletions

View File

@ -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<Genode::Pixel_rgb565>());
if (p->shape_visible()) {
Genode::Attached_dataspace ds { _env.rm(), _pointer_ds };
p->draw_shape(ds.local_addr<Genode::Pixel_rgb565>());
}
_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 {

View File

@ -54,6 +54,7 @@ class Vbox_pointer::Policy_entry : public Vbox_pointer::Policy,
Genode::Signal_handler<Policy_entry> _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<Vbox_pointer::Shape_report>();
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
{

View File

@ -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;