Mir

Merge lp:~alan-griffiths/mir/resize-examples into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alberto Aguirre
Approved revision: no longer in the source branch.
Merged at revision: 4188
Proposed branch: lp:~alan-griffiths/mir/resize-examples
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/mir_window_get_connection
Diff against target: 514 lines (+222/-124)
10 files modified
examples/client_helpers.cpp (+38/-1)
examples/client_helpers.h (+1/-0)
examples/client_touch_validator.cpp (+4/-1)
examples/eglapp.c (+18/-16)
examples/eglapp.h (+1/-0)
examples/eglsquare.cpp (+120/-100)
examples/multi_stream.cpp (+6/-6)
examples/prerendered_frames.c (+32/-0)
examples/target.c (+1/-0)
src/utils/vanity.c (+1/-0)
To merge this branch: bzr merge lp:~alan-griffiths/mir/resize-examples
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alberto Aguirre (community) Approve
Review via email: mp+325170@code.launchpad.net

Commit message

Fix window resize logic in example code

To post a comment you must log in.
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM.

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

It looks like this would be a pretty common thing a client needs to do:

    mir_render_surface_set_size(surface, new_width, new_height);
    MirWindowSpec* spec = mir_create_window_spec(mir_window_get_connection(window));
    mir_window_spec_add_render_surface(spec, surface, new_width, new_height, 0, 0);
    mir_window_apply_spec(window, spec);
    mir_window_spec_release(spec);

Maybe a convenience api should be introduced? maybe mir_window_resize_content(MirWindow* window, MirRenderSurface* surface, int new_width, int new_height) ? Just a thought...

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4193
https://mir-jenkins.ubuntu.com/job/mir-ci/3444/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4690
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4825
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4815
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4815
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4815
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4727/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4727
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4727/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3444/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/client_helpers.cpp'
--- examples/client_helpers.cpp 2017-05-23 10:51:47 +0000
+++ examples/client_helpers.cpp 2017-06-06 15:58:12 +0000
@@ -51,8 +51,14 @@
51}51}
5252
53mir::examples::NormalWindow::NormalWindow(53mir::examples::NormalWindow::NormalWindow(
54 Connection& connection, unsigned int width, unsigned int height, MirRenderSurface* surface) :
55 window{create_window(connection, width, height, surface), &mir_window_release_sync}
56{
57}
58
59mir::examples::NormalWindow::NormalWindow(
54 mir::examples::Connection& connection, unsigned int width, unsigned int height, mir::examples::Context& eglcontext) :60 mir::examples::Connection& connection, unsigned int width, unsigned int height, mir::examples::Context& eglcontext) :
55 window{create_window(connection, width, height, eglcontext.mir_surface()), &mir_window_release_sync}61 NormalWindow(connection, width, height, eglcontext.mir_surface())
56{62{
57}63}
5864
@@ -61,6 +67,34 @@
61 return window.get();67 return window.get();
62}68}
6369
70namespace
71{
72void handle_window_event(MirWindow* window, MirEvent const* event, void* context)
73{
74 auto const surface = (MirRenderSurface*)context;
75
76 switch (mir_event_get_type(event))
77 {
78 case mir_event_type_resize:
79 {
80 MirResizeEvent const* resize = mir_event_get_resize_event(event);
81 int const new_width = mir_resize_event_get_width(resize);
82 int const new_height = mir_resize_event_get_height(resize);
83
84 mir_render_surface_set_size(surface, new_width, new_height);
85 MirWindowSpec* spec = mir_create_window_spec(mir_window_get_connection(window));
86 mir_window_spec_add_render_surface(spec, surface, new_width, new_height, 0, 0);
87 mir_window_apply_spec(window, spec);
88 mir_window_spec_release(spec);
89 break;
90 }
91
92 default:
93 break;
94 }
95}
96}
97
64MirWindow* me::NormalWindow::create_window(98MirWindow* me::NormalWindow::create_window(
65 MirConnection* connection, unsigned int width, unsigned int height, MirRenderSurface* surface)99 MirConnection* connection, unsigned int width, unsigned int height, MirRenderSurface* surface)
66{100{
@@ -72,7 +106,10 @@
72 mir_window_spec_set_name(spec.get(), __PRETTY_FUNCTION__);106 mir_window_spec_set_name(spec.get(), __PRETTY_FUNCTION__);
73107
74 if (surface)108 if (surface)
109 {
75 mir_window_spec_add_render_surface(spec.get(), surface, width, height, 0, 0);110 mir_window_spec_add_render_surface(spec.get(), surface, width, height, 0, 0);
111 mir_window_spec_set_event_handler(spec.get(), &handle_window_event, surface);
112 }
76113
77 auto window = mir_create_window_sync(spec.get());114 auto window = mir_create_window_sync(spec.get());
78 return window;115 return window;
79116
=== modified file 'examples/client_helpers.h'
--- examples/client_helpers.h 2017-05-26 13:52:51 +0000
+++ examples/client_helpers.h 2017-06-06 15:58:12 +0000
@@ -86,6 +86,7 @@
86public:86public:
87 NormalWindow(Connection& connection, unsigned int width, unsigned int height);87 NormalWindow(Connection& connection, unsigned int width, unsigned int height);
88 NormalWindow(Connection& connection, unsigned int width, unsigned int height, Context& eglcontext);88 NormalWindow(Connection& connection, unsigned int width, unsigned int height, Context& eglcontext);
89 NormalWindow(Connection& connection, unsigned int width, unsigned int height, MirRenderSurface* surface);
8990
90 operator MirWindow*() const;91 operator MirWindow*() const;
91private:92private:
9293
=== modified file 'examples/client_touch_validator.cpp'
--- examples/client_touch_validator.cpp 2017-05-08 03:04:26 +0000
+++ examples/client_touch_validator.cpp 2017-06-06 15:58:12 +0000
@@ -134,7 +134,7 @@
134 state->record_event(tev);134 state->record_event(tev);
135}135}
136 136
137void on_event(MirWindow * /*surface*/, const MirEvent *event, void *context)137void on_event(MirWindow *window, const MirEvent *event, void *context)
138{138{
139 TouchState *state = (TouchState*)context;139 TouchState *state = (TouchState*)context;
140140
@@ -143,6 +143,9 @@
143 case mir_event_type_input:143 case mir_event_type_input:
144 on_input_event(state, mir_event_get_input_event(event));144 on_input_event(state, mir_event_get_input_event(event));
145 break;145 break;
146 case mir_event_type_resize:
147 egl_app_handle_resize_event(window, mir_event_get_resize_event(event));
148 break;
146 case mir_event_type_close_window:149 case mir_event_type_close_window:
147 abort();150 abort();
148 break;151 break;
149152
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2017-05-19 16:18:30 +0000
+++ examples/eglapp.c 2017-06-06 15:58:12 +0000
@@ -183,13 +183,24 @@
183 * support for event queuing (directing them to another thread) or183 * support for event queuing (directing them to another thread) or
184 * full single-threaded callbacks. (LP: #1194384).184 * full single-threaded callbacks. (LP: #1194384).
185 */185 */
186 {186 egl_app_handle_resize_event(window, mir_event_get_resize_event(ev));
187 MirResizeEvent const* resize = mir_event_get_resize_event(ev);187 break;
188 int const new_width = mir_resize_event_get_width(resize);188 case mir_event_type_close_window:
189 int const new_height = mir_resize_event_get_height(resize);189 printf("Received close event from server.\n");
190190 running = 0;
191 printf("Resized to %dx%d\n", new_width, new_height);191 break;
192 if (surface)192 default:
193 break;
194 }
195}
196
197void egl_app_handle_resize_event(MirWindow* window, MirResizeEvent const* resize)
198{
199 int const new_width = mir_resize_event_get_width(resize);
200 int const new_height = mir_resize_event_get_height(resize);
201
202 printf("Resized to %dx%d\n", new_width, new_height);
203 if (surface)
193 {204 {
194 mir_render_surface_set_size(surface, new_width, new_height);205 mir_render_surface_set_size(surface, new_width, new_height);
195 MirWindowSpec* spec = mir_create_window_spec(connection);206 MirWindowSpec* spec = mir_create_window_spec(connection);
@@ -197,15 +208,6 @@
197 mir_window_apply_spec(window, spec);208 mir_window_apply_spec(window, spec);
198 mir_window_spec_release(spec);209 mir_window_spec_release(spec);
199 }210 }
200 }
201 break;
202 case mir_event_type_close_window:
203 printf("Received close event from server.\n");
204 running = 0;
205 break;
206 default:
207 break;
208 }
209}211}
210212
211static void show_help(struct mir_eglapp_arg const* const* arg_lists)213static void show_help(struct mir_eglapp_arg const* const* arg_lists)
212214
=== modified file 'examples/eglapp.h'
--- examples/eglapp.h 2017-05-08 03:04:26 +0000
+++ examples/eglapp.h 2017-06-06 15:58:12 +0000
@@ -45,6 +45,7 @@
45mir_eglapp_bool mir_eglapp_running(void);45mir_eglapp_bool mir_eglapp_running(void);
46void mir_eglapp_cleanup(void);46void mir_eglapp_cleanup(void);
47void mir_eglapp_handle_event(MirWindow* window, MirEvent const* ev, void* unused);47void mir_eglapp_handle_event(MirWindow* window, MirEvent const* ev, void* unused);
48void egl_app_handle_resize_event(MirWindow* window, MirResizeEvent const* resize);
48double mir_eglapp_display_hz(void);49double mir_eglapp_display_hz(void);
4950
50MirConnection* mir_eglapp_native_connection();51MirConnection* mir_eglapp_native_connection();
5152
=== modified file 'examples/eglsquare.cpp'
--- examples/eglsquare.cpp 2017-06-05 09:37:52 +0000
+++ examples/eglsquare.cpp 2017-06-06 15:58:12 +0000
@@ -127,106 +127,126 @@
127 if (worker.joinable()) worker.join();127 if (worker.joinable()) worker.join();
128 }128 }
129129
130 void on_event(MirEvent const* ev)130 void on_event(MirEvent const* event)
131 {131 {
132 if (mir_event_get_type(ev) != mir_event_type_input)132 switch (mir_event_get_type(event))
133 return;133 {
134 float x{0.0f};134 case mir_event_type_resize:
135 float y{0.0f};135 {
136 auto ievent = mir_event_get_input_event(ev);136 MirResizeEvent const* resize = mir_event_get_resize_event(event);
137 if (mir_input_event_get_type(ievent) == mir_input_event_type_touch)137 int const new_width = mir_resize_event_get_width(resize);
138 {138 int const new_height = mir_resize_event_get_height(resize);
139 auto tev = mir_input_event_get_touch_event(ievent);139
140 x = mir_touch_event_axis_value(tev, 0, mir_touch_axis_x);140 mir_render_surface_set_size(context.mir_surface(), new_width, new_height);
141 y = mir_touch_event_axis_value(tev, 0, mir_touch_axis_y);141 MirWindowSpec* spec = mir_create_window_spec(mir_window_get_connection(window));
142 }142 mir_window_spec_add_render_surface(spec, context.mir_surface(), new_width, new_height, 0, 0);
143 else if (mir_input_event_get_type(ievent) == mir_input_event_type_pointer)143 mir_window_apply_spec(window, spec);
144 {144 mir_window_spec_release(spec);
145 auto pev = mir_input_event_get_pointer_event(ievent);145 break;
146 x = mir_pointer_event_axis_value(pev, mir_pointer_axis_x);146 }
147 y = mir_pointer_event_axis_value(pev, mir_pointer_axis_y);147
148 }148 case mir_event_type_input:
149 else149 {
150 {150 float x{0.0f};
151 return;151 float y{0.0f};
152 }152 auto ievent = mir_event_get_input_event(event);
153153 if (mir_input_event_get_type(ievent) == mir_input_event_type_touch)
154 pos = Pos{x, y};154 {
155 cv.notify_one();155 auto tev = mir_input_event_get_touch_event(ievent);
156 }156 x = mir_touch_event_axis_value(tev, 0, mir_touch_axis_x);
157157 y = mir_touch_event_axis_value(tev, 0, mir_touch_axis_y);
158 SquareRenderingSurface(SquareRenderingSurface const&) = delete;158 }
159 SquareRenderingSurface& operator=(SquareRenderingSurface const&) = delete;159 else if (mir_input_event_get_type(ievent) == mir_input_event_type_pointer)
160private:160 {
161 struct OutputDimensions161 auto pev = mir_input_event_get_pointer_event(ievent);
162 {162 x = mir_pointer_event_axis_value(pev, mir_pointer_axis_x);
163 unsigned int const width;163 y = mir_pointer_event_axis_value(pev, mir_pointer_axis_y);
164 unsigned int const height;164 }
165 } const dimensions;165 else
166166 {
167 me::Context context;167 return;
168 me::NormalWindow window;168 }
169 RenderProgram program;169
170170 pos = Pos{x, y};
171 OutputDimensions active_output_dimensions(MirConnection* connection)171 cv.notify_one();
172 {172 }
173 unsigned int width{0};173
174 unsigned int height{0};174 default:;
175 auto display_config = mir_connection_create_display_configuration(connection);175 }
176 auto num_outputs = mir_display_config_get_num_outputs(display_config);176 }
177 for (auto i = 0; i < num_outputs; i++)177
178 {178 SquareRenderingSurface(SquareRenderingSurface const&) = delete;
179 auto output = mir_display_config_get_output(display_config, i);179 SquareRenderingSurface& operator=(SquareRenderingSurface const&) = delete;
180 auto state = mir_output_get_connection_state(output);180 private:
181 if (state == mir_output_connection_state_connected && mir_output_is_enabled(output))181 struct OutputDimensions
182 {182 {
183 auto mode = mir_output_get_current_mode(output);183 unsigned int const width;
184 width = mir_output_mode_get_width(mode);184 unsigned int const height;
185 height = mir_output_mode_get_height(mode);185 } const dimensions;
186 break;186
187 }187 me::Context context;
188 }188 me::NormalWindow window;
189 mir_display_config_release(display_config);189 RenderProgram program;
190 if (width == 0 || height == 0)190
191 throw std::logic_error("could not determine display size");191 OutputDimensions active_output_dimensions(MirConnection* connection)
192 return {width, height};192 {
193 }193 unsigned int width{0};
194194 unsigned int height{0};
195 static void on_event(MirWindow*, const MirEvent *event, void *context)195 auto display_config = mir_connection_create_display_configuration(connection);
196 {196 auto num_outputs = mir_display_config_get_num_outputs(display_config);
197 auto surface = reinterpret_cast<SquareRenderingSurface*>(context);197 for (auto i = 0; i < num_outputs; i++)
198 if (surface) surface->on_event(event);198 {
199 }199 auto output = mir_display_config_get_output(display_config, i);
200200 auto state = mir_output_get_connection_state(output);
201private:201 if (state == mir_output_connection_state_connected && mir_output_is_enabled(output))
202 void do_work()202 {
203 {203 auto mode = mir_output_get_current_mode(output);
204 std::unique_lock<decltype(mutex)> lock(mutex);204 width = mir_output_mode_get_width(mode);
205205 height = mir_output_mode_get_height(mode);
206 while (true)206 break;
207 {207 }
208 cv.wait(lock);208 }
209209 mir_display_config_release(display_config);
210 if (!running) return;210 if (width == 0 || height == 0)
211211 throw std::logic_error("could not determine display size");
212 Pos pos = this->pos;212 return {width, height};
213213 }
214 context.make_current();214
215 program.draw(215 static void on_event(MirWindow*, const MirEvent *event, void *context)
216 pos.x/static_cast<float>(dimensions.width)*2.0 - 1.0,216 {
217 pos.y/static_cast<float>(dimensions.height)*-2.0 + 1.0);217 auto surface = reinterpret_cast<SquareRenderingSurface*>(context);
218 context.swapbuffers();218 if (surface) surface->on_event(event);
219 }219 }
220 }220
221221 private:
222 struct Pos { float x; float y; };222 void do_work()
223 std::atomic<Pos> pos;223 {
224224 std::unique_lock<decltype(mutex)> lock(mutex);
225 std::thread worker;225
226 std::condition_variable cv;226 while (true)
227 std::mutex mutex;227 {
228 bool running{true};228 cv.wait(lock);
229};229
230 if (!running) return;
231
232 Pos pos = this->pos;
233
234 context.make_current();
235 program.draw(
236 pos.x/static_cast<float>(dimensions.width)*2.0 - 1.0,
237 pos.y/static_cast<float>(dimensions.height)*-2.0 + 1.0);
238 context.swapbuffers();
239 }
240 }
241
242 struct Pos { float x; float y; };
243 std::atomic<Pos> pos;
244
245 std::thread worker;
246 std::condition_variable cv;
247 std::mutex mutex;
248 bool running{true};
249 };
230}250}
231251
232int main(int argc, char *argv[])252int main(int argc, char *argv[])
233253
=== modified file 'examples/multi_stream.cpp'
--- examples/multi_stream.cpp 2017-05-23 10:51:47 +0000
+++ examples/multi_stream.cpp 2017-06-06 15:58:12 +0000
@@ -49,8 +49,6 @@
4949
50 int displacement_x{0};50 int displacement_x{0};
51 int displacement_y{0};51 int displacement_y{0};
52 int width{0};
53 int height{0};
5452
55 MyBufferStream& operator=(MyBufferStream &&) = default;53 MyBufferStream& operator=(MyBufferStream &&) = default;
56 MyBufferStream(MyBufferStream &&) = default;54 MyBufferStream(MyBufferStream &&) = default;
@@ -278,7 +276,7 @@
278 0276 0
279 };277 };
280278
281 me::NormalWindow window{connection, 200, 200};279 me::NormalWindow window{connection, 200, 200, stream[0]};
282280
283 while (poll(&signal_poll, 1, 0) <= 0)281 while (poll(&signal_poll, 1, 0) <= 0)
284 {282 {
@@ -302,8 +300,12 @@
302 auto spec = mir_create_window_spec(connection);300 auto spec = mir_create_window_spec(connection);
303 for (auto& s : stream)301 for (auto& s : stream)
304 {302 {
303 int width{0};
304 int height{0};
305 mir_render_surface_get_size(s, &width, &height);
306
305 mir_buffer_stream_swap_buffers_sync(s);307 mir_buffer_stream_swap_buffers_sync(s);
306 mir_window_spec_add_render_surface(spec, s, s.width, s.height, s.displacement_x, s.displacement_y);308 mir_window_spec_add_render_surface(spec, s, width, height, s.displacement_x, s.displacement_y);
307 }309 }
308 mir_window_apply_spec(window, spec);310 mir_window_apply_spec(window, spec);
309 mir_window_spec_release(spec);311 mir_window_spec_release(spec);
@@ -322,8 +324,6 @@
322 int displacement_y)324 int displacement_y)
323 : displacement_x{displacement_x},325 : displacement_x{displacement_x},
324 displacement_y{displacement_y},326 displacement_y{displacement_y},
325 width{width},
326 height{height},
327 stream{mir_connection_create_render_surface_sync(connection, width, height), &mir_render_surface_release},327 stream{mir_connection_create_render_surface_sync(connection, width, height), &mir_render_surface_release},
328 bs{get_stream(connection, width, height)}328 bs{get_stream(connection, width, height)}
329{329{
330330
=== modified file 'examples/prerendered_frames.c'
--- examples/prerendered_frames.c 2017-05-19 13:49:04 +0000
+++ examples/prerendered_frames.c 2017-06-06 15:58:12 +0000
@@ -92,6 +92,36 @@
92 rendering = 0;92 rendering = 0;
93}93}
9494
95static void handle_window_event(MirWindow* window, MirEvent const* event, void* context)
96{
97 MirRenderSurface* const surface = (MirRenderSurface*)context;
98
99 switch (mir_event_get_type(event))
100 {
101 case mir_event_type_resize:
102 {
103 MirResizeEvent const* resize = mir_event_get_resize_event(event);
104 int const new_width = mir_resize_event_get_width(resize);
105 int const new_height = mir_resize_event_get_height(resize);
106
107 mir_render_surface_set_size(surface, new_width, new_height);
108 MirWindowSpec* spec = mir_create_window_spec(mir_window_get_connection(window));
109 mir_window_spec_add_render_surface(spec, surface, new_width, new_height, 0, 0);
110 mir_window_apply_spec(window, spec);
111 mir_window_spec_release(spec);
112 break;
113 }
114
115 case mir_event_type_close_window:
116 printf("Received close event from server.\n");
117 rendering = 0;
118 break;
119
120 default:
121 break;
122 }
123}
124
95int main(int argc, char** argv)125int main(int argc, char** argv)
96{126{
97 static char const *socket_file = NULL;127 static char const *socket_file = NULL;
@@ -165,6 +195,8 @@
165 MirWindowSpec* spec = mir_create_normal_window_spec(connection, width, height);195 MirWindowSpec* spec = mir_create_normal_window_spec(connection, width, height);
166 mir_window_spec_add_render_surface(196 mir_window_spec_add_render_surface(
167 spec, surface, width, height, displacement_x, displacement_y);197 spec, surface, width, height, displacement_x, displacement_y);
198 mir_window_spec_set_event_handler(spec, &handle_window_event, surface);
199 mir_window_spec_set_name(spec, "prerendered_frames");
168 MirWindow* window = mir_create_window_sync(spec);200 MirWindow* window = mir_create_window_sync(spec);
169 if (!mir_window_is_valid(window))201 if (!mir_window_is_valid(window))
170 {202 {
171203
=== modified file 'examples/target.c'
--- examples/target.c 2017-05-08 03:04:26 +0000
+++ examples/target.c 2017-06-06 15:58:12 +0000
@@ -196,6 +196,7 @@
196 get_all_touch_points(mir_event_get_input_event(event), &state->touch);196 get_all_touch_points(mir_event_get_input_event(event), &state->touch);
197 break;197 break;
198 case mir_event_type_resize:198 case mir_event_type_resize:
199 egl_app_handle_resize_event(surface, mir_event_get_resize_event(event));
199 state->resized = true;200 state->resized = true;
200 break;201 break;
201 case mir_event_type_close_window:202 case mir_event_type_close_window:
202203
=== modified file 'src/utils/vanity.c'
--- src/utils/vanity.c 2017-05-08 03:04:26 +0000
+++ src/utils/vanity.c 2017-06-06 15:58:12 +0000
@@ -176,6 +176,7 @@
176 handled = on_surface_event(mir_event_get_window_event(event), state);176 handled = on_surface_event(mir_event_get_window_event(event), state);
177 break;177 break;
178 case mir_event_type_resize:178 case mir_event_type_resize:
179 egl_app_handle_resize_event(surface, mir_event_get_resize_event(event));
179 state->resized = true;180 state->resized = true;
180 break;181 break;
181 default:182 default:

Subscribers

People subscribed via source and target branches