~vanvugt/mir/set-subpixel

« back to all changes in this revision

Viewing changes to src/server/graphics/nested/display.cpp

Simplify hardware cursor construction (no parameter required).

Previously hardware cursor implementations were expected to show
on construction with a given image. We now instead hide on construction but show an image immediately after as part of the default configuration policy.

Aside from providing a simpler interface, this is required as a
prerequisite for runtime fallback to the software cursor when the
hardware cursor won't be used (both cursors exist but never more than
one of them shown). This is also a prerequisite to fixing bug 1662760.

Assuming that a hardware cursor might only fail during construction was
a poor design. Going forward we will need to deal with a hardware cursor
that might become unusable or undesirable at any point in its life. Fixes: https://bugs.launchpad.net/bugs/1639226.

Approved by mir-ci-bot, Daniel van Vugt, Chris Halse Rogers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
363
363
    // No need to do anything
364
364
}
365
365
 
366
 
auto mgn::Display::create_hardware_cursor(std::shared_ptr<mg::CursorImage> const& /*initial_image*/) -> std::shared_ptr<mg::Cursor>
 
366
auto mgn::Display::create_hardware_cursor() -> std::shared_ptr<mg::Cursor>
367
367
{
368
368
    BOOST_THROW_EXCEPTION(std::logic_error("Initialization loop: we already need the Cursor when creating the Display"));
369
 
    // So we can't do this: return std::make_shared<Cursor>(connection, initial_image);
 
369
    // So we can't do this: return std::make_shared<Cursor>(connection);
370
370
}
371
371
 
372
372
std::unique_ptr<mg::VirtualOutput> mgn::Display::create_virtual_output(int /*width*/, int /*height*/)