~mir-team/miral/changelog

« back to all changes in this revision

Viewing changes to miral/cursor_theme.cpp

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2017-06-20 09:24:56 UTC
  • mfrom: (555.1.2 miral3)
  • Revision ID: tarmac-20170620092456-30jsoim7yuvgm69q
Make cursor theme configurable. Fixes: https://bugs.launchpad.net/bugs/1625853.

Approved by mir-ci-bot, Gerry Boland.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "miral/cursor_theme.h"
20
20
#include "xcursor_loader.h"
21
21
 
 
22
#include <mir/options/option.h>
22
23
#include <mir/server.h>
23
24
#include <mir_toolkit/cursors.h>
24
25
 
43
44
 
44
45
void miral::CursorTheme::operator()(mir::Server& server) const
45
46
{
 
47
    static char const* const option = "cursor-theme";
 
48
 
 
49
    server.add_configuration_option(option, "Cursor theme (e.g. \"DMZ-Black\")", theme);
 
50
 
46
51
    server.override_the_cursor_images([&]
47
52
        {
 
53
            auto const theme = server.get_options()->get<std::string const>(option);
 
54
 
48
55
            std::shared_ptr<mi::CursorImages> const xcursor_loader{std::make_shared<XCursorLoader>(theme)};
49
56
 
50
57
            if (has_default_cursor(*xcursor_loader))