Mir

Merge lp:~mir-team/mir/ensure-valid-cursor into lp:mir

Proposed by Robert Carr
Status: Merged
Approved by: Robert Carr
Approved revision: no longer in the source branch.
Merged at revision: 1721
Proposed branch: lp:~mir-team/mir/ensure-valid-cursor
Merge into: lp:mir
Diff against target: 36 lines (+15/-2)
1 file modified
src/server/graphics/default_configuration.cpp (+15/-2)
To merge this branch: bzr merge lp:~mir-team/mir/ensure-valid-cursor
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alberto Aguirre (community) Approve
Kevin DuBois (community) Approve
Review via email: mp+224372@code.launchpad.net

Commit message

Ensure the_cursor() is not null.

fixes: lp: #1334010

Description of the change

Ensure the_cursor() is not null.

fixes: lp: #1334010

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

From IRC discussion, seems the plan is to remove create_hardware_cursor() in the near future, so I'm okay with allocating in the DefaultServerConfiguration. (as opposed to having nested and android make the null objects)

review: Approve
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Sure

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~mir-team/mir/ensure-valid-cursor/+merge/224372/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/default_configuration.cpp'
2--- src/server/graphics/default_configuration.cpp 2014-06-16 14:48:34 +0000
3+++ src/server/graphics/default_configuration.cpp 2014-06-24 21:48:07 +0000
4@@ -27,6 +27,7 @@
5
6 #include "mir/graphics/buffer_initializer.h"
7 #include "mir/graphics/gl_config.h"
8+#include "mir/graphics/cursor.h"
9 #include "program_factory.h"
10
11 #include "mir/shared_library.h"
12@@ -124,11 +125,23 @@
13 std::shared_ptr<mg::Cursor>
14 mir::DefaultServerConfiguration::the_cursor()
15 {
16+ struct NullCursor : public mg::Cursor
17+ {
18+ void show(mg::CursorImage const&) {}
19+ void hide() {}
20+ void move_to(geometry::Point) {}
21+ };
22 return cursor(
23 [this]() -> std::shared_ptr<mg::Cursor>
24 {
25- // For now we only support a hardware cursor.
26- return the_display()->create_hardware_cursor(the_default_cursor_image());
27+ // We try to create a hardware cursor, as we have no software
28+ // cursor currently, if this fails we need to return
29+ // a valid cursor object.
30+ auto hardware_cursor = the_display()->create_hardware_cursor(the_default_cursor_image());
31+ if (hardware_cursor)
32+ return hardware_cursor;
33+ else
34+ return std::make_shared<NullCursor>();
35 });
36 }
37

Subscribers

People subscribed via source and target branches