~vanvugt/mir/fix-1315302

« back to all changes in this revision

Viewing changes to src/server/graphics/default_configuration.cpp

Extract cursor image from the builtin cursor in preparation for client cursor API.

Approved by PS Jenkins bot, Alberto Aguirre, Chris Halse Rogers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
#include <boost/throw_exception.hpp>
37
37
 
 
38
#include "builtin_cursor_images.h"
 
39
 
38
40
#include <map>
39
41
 
40
42
namespace mg = mir::graphics;
116
118
        });
117
119
}
118
120
 
 
121
std::shared_ptr<mg::Cursor>
 
122
mir::DefaultServerConfiguration::the_cursor()
 
123
{
 
124
    return cursor(
 
125
        [this]() -> std::shared_ptr<mg::Cursor>
 
126
        {
 
127
            // For now we only support a hardware cursor.
 
128
            return the_display()->create_hardware_cursor(the_default_cursor_image());
 
129
        });
 
130
}
 
131
 
 
132
std::shared_ptr<mg::CursorImage>
 
133
mir::DefaultServerConfiguration::the_default_cursor_image()
 
134
{
 
135
    static geometry::Size const default_cursor_size = {geometry::Width{64},
 
136
                                                       geometry::Height{64}};
 
137
    return default_cursor_image(
 
138
        [this]()
 
139
        {
 
140
            return the_cursor_images()->image("arrow", default_cursor_size);
 
141
        });
 
142
}
 
143
 
 
144
std::shared_ptr<mg::CursorImages>
 
145
mir::DefaultServerConfiguration::the_cursor_images()
 
146
{
 
147
    return cursor_images(
 
148
        [this]()
 
149
        {
 
150
            return std::make_shared<mg::BuiltinCursorImages>();
 
151
        });
 
152
}
 
153
 
119
154
auto mir::DefaultServerConfiguration::the_host_connection()
120
155
-> std::shared_ptr<graphics::nested::HostConnection>
121
156
{