Merge lp:~dandrader/qtmir/controlMirCursor into lp:qtmir

Proposed by Andreas Pokorny
Status: Work in progress
Proposed branch: lp:~dandrader/qtmir/controlMirCursor
Merge into: lp:qtmir
Diff against target: 146 lines (+42/-7)
3 files modified
src/platforms/mirserver/miropenglcontext.cpp (+14/-2)
src/platforms/mirserver/mirserver.cpp (+28/-4)
src/platforms/mirserver/offscreensurface.cpp (+0/-1)
To merge this branch: bzr merge lp:~dandrader/qtmir/controlMirCursor
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+305450@code.launchpad.net

Commit message

WIP

Description of the change

No request for review yet. Just an integration test to make use of the new mir nested cursor mode.

To post a comment you must log in.

Unmerged revisions

550. By Daniel d'Andrada

WIP

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/mirserver/miropenglcontext.cpp'
2--- src/platforms/mirserver/miropenglcontext.cpp 2016-06-07 19:30:06 +0000
3+++ src/platforms/mirserver/miropenglcontext.cpp 2016-09-12 09:40:37 +0000
4@@ -29,7 +29,19 @@
5
6 // Mir
7 #include <mir/graphics/display.h>
8-#include <mir/graphics/gl_context.h>
9+#include <mir/renderer/gl/context.h>
10+#include <mir/renderer/gl/context_source.h>
11+
12+namespace
13+{
14+auto as_context_source(mir::graphics::Display* display)
15+{
16+ auto const ctx = dynamic_cast<mir::renderer::gl::ContextSource*>(display->native_display());
17+ if (!ctx)
18+ throw std::logic_error("Display does not support GL rendering");
19+ return ctx;
20+}
21+}
22
23 // Qt supports one GL context per screen, but also shared contexts.
24 // The Mir "Display" generates a shared GL context for all DisplayBuffers
25@@ -45,7 +57,7 @@
26 #endif
27 {
28 // create a temporary GL context to fetch the EGL display and config, so Qt can determine the surface format
29- std::unique_ptr<mir::graphics::GLContext> mirContext = display.create_gl_context();
30+ std::unique_ptr<mir::renderer::gl::Context> mirContext = as_context_source(&display)->create_gl_context();
31 mirContext->make_current();
32
33 EGLDisplay eglDisplay = eglGetCurrentDisplay();
34
35=== modified file 'src/platforms/mirserver/mirserver.cpp'
36--- src/platforms/mirserver/mirserver.cpp 2016-05-19 13:45:08 +0000
37+++ src/platforms/mirserver/mirserver.cpp 2016-09-12 09:40:37 +0000
38@@ -42,16 +42,27 @@
39
40 // mir
41 #include <mir/graphics/cursor.h>
42+#include <mir/input/cursor_listener.h>
43
44 namespace mg = mir::graphics;
45 namespace mo = mir::options;
46 namespace msh = mir::shell;
47 namespace ms = mir::scene;
48
49+/*
50 namespace
51 {
52+
53 void usingHiddenCursor(mir::Server& server);
54+
55+class NullCursorListener : public mir::input::CursorListener
56+{
57+public:
58+ void cursor_moved_to(float, float) override {}
59+};
60+
61 }
62+*/
63
64 MirServer::MirServer(int &argc, char **argv,
65 const QSharedPointer<ScreensModel> &screensModel, QObject* parent)
66@@ -89,10 +100,12 @@
67 return std::make_shared<QtCompositor>();
68 });
69
70+ /*
71 override_the_cursor_images([]
72 {
73 return std::make_shared<qtmir::MirCursorImages>();
74 });
75+ */
76
77 override_the_input_dispatcher([&screensModel]
78 {
79@@ -118,6 +131,13 @@
80 return windowManager;
81 });
82
83+ /*
84+ wrap_cursor_listener([](const std::shared_ptr<mir::input::CursorListener> &)
85+ {
86+ return std::make_shared<NullCursorListener>();
87+ });
88+ */
89+
90 wrap_display_configuration_policy(
91 [](const std::shared_ptr<mg::DisplayConfigurationPolicy> &wrapped)
92 -> std::shared_ptr<mg::DisplayConfigurationPolicy>
93@@ -135,7 +155,7 @@
94 screensModel->init(the_display(), the_compositor());
95 });
96
97- usingHiddenCursor(*this);
98+ //usingHiddenCursor(*this);
99
100 try {
101 apply_settings();
102@@ -144,6 +164,8 @@
103 exit(1);
104 }
105
106+ the_cursor()->show();
107+
108 if (!unknownArgsFound) { // mir parsed all the arguments, so edit argv to pretend to have just argv[0]
109 argc = 1;
110 }
111@@ -210,14 +232,15 @@
112 return m_windowManager.lock().get();
113 }
114
115+#if 0
116 namespace
117 {
118 struct HiddenCursorWrapper : mg::Cursor
119 {
120 HiddenCursorWrapper(std::shared_ptr<mg::Cursor> const& wrapped) :
121- wrapped{wrapped} { wrapped->hide(); }
122- void show() override { }
123- void show(mg::CursorImage const&) override { }
124+ wrapped{wrapped} { /*wrapped->hide();*/ }
125+ void show() override { wrapped->show(); }
126+ void show(mg::CursorImage const& img) override { wrapped->show(img); }
127 void hide() override { wrapped->hide(); }
128
129 void move_to(mir::geometry::Point position) override { wrapped->move_to(position); }
130@@ -232,3 +255,4 @@
131 { return std::make_shared<HiddenCursorWrapper>(wrapped); });
132 };
133 }
134+#endif
135
136=== modified file 'src/platforms/mirserver/offscreensurface.cpp'
137--- src/platforms/mirserver/offscreensurface.cpp 2016-05-05 15:12:09 +0000
138+++ src/platforms/mirserver/offscreensurface.cpp 2016-09-12 09:40:37 +0000
139@@ -18,7 +18,6 @@
140
141 // Mir
142 #include <mir/graphics/display.h>
143-#include <mir/graphics/gl_context.h>
144
145 //Qt
146 #include <QOffscreenSurface>

Subscribers

People subscribed via source and target branches