Mir

Merge lp:~mir-team/mir/trunk-0.1.9 into lp:mir/ubuntu

Proposed by kevin gunn
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 1185
Proposed branch: lp:~mir-team/mir/trunk-0.1.9
Merge into: lp:mir/ubuntu
Diff against target: 17708 lines (+6697/-4393)
254 files modified
CMakeLists.txt (+1/-9)
cmake/FindGtest.cmake (+1/-1)
cmake/LinuxCrossCompile.cmake (+0/-1)
cmake/MirCommon.cmake (+1/-1)
debian/changelog (+45/-0)
debian/control (+2/-2)
debian/create_postinst_prerm_scripts.sh (+12/-3)
debian/install_ld_so_conf.sh (+11/-3)
debian/libmirserver19.install (+1/-1)
debian/rules (+3/-2)
doc/Doxyfile.in (+4/-4)
examples/CMakeLists.txt (+6/-0)
examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+4/-3)
examples/demo-shell/demo_renderer.cpp (+37/-28)
examples/demo-shell/demo_renderer.h (+2/-1)
examples/demo-shell/demo_shell.cpp (+13/-6)
examples/demo-shell/fullscreen_placement_strategy.cpp (+4/-3)
examples/demo-shell/fullscreen_placement_strategy.h (+3/-3)
examples/demo-shell/window_manager.cpp (+4/-5)
examples/eglcounter.cpp (+281/-0)
examples/render_overlays.cpp (+5/-0)
examples/render_surfaces.cpp (+5/-6)
include/client/mir_toolkit/mir_client_library.h (+4/-391)
include/client/mir_toolkit/mir_connection.h (+178/-0)
include/client/mir_toolkit/mir_surface.h (+254/-0)
include/client/mir_toolkit/mir_wait.h (+55/-0)
include/platform/mir/graphics/gl_program_factory.h (+50/-0)
include/platform/mir/graphics/renderable.h (+8/-0)
include/server/mir/compositor/gl_renderer.h (+11/-8)
include/server/mir/compositor/renderer.h (+1/-5)
include/server/mir/compositor/scene.h (+0/-35)
include/server/mir/default_server_configuration.h (+10/-14)
include/server/mir/frontend/session.h (+2/-5)
include/server/mir/frontend/shell.h (+4/-3)
include/server/mir/frontend/surface.h (+0/-2)
include/server/mir/graphics/gl_program.h (+65/-0)
include/server/mir/input/input_targets.h (+2/-2)
include/server/mir/input/surface.h (+6/-0)
include/server/mir/scene/null_session_listener.h (+6/-9)
include/server/mir/scene/placement_strategy.h (+7/-11)
include/server/mir/scene/session.h (+6/-5)
include/server/mir/scene/session_listener.h (+6/-6)
include/server/mir/scene/snapshot.h (+1/-1)
include/server/mir/scene/surface.h (+28/-11)
include/server/mir/scene/surface_buffer_access.h (+5/-5)
include/server/mir/scene/surface_coordinator.h (+7/-10)
include/server/mir/scene/surface_creation_parameters.h (+4/-4)
include/server/mir/scene/surface_event_source.h (+2/-2)
include/server/mir/scene/surface_factory.h (+2/-3)
include/server/mir/scene/surface_observer.h (+15/-4)
include/server/mir/scene/surface_ranker.h (+0/-46)
include/server/mir/shell/focus_controller.h (+4/-3)
include/server/mir/shell/focus_setter.h (+3/-3)
include/server/mir/shell/surface.h (+0/-62)
include/server/mir/shell/surface_factory.h (+0/-53)
include/test/mir_test/spin_wait.h (+38/-0)
include/test/mir_test/wait_condition.h (+11/-4)
include/test/mir_test_doubles/fake_renderable.h (+5/-0)
include/test/mir_test_doubles/mock_buffer_stream.h (+14/-1)
include/test/mir_test_doubles/mock_focus_setter.h (+1/-1)
include/test/mir_test_doubles/mock_framebuffer_bundle.h (+1/-0)
include/test/mir_test_doubles/mock_input_surface.h (+6/-2)
include/test/mir_test_doubles/mock_render_function.h.moved (+0/-40)
include/test/mir_test_doubles/mock_renderable.h (+1/-0)
include/test/mir_test_doubles/mock_renderer.h (+1/-1)
include/test/mir_test_doubles/mock_scene.h (+0/-2)
include/test/mir_test_doubles/mock_scene_session.h (+8/-8)
include/test/mir_test_doubles/mock_session.h (+2/-2)
include/test/mir_test_doubles/mock_session_listener.h (+7/-7)
include/test/mir_test_doubles/mock_shell.h (+2/-2)
include/test/mir_test_doubles/mock_surface.h (+1/-2)
include/test/mir_test_doubles/mock_surface_coordinator.h (+12/-6)
include/test/mir_test_doubles/mock_surface_factory.h (+0/-48)
include/test/mir_test_doubles/null_display_buffer_compositor_factory.h (+52/-0)
include/test/mir_test_doubles/null_event_filter.h (+40/-0)
include/test/mir_test_doubles/null_session_event_sink.h (+2/-2)
include/test/mir_test_doubles/null_snapshot_strategy.h (+3/-2)
include/test/mir_test_doubles/stub_host_connection.h (+72/-0)
include/test/mir_test_doubles/stub_input_targets.h (+42/-0)
include/test/mir_test_doubles/stub_renderable.h (+4/-0)
include/test/mir_test_doubles/stub_renderer.h (+4/-2)
include/test/mir_test_doubles/stub_scene_session.h (+9/-13)
include/test/mir_test_doubles/stub_session.h (+8/-22)
include/test/mir_test_doubles/stub_shell.h (+1/-1)
include/test/mir_test_framework/declarative_placement_strategy.h (+5/-5)
include/test/mir_test_framework/display_server_test_fixture.h (+1/-0)
include/test/mir_test_framework/testing_process_manager.h (+1/-0)
src/client/CMakeLists.txt (+4/-1)
src/client/android/client_surface_interpreter.cpp (+2/-0)
src/client/error_connections.cpp (+55/-0)
src/client/error_connections.h (+52/-0)
src/client/mir_client_library.cpp (+0/-546)
src/client/mir_connection_api.cpp (+312/-0)
src/client/mir_surface_api.cpp (+258/-0)
src/client/mir_wait_api.cpp (+32/-0)
src/platform/graphics/android/android_display.cpp (+8/-1)
src/platform/graphics/android/android_display.h (+2/-0)
src/platform/graphics/android/display_buffer.cpp (+1/-1)
src/platform/graphics/android/framebuffer_bundle.h (+1/-0)
src/platform/graphics/android/framebuffers.cpp (+16/-5)
src/platform/graphics/android/framebuffers.h (+3/-1)
src/platform/graphics/android/internal_client_window.cpp (+2/-0)
src/platform/graphics/android/server_render_window.cpp (+2/-0)
src/platform/graphics/mesa/display.cpp (+9/-1)
src/platform/graphics/mesa/real_kms_display_configuration.cpp (+19/-3)
src/platform/graphics/mesa/real_kms_output.cpp (+1/-0)
src/platform/graphics/overlapping_output_grouping.cpp (+1/-0)
src/server/CMakeLists.txt (+1/-1)
src/server/compositor/CMakeLists.txt (+0/-1)
src/server/compositor/bypass.cpp (+25/-56)
src/server/compositor/bypass.h (+10/-22)
src/server/compositor/default_configuration.cpp (+2/-2)
src/server/compositor/default_display_buffer_compositor.cpp (+16/-54)
src/server/compositor/gl_renderer.cpp (+34/-111)
src/server/compositor/gl_renderer_factory.cpp (+9/-2)
src/server/compositor/gl_renderer_factory.h (+7/-1)
src/server/compositor/multi_threaded_compositor.cpp (+206/-73)
src/server/compositor/multi_threaded_compositor.h (+13/-2)
src/server/compositor/rendering_operator.cpp (+0/-37)
src/server/compositor/rendering_operator.h (+0/-49)
src/server/compositor/switching_bundle.cpp (+17/-7)
src/server/default_server_configuration.cpp (+5/-5)
src/server/frontend/published_socket_connector.cpp (+65/-1)
src/server/frontend/session_mediator.cpp (+5/-4)
src/server/graphics/CMakeLists.txt (+2/-0)
src/server/graphics/default_configuration.cpp (+13/-2)
src/server/graphics/gl_program.cpp (+109/-0)
src/server/graphics/nested/CMakeLists.txt (+1/-1)
src/server/graphics/nested/host_connection.cpp (+0/-32)
src/server/graphics/nested/host_connection.h (+38/-12)
src/server/graphics/nested/mir_api_wrappers.h (+0/-66)
src/server/graphics/nested/mir_client_host_connection.cpp (+169/-0)
src/server/graphics/nested/mir_client_host_connection.h (+60/-0)
src/server/graphics/nested/nested_display.cpp (+21/-41)
src/server/graphics/nested/nested_display.h (+3/-2)
src/server/graphics/nested/nested_display_configuration.cpp (+9/-10)
src/server/graphics/nested/nested_display_configuration.h (+7/-5)
src/server/graphics/nested/nested_output.cpp (+5/-16)
src/server/graphics/nested/nested_output.h (+4/-19)
src/server/graphics/nested/nested_platform.cpp (+4/-38)
src/server/graphics/program_factory.cpp (+32/-0)
src/server/graphics/program_factory.h (+47/-0)
src/server/input/android/android_input_target_enumerator.cpp (+3/-2)
src/server/scene/CMakeLists.txt (+3/-0)
src/server/scene/application_session.cpp (+20/-28)
src/server/scene/application_session.h (+14/-18)
src/server/scene/basic_surface.cpp (+67/-56)
src/server/scene/basic_surface.h (+8/-22)
src/server/scene/broadcasting_session_event_sink.cpp (+6/-7)
src/server/scene/broadcasting_session_event_sink.h (+6/-6)
src/server/scene/default_configuration.cpp (+7/-18)
src/server/scene/default_session_container.cpp (+6/-7)
src/server/scene/default_session_container.h (+5/-5)
src/server/scene/global_event_sender.cpp (+2/-3)
src/server/scene/legacy_surface_change_notification.cpp (+55/-0)
src/server/scene/legacy_surface_change_notification.h (+51/-0)
src/server/scene/mediating_display_changer.cpp (+4/-5)
src/server/scene/session_container.h (+6/-6)
src/server/scene/session_event_handler_register.h (+4/-4)
src/server/scene/session_event_sink.h (+4/-4)
src/server/scene/session_manager.cpp (+35/-37)
src/server/scene/session_manager.h (+22/-21)
src/server/scene/snapshot_strategy.h (+4/-8)
src/server/scene/surface_allocator.cpp (+1/-2)
src/server/scene/surface_allocator.h (+1/-2)
src/server/scene/surface_controller.cpp (+9/-6)
src/server/scene/surface_controller.h (+5/-2)
src/server/scene/surface_creation_parameters.cpp (+17/-17)
src/server/scene/surface_event_source.cpp (+4/-2)
src/server/scene/surface_observer.cpp (+29/-0)
src/server/scene/surface_stack.cpp (+75/-39)
src/server/scene/surface_stack.h (+3/-8)
src/server/scene/surface_stack_model.h (+0/-7)
src/server/scene/threaded_snapshot_strategy.cpp (+6/-7)
src/server/scene/threaded_snapshot_strategy.h (+2/-2)
src/server/shell/CMakeLists.txt (+0/-2)
src/server/shell/consuming_placement_strategy.cpp (+5/-4)
src/server/shell/consuming_placement_strategy.h (+3/-3)
src/server/shell/default_configuration.cpp (+3/-16)
src/server/shell/default_focus_mechanism.cpp (+7/-7)
src/server/shell/default_focus_mechanism.h (+5/-6)
src/server/shell/organising_surface_factory.cpp (+0/-66)
src/server/shell/organising_surface_factory.h (+0/-61)
src/utils/screencast.cpp (+77/-31)
tests/acceptance-tests/CMakeLists.txt (+1/-0)
tests/acceptance-tests/test_client_input.cpp (+31/-28)
tests/acceptance-tests/test_client_surface_swap_buffers.cpp (+102/-0)
tests/acceptance-tests/test_focus_selection.cpp (+1/-2)
tests/acceptance-tests/test_server_startup.cpp (+31/-0)
tests/acceptance-tests/test_surfaces_with_output_id.cpp (+6/-21)
tests/integration-tests/CMakeLists.txt (+2/-0)
tests/integration-tests/graphics/android/test_internal_client.cpp (+16/-9)
tests/integration-tests/input/android/test_android_cursor_listener.cpp (+3/-9)
tests/integration-tests/input/android/test_android_input_manager.cpp (+6/-13)
tests/integration-tests/input/test_nested_input.cpp (+3/-10)
tests/integration-tests/session_management.cpp (+153/-0)
tests/integration-tests/shell/test_session_lifecycle_event.cpp (+4/-4)
tests/integration-tests/test_session.cpp (+9/-9)
tests/integration-tests/test_session_manager.cpp (+7/-7)
tests/integration-tests/test_surface_first_frame_sync.cpp (+1/-1)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+419/-0)
tests/mir_test/CMakeLists.txt (+1/-0)
tests/mir_test/spin_wait.cpp (+36/-0)
tests/mir_test_doubles/mock_egl.cpp (+9/-4)
tests/mir_test_framework/declarative_placement_strategy.cpp (+4/-4)
tests/mir_test_framework/display_server_test_fixture.cpp (+7/-0)
tests/mir_test_framework/input_testing_server_options.cpp (+1/-1)
tests/mir_test_framework/process.cpp (+5/-0)
tests/mir_test_framework/testing_process_manager.cpp (+19/-0)
tests/mir_test_framework/testing_server_options.cpp (+43/-1)
tests/unit-tests/client/android/test_client_surface_interpreter.cpp (+20/-11)
tests/unit-tests/compositor/CMakeLists.txt (+0/-1)
tests/unit-tests/compositor/test_bypass.cpp (+264/-336)
tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+63/-44)
tests/unit-tests/compositor/test_gl_renderer.cpp (+77/-217)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+148/-23)
tests/unit-tests/compositor/test_rendering_operator.cpp (+0/-76)
tests/unit-tests/compositor/test_switching_bundle.cpp (+57/-0)
tests/unit-tests/frontend/test_session_mediator.cpp (+1/-2)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+1/-2)
tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+0/-1)
tests/unit-tests/graphics/CMakeLists.txt (+2/-0)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+5/-0)
tests/unit-tests/graphics/android/test_hwc_display.cpp (+4/-1)
tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp (+6/-4)
tests/unit-tests/graphics/android/test_server_interpreter.cpp (+16/-9)
tests/unit-tests/graphics/mesa/CMakeLists.txt (+0/-1)
tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+108/-1)
tests/unit-tests/graphics/nested/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/nested/mir_display_configuration_builder.cpp (+226/-0)
tests/unit-tests/graphics/nested/mir_display_configuration_builder.h (+36/-0)
tests/unit-tests/graphics/nested/test_nested_display.cpp (+98/-7)
tests/unit-tests/graphics/nested/test_nested_display_configuration.cpp (+23/-198)
tests/unit-tests/graphics/nested/test_nested_platform.cpp (+65/-7)
tests/unit-tests/graphics/test_display.cpp (+23/-0)
tests/unit-tests/graphics/test_overlapping_output_grouping.cpp (+27/-1)
tests/unit-tests/graphics/test_program_factory.cpp (+211/-0)
tests/unit-tests/input/android/test_android_input_registrar.cpp (+4/-23)
tests/unit-tests/input/android/test_android_input_target_enumerator.cpp (+34/-9)
tests/unit-tests/scene/test_application_session.cpp (+56/-59)
tests/unit-tests/scene/test_basic_surface.cpp (+77/-13)
tests/unit-tests/scene/test_broadcasting_session_event_sink.cpp (+8/-9)
tests/unit-tests/scene/test_default_focus_mechanism.cpp (+15/-16)
tests/unit-tests/scene/test_global_event_sender.cpp (+7/-9)
tests/unit-tests/scene/test_session_manager.cpp (+33/-33)
tests/unit-tests/scene/test_surface.cpp (+11/-9)
tests/unit-tests/scene/test_surface_controller.cpp (+78/-16)
tests/unit-tests/scene/test_surface_stack.cpp (+88/-256)
tests/unit-tests/scene/test_the_session_container_implementation.cpp (+10/-11)
tests/unit-tests/scene/test_threaded_snapshot_strategy.cpp (+4/-5)
tests/unit-tests/shell/CMakeLists.txt (+0/-1)
tests/unit-tests/shell/test_consuming_placement_strategy.cpp (+7/-6)
tests/unit-tests/shell/test_mediating_display_changer.cpp (+15/-15)
tests/unit-tests/shell/test_organising_surface_factory.cpp (+0/-102)
To merge this branch: bzr merge lp:~mir-team/mir/trunk-0.1.9
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+217290@code.launchpad.net

Commit message

New upstream Mir release 0.1.9 (development branch r1573)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Verified the branch contents are as advertised. Just tag v0.1.9 plus changelog updates.

I think it would be a better idea to wait for 0.1.10/0.2.0 where we will have landed fixes for all the regressions [1] that 0.1.9 introduces. But that's a calculated risk for other people to decide.

[1] https://launchpad.net/mir/+milestone/0.1.10

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

What!?

Released in Ubuntu: https://launchpad.net/ubuntu/+source/mir
But not landed in lp:mir - https://code.launchpad.net/~mir-team/mir/utopic

What branch is utopic packaging from?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, so either lp:mir was meant to be used and this should be landed already, or it's not being used any more and no one will care if it does land. So land it...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-03-26 05:48:59 +0000
3+++ CMakeLists.txt 2014-04-30 13:15:30 +0000
4@@ -28,7 +28,7 @@
5
6 set(MIR_VERSION_MAJOR 0)
7 set(MIR_VERSION_MINOR 1)
8-set(MIR_VERSION_PATCH 8)
9+set(MIR_VERSION_PATCH 9)
10
11 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
12 execute_process(
13@@ -152,14 +152,6 @@
14 add_subdirectory(src/)
15 include_directories(${MIR_GENERATED_INCLUDE_DIRECTORIES})
16
17-set (OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
18-# Don't treat warnings as errors in 3rd_party/{gmock}
19-string (REPLACE " -Werror " " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
20-
21-
22-# Restore -Werror for non-3rd-party code
23-set (CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
24-
25 option(MIR_ENABLE_TESTS "Build tests" ON)
26
27 if (MIR_ENABLE_TESTS)
28
29=== modified file 'cmake/FindGtest.cmake'
30--- cmake/FindGtest.cmake 2013-07-11 18:36:11 +0000
31+++ cmake/FindGtest.cmake 2014-04-30 13:15:30 +0000
32@@ -21,7 +21,7 @@
33 set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest)
34
35 set(GTEST_CMAKE_ARGS "")
36-if (${MIR_IS_CROSS_COMPILING})
37+if (${CMAKE_CROSSCOMPILING})
38 set(GTEST_CMAKE_ARGS
39 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)
40 endif()
41
42=== modified file 'cmake/LinuxCrossCompile.cmake'
43--- cmake/LinuxCrossCompile.cmake 2014-03-06 06:05:17 +0000
44+++ cmake/LinuxCrossCompile.cmake 2014-04-30 13:15:30 +0000
45@@ -1,7 +1,6 @@
46 set(CMAKE_SYSTEM_NAME Linux)
47 set(CMAKE_SYSTEM_VERSION 1)
48
49-set(MIR_IS_CROSS_COMPILING TRUE CACHE STRING "build is a cross compile")
50 set(MIR_NDK_PATH $ENV{MIR_NDK_PATH} CACHE STRING "path of mir android bundle")
51 set(MIR_ARM_EABI "arm-linux-gnueabihf")
52
53
54=== modified file 'cmake/MirCommon.cmake'
55--- cmake/MirCommon.cmake 2014-03-26 05:48:59 +0000
56+++ cmake/MirCommon.cmake 2014-04-30 13:15:30 +0000
57@@ -7,7 +7,7 @@
58 DISABLE_GTEST_TEST_DISCOVERY
59 "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior"
60 OFF
61- "NOT MIR_IS_CROSS_COMPILING"
62+ "NOT CMAKE_CROSSCOMPILING"
63 ON)
64
65 option(
66
67=== modified file 'debian/changelog'
68--- debian/changelog 2014-04-11 21:03:54 +0000
69+++ debian/changelog 2014-04-30 13:15:30 +0000
70@@ -1,3 +1,48 @@
71+mir (0.1.9-0ubuntu1) UNRELEASED; urgency=medium
72+
73+ * New upstream release 0.1.9 (https://launchpad.net/mir/+milestone/0.1.9)
74+ - mirclient ABI unchanged, still at 7. Clients do not need rebuilding.
75+ - mirserver ABI bumped to 19. Shells need rebuilding.
76+ - More libmirserver class changes and reorganization, including;
77+ . Moving things from shell:: to scene::
78+ . Rewriting/refactoring surface factories.
79+ - Added an id() to Renderable.
80+ - Scene/Renderer interfaces:
81+ . Scene is no longer responsible for its own iteration (no for_each
82+ any more). Instead you should iterate over the list returned by
83+ Scene::generate_renderable_list().
84+ - Bugs fixed:
85+ . Stale socket issue. (LP: #1285215)
86+ . Qt render gets blocked on EGLSwapBuffers. (LP: #1292306)
87+ . Lock order violated found in helgrind (potential deadlock).
88+ (LP: #1296544)
89+ . [regression] SwitchingBundle in framedropping mode can hang.
90+ (LP: #1306464)
91+ . [DPMS] Display backlight turns back on almost immediately after
92+ being turned off. (LP: #1231857)
93+ . Wrong frame is seen on wake up/resume/unlock. (LP: #1233564)
94+ . Nested platform is not testable (LP: #1299101)
95+ . [regression] mir_demo_server_shell crashes on display resume.
96+ (LP: #1308941)
97+ . Multi-threaded composition is actually mostly serialized by
98+ SurfaceStack::guard. (LP: #1234018)
99+ . Mirscreencast slows down compositing and makes it very jerky.
100+ (LP: #1280938)
101+ . Mirscreencast can cause clients to render faster than the screen
102+ refresh rate. (LP: #1294361)
103+ . Screen turns on when a new session/surface appears. (LP: #1297876)
104+ . mir-doc package is >56MB in size, expands to >100MB of files.
105+ (LP: #1304998)
106+ . [regression] Clang: 'mir::test::doubles::MockSurface::visible'
107+ hides overloaded virtual function [-Woverloaded-virtual].
108+ (LP: #1301135)
109+ . [regression] GLRenderer* unit tests have recently become noisy.
110+ (LP: #1308905)
111+ . FocusController::set_focus_to() no longer seems to raise a session
112+ to the top. (LP: #1302689)
113+
114+ -- Daniel van Vugt <daniel.van.vugt@canonical.com> Tue, 15 Apr 2014 13:35:04 +0800
115+
116 mir (0.1.8+14.04.20140411-0ubuntu1) trusty; urgency=medium
117
118 [ Daniel van Vugt ]
119
120=== modified file 'debian/control'
121--- debian/control 2014-03-26 17:06:10 +0000
122+++ debian/control 2014-04-30 13:15:30 +0000
123@@ -70,7 +70,7 @@
124 .
125 Contains the protocol's definition files.
126
127-Package: libmirserver18
128+Package: libmirserver19
129 Section: libs
130 Architecture: i386 amd64 armhf arm64
131 Multi-Arch: same
132@@ -148,7 +148,7 @@
133 Architecture: i386 amd64 armhf arm64
134 Multi-Arch: same
135 Pre-Depends: ${misc:Pre-Depends}
136-Depends: libmirserver18 (= ${binary:Version}),
137+Depends: libmirserver19 (= ${binary:Version}),
138 libmirprotobuf-dev (= ${binary:Version}),
139 mircommon-dev (= ${binary:Version}),
140 libglm-dev,
141
142=== modified file 'debian/create_postinst_prerm_scripts.sh'
143--- debian/create_postinst_prerm_scripts.sh 2014-02-14 09:20:28 +0000
144+++ debian/create_postinst_prerm_scripts.sh 2014-04-30 13:15:30 +0000
145@@ -2,10 +2,19 @@
146
147 set -e
148
149+dpkg_alternatives_priority=500
150+deb_host_arch=$1
151+deb_host_multiarch=$2
152+
153 mir_platform_types="platformgraphics clientplatform"
154-mir_platforms="android mesa"
155-dpkg_alternatives_priority=500
156-deb_host_multiarch=$1
157+case $deb_host_arch in
158+ arm64)
159+ mir_platforms="mesa"
160+ ;;
161+ *)
162+ mir_platforms="android mesa"
163+ ;;
164+esac
165
166 create_script()
167 {
168
169=== modified file 'debian/install_ld_so_conf.sh'
170--- debian/install_ld_so_conf.sh 2014-02-14 09:20:28 +0000
171+++ debian/install_ld_so_conf.sh 2014-04-30 13:15:30 +0000
172@@ -2,10 +2,18 @@
173
174 set -e
175
176+DEB_HOST_ARCH=$1
177+DEB_HOST_MULTIARCH=$2
178+
179 mir_platform_types="platformgraphics clientplatform"
180-mir_platforms="android mesa"
181-
182-DEB_HOST_MULTIARCH=$1
183+case $DEB_HOST_ARCH in
184+ arm64)
185+ mir_platforms="mesa"
186+ ;;
187+ *)
188+ mir_platforms="android mesa"
189+ ;;
190+esac
191
192 for platform_type in $mir_platform_types;
193 do
194
195=== renamed file 'debian/libmirserver18.install' => 'debian/libmirserver19.install'
196--- debian/libmirserver18.install 2014-03-25 06:34:39 +0000
197+++ debian/libmirserver19.install 2014-04-30 13:15:30 +0000
198@@ -1,1 +1,1 @@
199-usr/lib/*/libmirserver.so.18
200+usr/lib/*/libmirserver.so.19
201
202=== modified file 'debian/rules'
203--- debian/rules 2014-03-26 05:48:59 +0000
204+++ debian/rules 2014-04-30 13:15:30 +0000
205@@ -44,8 +44,9 @@
206 dh_install --fail-missing \
207 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmirplatformgraphics.so \
208 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmirclientplatform.so
209- sh debian/install_ld_so_conf.sh $(DEB_HOST_MULTIARCH)
210+ sh debian/install_ld_so_conf.sh $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
211
212 override_dh_installdeb:
213- sh debian/create_postinst_prerm_scripts.sh $(DEB_HOST_MULTIARCH)
214+ sh debian/create_postinst_prerm_scripts.sh \
215+ $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
216 dh_installdeb
217
218=== modified file 'doc/Doxyfile.in'
219--- doc/Doxyfile.in 2014-03-06 06:05:17 +0000
220+++ doc/Doxyfile.in 2014-04-30 13:15:30 +0000
221@@ -118,7 +118,7 @@
222 # Doxygen will generate a detailed section even if there is only a brief
223 # description.
224
225-ALWAYS_DETAILED_SEC = YES
226+ALWAYS_DETAILED_SEC = NO
227
228 # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
229 # inherited members of a class in the documentation of that class as if those
230@@ -382,7 +382,7 @@
231 # defined locally in source files will be included in the documentation.
232 # If set to NO only classes defined in header files are included.
233
234-EXTRACT_LOCAL_CLASSES = YES
235+EXTRACT_LOCAL_CLASSES = NO
236
237 # This flag is only useful for Objective-C code. When set to YES local
238 # methods, which are defined in the implementation section but not in
239@@ -748,7 +748,7 @@
240 # against the file with absolute path, so to exclude all test directories
241 # for example use the pattern */test/*
242
243-EXCLUDE_PATTERNS = */include/mir_test*
244+EXCLUDE_PATTERNS = */include/test/* */3rd_party/*
245
246 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
247 # (namespaces, classes, functions, etc.) that should be excluded from the
248@@ -1866,7 +1866,7 @@
249 # HTML_FILE_EXTENSION to xhtml in order to make the SVG files
250 # visible in IE 9+ (other browsers do not have this requirement).
251
252-DOT_IMAGE_FORMAT = png
253+DOT_IMAGE_FORMAT = svg
254
255 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
256 # enable generation of interactive SVG images that allow zooming and panning.
257
258=== modified file 'examples/CMakeLists.txt'
259--- examples/CMakeLists.txt 2014-03-26 05:48:59 +0000
260+++ examples/CMakeLists.txt 2014-04-30 13:15:30 +0000
261@@ -24,6 +24,12 @@
262 target_link_libraries(mir_demo_client_egltriangle
263 eglapp
264 )
265+add_executable(mir_demo_client_eglcounter
266+ eglcounter.cpp
267+)
268+target_link_libraries(mir_demo_client_eglcounter
269+ eglapp
270+)
271 add_executable(mir_demo_client_eglplasma
272 eglplasma.c
273 )
274
275=== modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp'
276--- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-03-12 02:46:58 +0000
277+++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-04-30 13:15:30 +0000
278@@ -22,8 +22,8 @@
279 #include "mir/main_loop.h"
280 #include "mir/shell/focus_controller.h"
281 #include "mir/frontend/surface.h"
282-#include "mir/shell/surface_creation_parameters.h"
283-#include "mir/shell/session.h"
284+#include "mir/scene/surface_creation_parameters.h"
285+#include "mir/scene/session.h"
286 #include "mir/frontend/session.h"
287 #include "mir/frontend/shell.h"
288 #include "mir/geometry/size.h"
289@@ -49,6 +49,7 @@
290 #include <signal.h>
291
292 namespace mf = mir::frontend;
293+namespace ms = mir::scene;
294 namespace msh = mir::shell;
295 namespace mg = mir::graphics;
296 namespace me = mir::examples;
297@@ -91,7 +92,7 @@
298 geom::Size const surface_size{512, 512};
299
300 ///\internal [setup_tag]
301- auto params = msh::a_surface().of_name("Inprocess EGL Demo")
302+ auto params = ms::a_surface().of_name("Inprocess EGL Demo")
303 .of_size(surface_size)
304 .of_buffer_usage(mg::BufferUsage::hardware)
305 .of_pixel_format(mir_pixel_format_argb_8888);
306
307=== modified file 'examples/demo-shell/demo_renderer.cpp'
308--- examples/demo-shell/demo_renderer.cpp 2014-03-27 04:50:19 +0000
309+++ examples/demo-shell/demo_renderer.cpp 2014-04-30 13:15:30 +0000
310@@ -26,6 +26,11 @@
311 namespace
312 {
313
314+struct Color
315+{
316+ GLubyte r, g, b, a;
317+};
318+
319 float penumbra_curve(float x)
320 {
321 return 1.0f - std::sin(x * M_PI / 2.0f);
322@@ -69,26 +74,23 @@
323 return corner;
324 }
325
326-GLuint generate_frame_corner_texture()
327+GLuint generate_frame_corner_texture(float corner_radius,
328+ Color const& color,
329+ GLubyte highlight)
330 {
331- struct Texel
332- {
333- GLubyte r, g, b, a;
334- };
335-
336- int const width = 256;
337- Texel image[width][width];
338-
339- int cx = width / 2;
340- int cy = width / 2;
341- int radius_sqr = cx * cx;
342-
343- for (int y = 0; y < width; ++y)
344+ int const height = 256;
345+ int const width = height * corner_radius;
346+ Color image[height * height]; // Worst case still much faster than the heap
347+
348+ int const cx = width;
349+ int const cy = cx;
350+ int const radius_sqr = cx * cy;
351+
352+ for (int y = 0; y < height; ++y)
353 {
354 for (int x = 0; x < width; ++x)
355 {
356- GLubyte lum = 128;
357- GLubyte alpha = 255;
358+ Color col = color;
359
360 // Cut out the corner in a circular shape.
361 if (x < cx && y < cy)
362@@ -96,20 +98,21 @@
363 int dx = cx - x;
364 int dy = cy - y;
365 if (dx * dx + dy * dy >= radius_sqr)
366- alpha = 0;
367+ col.a = 0;
368 }
369
370 // Set gradient
371 if (y < cy)
372 {
373- float brighten = (1.0f - (static_cast<float>(y) / cy));
374- if (x < cx)
375- brighten *= std::sin(x * M_PI / width);
376+ float brighten = (1.0f - (static_cast<float>(y) / cy)) *
377+ std::sin(x * M_PI / (2 * (width - 1)));
378
379- lum += (255 - lum) * brighten;
380+ col.r += (highlight - col.r) * brighten;
381+ col.g += (highlight - col.g) * brighten;
382+ col.b += (highlight - col.b) * brighten;
383 }
384
385- image[y][x] = {lum, lum, lum, alpha};
386+ image[y * width + x] = col;
387 }
388 }
389
390@@ -122,7 +125,7 @@
391 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
392 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
393 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
394- width, width, 0, GL_RGBA, GL_UNSIGNED_BYTE,
395+ width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
396 image);
397 glGenerateMipmap(GL_TEXTURE_2D); // Antialiasing please
398
399@@ -131,11 +134,16 @@
400
401 } // namespace
402
403-DemoRenderer::DemoRenderer(geometry::Rectangle const& display_area)
404- : GLRenderer(display_area)
405+DemoRenderer::DemoRenderer(
406+ graphics::GLProgramFactory const& program_factory,
407+ geometry::Rectangle const& display_area)
408+ : GLRenderer(program_factory, display_area)
409+ , corner_radius(0.5f)
410 {
411 shadow_corner_tex = generate_shadow_corner_texture(0.4f);
412- titlebar_corner_tex = generate_frame_corner_texture();
413+ titlebar_corner_tex = generate_frame_corner_texture(corner_radius,
414+ {128,128,128,255},
415+ 255);
416 }
417
418 DemoRenderer::~DemoRenderer()
419@@ -267,8 +275,9 @@
420 primitives.resize(n + 3);
421
422 GLfloat htop = top - titlebar_height;
423- GLfloat inleft = left + titlebar_height; // Square proportions for corners
424- GLfloat inright = right - titlebar_height;
425+ GLfloat in = titlebar_height * corner_radius;
426+ GLfloat inleft = left + in;
427+ GLfloat inright = right - in;
428
429 GLfloat mid = (left + right) / 2.0f;
430 if (inleft > mid) inleft = mid;
431
432=== modified file 'examples/demo-shell/demo_renderer.h'
433--- examples/demo-shell/demo_renderer.h 2014-03-27 04:50:19 +0000
434+++ examples/demo-shell/demo_renderer.h 2014-04-30 13:15:30 +0000
435@@ -29,7 +29,7 @@
436 class DemoRenderer : public compositor::GLRenderer
437 {
438 public:
439- DemoRenderer(geometry::Rectangle const& display_area);
440+ DemoRenderer(graphics::GLProgramFactory const& factory, geometry::Rectangle const& display_area);
441 ~DemoRenderer();
442
443 void begin() const override;
444@@ -44,6 +44,7 @@
445 float titlebar_height) const;
446
447 private:
448+ float const corner_radius;
449 GLuint shadow_corner_tex;
450 GLuint titlebar_corner_tex;
451 };
452
453=== modified file 'examples/demo-shell/demo_shell.cpp'
454--- examples/demo-shell/demo_shell.cpp 2014-03-06 06:05:17 +0000
455+++ examples/demo-shell/demo_shell.cpp 2014-04-30 13:15:30 +0000
456@@ -33,7 +33,7 @@
457 #include <iostream>
458
459 namespace me = mir::examples;
460-namespace msh = mir::shell;
461+namespace ms = mir::scene;
462 namespace mg = mir::graphics;
463 namespace mf = mir::frontend;
464 namespace mi = mir::input;
465@@ -47,11 +47,18 @@
466 class DemoRendererFactory : public compositor::RendererFactory
467 {
468 public:
469+ DemoRendererFactory(std::shared_ptr<graphics::GLProgramFactory> const& gl_program_factory) :
470+ gl_program_factory(gl_program_factory)
471+ {
472+ }
473+
474 std::unique_ptr<compositor::Renderer> create_renderer_for(
475 geometry::Rectangle const& rect) override
476 {
477- return std::unique_ptr<compositor::Renderer>(new DemoRenderer(rect));
478+ return std::unique_ptr<compositor::Renderer>(new DemoRenderer(*gl_program_factory, rect));
479 }
480+private:
481+ std::shared_ptr<graphics::GLProgramFactory> const gl_program_factory;
482 };
483
484 class DemoServerConfiguration : public mir::examples::ServerConfiguration
485@@ -74,15 +81,15 @@
486 {
487 }
488
489- std::shared_ptr<msh::PlacementStrategy> the_shell_placement_strategy() override
490+ std::shared_ptr<ms::PlacementStrategy> the_placement_strategy() override
491 {
492 return shell_placement_strategy(
493- [this]() -> std::shared_ptr<msh::PlacementStrategy>
494+ [this]() -> std::shared_ptr<ms::PlacementStrategy>
495 {
496 if (the_options()->is_set("fullscreen-surfaces"))
497 return std::make_shared<me::FullscreenPlacementStrategy>(the_shell_display_layout());
498 else
499- return DefaultServerConfiguration::the_shell_placement_strategy();
500+ return DefaultServerConfiguration::the_placement_strategy();
501 });
502 }
503
504@@ -97,7 +104,7 @@
505
506 std::shared_ptr<compositor::RendererFactory> the_renderer_factory() override
507 {
508- return std::make_shared<DemoRendererFactory>();
509+ return std::make_shared<DemoRendererFactory>(the_gl_program_factory());
510 }
511
512 private:
513
514=== modified file 'examples/demo-shell/fullscreen_placement_strategy.cpp'
515--- examples/demo-shell/fullscreen_placement_strategy.cpp 2013-08-28 03:41:48 +0000
516+++ examples/demo-shell/fullscreen_placement_strategy.cpp 2014-04-30 13:15:30 +0000
517@@ -18,11 +18,12 @@
518
519 #include "fullscreen_placement_strategy.h"
520
521-#include "mir/shell/surface_creation_parameters.h"
522+#include "mir/scene/surface_creation_parameters.h"
523 #include "mir/shell/display_layout.h"
524 #include "mir/geometry/rectangle.h"
525
526 namespace me = mir::examples;
527+namespace ms = mir::scene;
528 namespace msh = mir::shell;
529
530 me::FullscreenPlacementStrategy::FullscreenPlacementStrategy(
531@@ -31,8 +32,8 @@
532 {
533 }
534
535-msh::SurfaceCreationParameters me::FullscreenPlacementStrategy::place(msh::Session const& /* session */,
536- msh::SurfaceCreationParameters const& request_parameters)
537+ms::SurfaceCreationParameters me::FullscreenPlacementStrategy::place(ms::Session const& /* session */,
538+ ms::SurfaceCreationParameters const& request_parameters)
539 {
540 auto placed_parameters = request_parameters;
541
542
543=== modified file 'examples/demo-shell/fullscreen_placement_strategy.h'
544--- examples/demo-shell/fullscreen_placement_strategy.h 2013-08-28 03:41:48 +0000
545+++ examples/demo-shell/fullscreen_placement_strategy.h 2014-04-30 13:15:30 +0000
546@@ -19,7 +19,7 @@
547 #ifndef MIR_EXAMPLES_FULLSCREEN_PLACEMENT_STRATEGY_H_
548 #define MIR_EXAMPLES_FULLSCREEN_PLACEMENT_STRATEGY_H_
549
550-#include "mir/shell/placement_strategy.h"
551+#include "mir/scene/placement_strategy.h"
552
553 #include <memory>
554
555@@ -32,13 +32,13 @@
556 namespace examples
557 {
558
559-class FullscreenPlacementStrategy : public shell::PlacementStrategy
560+class FullscreenPlacementStrategy : public scene::PlacementStrategy
561 {
562 public:
563 FullscreenPlacementStrategy(std::shared_ptr<shell::DisplayLayout> const& display_layout);
564 ~FullscreenPlacementStrategy() = default;
565
566- shell::SurfaceCreationParameters place(shell::Session const&, shell::SurfaceCreationParameters const& request_parameters);
567+ scene::SurfaceCreationParameters place(scene::Session const&, scene::SurfaceCreationParameters const& request_parameters);
568
569 protected:
570 FullscreenPlacementStrategy(FullscreenPlacementStrategy const&) = delete;
571
572=== modified file 'examples/demo-shell/window_manager.cpp'
573--- examples/demo-shell/window_manager.cpp 2014-03-26 05:48:59 +0000
574+++ examples/demo-shell/window_manager.cpp 2014-04-30 13:15:30 +0000
575@@ -20,8 +20,8 @@
576 #include "window_manager.h"
577
578 #include "mir/shell/focus_controller.h"
579-#include "mir/shell/session.h"
580-#include "mir/shell/surface.h"
581+#include "mir/scene/session.h"
582+#include "mir/scene/surface.h"
583 #include "mir/graphics/display.h"
584 #include "mir/graphics/display_configuration.h"
585 #include "mir/compositor/compositor.h"
586@@ -195,8 +195,7 @@
587 // FIXME: https://bugs.launchpad.net/mir/+bug/1197108
588 MirMotionAction action = static_cast<MirMotionAction>(event.motion.action & ~0xff00);
589
590- std::shared_ptr<msh::Session> app =
591- focus_controller->focussed_application().lock();
592+ auto const app = focus_controller->focussed_application().lock();
593
594 int fingers = static_cast<int>(event.motion.pointer_count);
595
596@@ -207,7 +206,7 @@
597 {
598 // FIXME: We need to be able to select individual surfaces in
599 // future and not just the "default" one.
600- std::shared_ptr<msh::Surface> surf = app->default_surface();
601+ auto const surf = app->default_surface();
602
603 if (surf &&
604 (event.motion.modifiers & mir_key_modifier_alt ||
605
606=== added file 'examples/eglcounter.cpp'
607--- examples/eglcounter.cpp 1970-01-01 00:00:00 +0000
608+++ examples/eglcounter.cpp 2014-04-30 13:15:30 +0000
609@@ -0,0 +1,281 @@
610+/*
611+ * Copyright © 2014 Canonical Ltd.
612+ *
613+ * This program is free software: you can redistribute it and/or modify
614+ * it under the terms of the GNU General Public License version 3 as
615+ * published by the Free Software Foundation.
616+ *
617+ * This program is distributed in the hope that it will be useful,
618+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
619+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
620+ * GNU General Public License for more details.
621+ *
622+ * You should have received a copy of the GNU General Public License
623+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
624+ *
625+ * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
626+ * Alberto Aguirre <alberto.aguirre@canonical.com>
627+ */
628+
629+#include "eglapp.h"
630+#include <assert.h>
631+#include <stdio.h>
632+#include <GLES2/gl2.h>
633+
634+#include <vector>
635+#include <stdexcept>
636+#include <iostream>
637+
638+static GLuint load_shader(const char *src, GLenum type)
639+{
640+ GLuint shader = glCreateShader(type);
641+ if (shader)
642+ {
643+ GLint compiled;
644+ glShaderSource(shader, 1, &src, NULL);
645+ glCompileShader(shader);
646+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
647+ if (!compiled)
648+ {
649+ GLchar log[1024];
650+ glGetShaderInfoLog(shader, sizeof log - 1, NULL, log);
651+ log[sizeof log - 1] = '\0';
652+ printf("load_shader compile failed: %s\n", log);
653+ glDeleteShader(shader);
654+ shader = 0;
655+ }
656+ }
657+ return shader;
658+}
659+
660+class DrawableDigit
661+{
662+public:
663+ DrawableDigit(std::initializer_list<std::vector<GLubyte>> list)
664+ {
665+ for (auto const& arg : list)
666+ {
667+ indices.insert(indices.end(), arg.begin(), arg.end());
668+ }
669+ }
670+
671+ void draw()
672+ {
673+ glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_BYTE, indices.data());
674+ }
675+
676+private:
677+ DrawableDigit() = delete;
678+ std::vector<GLubyte> indices;
679+};
680+
681+class TwoDigitCounter
682+{
683+public:
684+ TwoDigitCounter(GLuint prog, float thickness, unsigned int max_count)
685+ : count{0}, max_count{max_count}, program{prog},
686+ vertices{create_vertices(thickness)}, digit_drawables{create_digits()}
687+ {
688+ if (max_count > 99)
689+ max_count = 99;
690+
691+ vpos = glGetAttribLocation(program, "vPosition");
692+ if (vpos == -1)
693+ throw std::runtime_error("Failed to obtain vPosition attribute");
694+
695+ xoff = glGetUniformLocation(program, "xOffset");
696+ if (xoff == -1)
697+ throw std::runtime_error("Failed to obtain xoff uniform");
698+
699+ xscale = glGetUniformLocation(program, "xScale");
700+ if (xscale == -1)
701+ throw std::runtime_error("Failed to obtain xscale uniform");
702+
703+ glUniform1f(xscale, 0.4f);
704+ glVertexAttribPointer(vpos, 2, GL_FLOAT, GL_FALSE, 0, vertices.data());
705+ glEnableVertexAttribArray(0);
706+ }
707+
708+ void draw()
709+ {
710+ drawLeftDigit();
711+ drawRightDigit();
712+ nextCount();
713+ }
714+
715+private:
716+ void draw(int digit)
717+ {
718+ if (static_cast<size_t>(digit) > digit_drawables.size())
719+ throw std::logic_error("invalid digit to draw");
720+
721+ digit_drawables[digit].draw();
722+ }
723+
724+ void drawRightDigit()
725+ {
726+ glUniform1f(xoff, 0.5f);
727+ draw(count % 10);
728+ }
729+
730+ void drawLeftDigit()
731+ {
732+ glUniform1f(xoff, -0.5f);
733+ draw(count/10);
734+ }
735+
736+ void nextCount()
737+ {
738+ count++;
739+ if (count > max_count) count = 0;
740+ }
741+
742+ static std::vector<GLfloat> create_vertices(GLfloat t)
743+ {
744+ return std::vector<GLfloat>{
745+ -1.0f, -1.0f,
746+ -1.0f+t, -1.0f,
747+ 1.0f-t, -1.0f,
748+
749+ 1.0f, -1.0f,
750+ -1.0f, -1.0f+t,
751+ 1.0f, -1.0f+t,
752+
753+ -1.0f, -t/2.0f,
754+ -1.0f+t, -t/2.0f,
755+ 1.0f-t, -t/2.0f,
756+
757+ 1.0f, -t/2.0f,
758+ -1.0f, t/2.0f,
759+ 1.0f, t/2.0f,
760+
761+ -1.0f, 1.0f-t,
762+ 1.0f, 1.0f-t,
763+ -1.0f, 1.0f,
764+
765+ -1.0f+t, 1.0f,
766+ 1.0f-t, 1.0f,
767+ 1.0f, 1.0f,
768+ };
769+ }
770+
771+ static std::vector<DrawableDigit> create_digits()
772+ {
773+ std::vector<DrawableDigit> digits;
774+ /*
775+ * Vertex indices for quads which can be used to make
776+ * simple number "font" shapes
777+ */
778+ std::vector<GLubyte> top{12, 14, 13, 13, 14, 17};
779+ std::vector<GLubyte> bottom{0, 4, 3, 3, 4, 5};
780+ std::vector<GLubyte> middle{6, 10, 9, 9, 10, 11};
781+ std::vector<GLubyte> left{0, 14, 1, 1, 14, 15};
782+ std::vector<GLubyte> right{2, 16, 3, 3, 16, 17};
783+
784+ std::vector<GLubyte> top_left{6, 14, 7, 7, 14, 15};
785+ std::vector<GLubyte> top_right{8, 16, 9, 9, 16, 17};
786+ std::vector<GLubyte> bottom_left{0, 6, 1, 1, 6, 7};
787+ std::vector<GLubyte> bottom_right{2, 8, 3, 3, 8, 9};
788+
789+ digits.push_back({top, bottom, left, right});
790+ digits.push_back({right});
791+ digits.push_back({top, middle, bottom, top_right, bottom_left});
792+ digits.push_back({top, middle, bottom, right});
793+ digits.push_back({top_left, middle, right});
794+ digits.push_back({top, middle, bottom, top_left, bottom_right});
795+ digits.push_back({top, middle, bottom, left, bottom_right});
796+ digits.push_back({top, right});
797+ digits.push_back({top, middle, bottom, left, right});
798+ digits.push_back({top, middle, right, top_left});
799+ return digits;
800+ }
801+
802+ unsigned int count;
803+ unsigned int max_count;
804+
805+ GLint vpos;
806+ GLint xoff;
807+ GLint xscale;
808+ GLuint program;
809+
810+ std::vector<GLfloat> const vertices;
811+ std::vector<DrawableDigit> digit_drawables;
812+};
813+
814+/* Colours from http://design.ubuntu.com/brand/colour-palette */
815+#define MID_AUBERGINE 0.368627451f, 0.152941176f, 0.31372549f
816+#define ORANGE 0.866666667f, 0.282352941f, 0.141414141f
817+
818+int main(int argc, char *argv[])
819+{
820+ const char vshadersrc[] =
821+ "attribute vec4 vPosition; \n"
822+ "uniform float xOffset; \n"
823+ "uniform float xScale; \n"
824+ "void main() \n"
825+ "{ \n"
826+ " vec4 vertex; \n"
827+ " vertex = vPosition; \n"
828+ " vertex.x *= xScale; \n"
829+ " vertex.x += xOffset; \n"
830+ " gl_Position = vertex; \n"
831+ "} \n";
832+
833+ const char fshadersrc[] =
834+ "precision mediump float; \n"
835+ "uniform vec4 col; \n"
836+ "void main() \n"
837+ "{ \n"
838+ " gl_FragColor = col; \n"
839+ "} \n";
840+
841+ GLuint vshader, fshader, prog;
842+ GLint linked, col;
843+ unsigned int width = 512, height = 256;
844+
845+ if (!mir_eglapp_init(argc, argv, &width, &height))
846+ return 1;
847+
848+ vshader = load_shader(vshadersrc, GL_VERTEX_SHADER);
849+ assert(vshader);
850+ fshader = load_shader(fshadersrc, GL_FRAGMENT_SHADER);
851+ assert(fshader);
852+ prog = glCreateProgram();
853+ assert(prog);
854+ glAttachShader(prog, vshader);
855+ glAttachShader(prog, fshader);
856+ glLinkProgram(prog);
857+
858+ glGetProgramiv(prog, GL_LINK_STATUS, &linked);
859+ if (!linked)
860+ {
861+ GLchar log[1024];
862+ glGetProgramInfoLog(prog, sizeof log - 1, NULL, log);
863+ log[sizeof log - 1] = '\0';
864+ printf("Link failed: %s\n", log);
865+ return 2;
866+ }
867+
868+ glClearColor(MID_AUBERGINE, mir_eglapp_background_opacity);
869+ glViewport(0, 0, width, height);
870+
871+ glUseProgram(prog);
872+
873+ col = glGetUniformLocation(prog, "col");
874+ glUniform4f(col, ORANGE, 1.0f);
875+
876+ float thickness = 0.2f;
877+ unsigned int max_counter = 60;
878+ TwoDigitCounter counter(prog, thickness, max_counter);
879+
880+ while (mir_eglapp_running())
881+ {
882+ glClear(GL_COLOR_BUFFER_BIT);
883+ counter.draw();
884+ mir_eglapp_swap_buffers();
885+ }
886+
887+ mir_eglapp_shutdown();
888+
889+ return 0;
890+}
891
892=== modified file 'examples/render_overlays.cpp'
893--- examples/render_overlays.cpp 2014-03-28 22:40:30 +0000
894+++ examples/render_overlays.cpp 2014-04-30 13:15:30 +0000
895@@ -105,6 +105,11 @@
896 {
897 }
898
899+ ID id() const override
900+ {
901+ return this;
902+ }
903+
904 std::shared_ptr<mg::Buffer> buffer(void const*) const override
905 {
906 return client->last_rendered();
907
908=== modified file 'examples/render_surfaces.cpp'
909--- examples/render_surfaces.cpp 2014-03-28 17:47:07 +0000
910+++ examples/render_surfaces.cpp 2014-04-30 13:15:30 +0000
911@@ -22,7 +22,7 @@
912 #include "mir/options/default_configuration.h"
913 #include "mir/graphics/graphic_buffer_allocator.h"
914 #include "mir/frontend/connector.h"
915-#include "mir/shell/surface_creation_parameters.h"
916+#include "mir/scene/surface_creation_parameters.h"
917 #include "mir/geometry/size.h"
918 #include "mir/geometry/rectangles.h"
919 #include "mir/graphics/buffer_initializer.h"
920@@ -30,7 +30,6 @@
921 #include "mir/graphics/display.h"
922 #include "mir/graphics/display_buffer.h"
923 #include "mir/graphics/gl_context.h"
924-#include "mir/shell/surface_factory.h"
925 #include "mir/scene/surface.h"
926 #include "mir/scene/surface_coordinator.h"
927 #include "mir/run_mir.h"
928@@ -195,7 +194,7 @@
929 {
930 public:
931 Moveable() {}
932- Moveable(std::shared_ptr<msh::Surface> const& s, const geom::Size& display_size,
933+ Moveable(std::shared_ptr<ms::Surface> const& s, const geom::Size& display_size,
934 float dx, float dy, const glm::vec3& rotation_axis, float alpha_offset)
935 : surface(s), display_size(display_size),
936 x{static_cast<float>(s->top_left().x.as_uint32_t())},
937@@ -251,7 +250,7 @@
938 }
939
940 private:
941- std::shared_ptr<msh::Surface> surface;
942+ std::shared_ptr<ms::Surface> surface;
943 geom::Size display_size;
944 float x;
945 float y;
946@@ -466,10 +465,10 @@
947 for (auto& m : moveables)
948 {
949 auto const s = surface_coordinator->add_surface(
950- msh::a_surface().of_size(surface_size)
951+ ms::a_surface().of_size(surface_size)
952 .of_pixel_format(surface_pf)
953 .of_buffer_usage(mg::BufferUsage::hardware),
954- {});
955+ nullptr);
956
957 /*
958 * We call swap_buffers() twice so that the surface is
959
960=== modified file 'include/client/mir_toolkit/mir_client_library.h'
961--- include/client/mir_toolkit/mir_client_library.h 2014-03-06 06:05:17 +0000
962+++ include/client/mir_toolkit/mir_client_library.h 2014-04-30 13:15:30 +0000
963@@ -1,5 +1,5 @@
964 /*
965- * Copyright © 2012-2013 Canonical Ltd.
966+ * Copyright © 2012-2014 Canonical Ltd.
967 *
968 * This program is free software: you can redistribute it and/or modify it
969 * under the terms of the GNU Lesser General Public License version 3,
970@@ -18,395 +18,8 @@
971 #ifndef MIR_CLIENT_LIBRARY_H
972 #define MIR_CLIENT_LIBRARY_H
973
974-#include <mir_toolkit/mir_native_buffer.h>
975-#include <mir_toolkit/client_types.h>
976-#include <mir_toolkit/common.h>
977-
978-#ifdef __cplusplus
979-/**
980- * \addtogroup mir_toolkit
981- * @{
982- */
983-extern "C" {
984-#endif
985-
986-/* This header defines the Mir client library's C API. */
987-
988-/**
989- * Request a connection to the Mir server. The supplied callback is called when
990- * the connection is established, or fails. The returned wait handle remains
991- * valid until the connection has been released.
992- * \warning callback could be called from another thread. You must do any
993- * locking appropriate to protect your data accessed in the
994- * callback.
995- * \param [in] server File path of the server socket to connect to, or
996- * NULL to choose the default server (can be set by
997- * the $MIR_SOCKET environment variable)
998- * \param [in] app_name A name referring to the application
999- * \param [in] callback Callback function to be invoked when request
1000- * completes
1001- * \param [in,out] context User data passed to the callback function
1002- * \return A handle that can be passed to mir_wait_for
1003- */
1004-MirWaitHandle *mir_connect(
1005- char const *server,
1006- char const *app_name,
1007- mir_connected_callback callback,
1008- void *context);
1009-
1010-/**
1011- * Perform a mir_connect() but also wait for and return the result.
1012- * \param [in] server File path of the server socket to connect to, or
1013- * NULL to choose the default server
1014- * \param [in] app_name A name referring to the application
1015- * \return The resulting MirConnection
1016- */
1017-MirConnection *mir_connect_sync(char const *server, char const *app_name);
1018-
1019-/**
1020- * Test for a valid connection
1021- * \param [in] connection The connection
1022- * \return True if the supplied connection is valid, or
1023- * false otherwise.
1024- */
1025-MirBool mir_connection_is_valid(MirConnection *connection);
1026-
1027-/**
1028- * Retrieve a text description of the last error. The returned string is owned
1029- * by the library and remains valid until the connection has been released.
1030- * \param [in] connection The connection
1031- * \return A text description of any error resulting in an
1032- * invalid connection, or the empty string "" if the
1033- * connection is valid.
1034- */
1035-char const *mir_connection_get_error_message(MirConnection *connection);
1036-
1037-/**
1038- * Release a connection to the Mir server
1039- * \param [in] connection The connection
1040- */
1041-void mir_connection_release(MirConnection *connection);
1042-
1043-/**
1044- * Query platform-specific data and/or file descriptors that are required to
1045- * initialize GL/EGL features.
1046- * \param [in] connection The connection
1047- * \param [out] platform_package Structure to be populated
1048- */
1049-void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package);
1050-
1051-/**
1052- * Register a callback to be called when a Lifecycle state change occurs.
1053- * \param [in] connection The connection
1054- * \param [in] callback The function to be called when the state change occurs
1055- * \param [in,out] context User data passed to the callback function
1056- */
1057-void mir_connection_set_lifecycle_event_callback(MirConnection* connection,
1058- mir_lifecycle_event_callback callback, void* context);
1059-
1060-/**
1061- * \deprecated Use mir_connection_create_display_config
1062- */
1063-__attribute__((__deprecated__("Use mir_connection_create_display_config()")))
1064-void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info);
1065-
1066-/**
1067- * Query the display
1068- * \warning return value must be destroyed via mir_display_config_destroy()
1069- * \warning may return null if connection is invalid
1070- * \param [in] connection The connection
1071- * \return structure that describes the display configuration
1072- */
1073-MirDisplayConfiguration* mir_connection_create_display_config(MirConnection *connection);
1074-
1075-/**
1076- * Register a callback to be called when the hardware display configuration changes
1077- *
1078- * Once a change has occurred, you can use mir_connection_create_display_config to see
1079- * the new configuration.
1080- *
1081- * \param [in] connection The connection
1082- * \param [in] callback The function to be called when a display change occurs
1083- * \param [in,out] context User data passed to the callback function
1084- */
1085-void mir_connection_set_display_config_change_callback(
1086- MirConnection* connection,
1087- mir_display_config_callback callback, void* context);
1088-
1089-/**
1090- * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config
1091- * \param [in] display_configuration The display_configuration information resource to be destroyed
1092- */
1093-void mir_display_config_destroy(MirDisplayConfiguration* display_configuration);
1094-
1095-/**
1096- * Apply the display configuration
1097- *
1098- * The display configuration is applied to this connection only (per-connection
1099- * configuration) and is invalidated when a hardware change occurs. Clients should
1100- * register a callback with mir_connection_set_display_config_change_callback()
1101- * to get notified about hardware changes, so that the can apply a new configuration.
1102- *
1103- * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message.
1104- * \param [in] connection The connection
1105- * \param [in] display_configuration The display_configuration to apply
1106- * \return A handle that can be passed to mir_wait_for
1107- */
1108-MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration);
1109-
1110-/**
1111- * Get a display type that can be used for OpenGL ES 2.0 acceleration.
1112- * \param [in] connection The connection
1113- * \return An EGLNativeDisplayType that the client can use
1114- */
1115-MirEGLNativeDisplayType mir_connection_get_egl_native_display(MirConnection *connection);
1116-
1117-/**
1118- * Get the list of possible formats that a surface can be created with.
1119- * \param [in] connection The connection
1120- * \param [out] formats List of valid formats to create surfaces with
1121- * \param [in] formats_size size of formats list
1122- * \param [out] num_valid_formats number of valid formats returned in formats
1123- */
1124-void mir_connection_get_available_surface_formats(
1125- MirConnection* connection, MirPixelFormat* formats,
1126- unsigned const int format_size, unsigned int *num_valid_formats);
1127-
1128-/**
1129- * Request a new Mir surface on the supplied connection with the supplied
1130- * parameters. The returned handle remains valid until the surface has been
1131- * released.
1132- * \warning callback could be called from another thread. You must do any
1133- * locking appropriate to protect your data accessed in the
1134- * callback.
1135- * \param [in] connection The connection
1136- * \param [in] surface_parameters Request surface parameters
1137- * \param [in] callback Callback function to be invoked when
1138- * request completes
1139- * \param [in,out] context User data passed to the callback function
1140- * \return A handle that can be passed to
1141- * mir_wait_for
1142- */
1143-MirWaitHandle *mir_connection_create_surface(
1144- MirConnection *connection,
1145- MirSurfaceParameters const *surface_parameters,
1146- mir_surface_callback callback,
1147- void *context);
1148-
1149-/**
1150- * Create a surface like in mir_connection_create_surface(), but also wait for
1151- * creation to complete and return the resulting surface.
1152- * \param [in] connection The connection
1153- * \param [in] params Parameters describing the desired surface
1154- * \return The resulting surface
1155- */
1156-MirSurface *mir_connection_create_surface_sync(
1157- MirConnection *connection,
1158- MirSurfaceParameters const *params);
1159-
1160-/**
1161- * Set the event handler to be called when events arrive for a surface.
1162- * \warning event_handler could be called from another thread. You must do
1163- * any locking appropriate to protect your data accessed in the
1164- * callback. There is also a chance that different events will be
1165- * called back in different threads, for the same surface,
1166- * simultaneously.
1167- * \param [in] surface The surface
1168- * \param [in] event_handler The event handler to call
1169- */
1170-void mir_surface_set_event_handler(MirSurface *surface,
1171- MirEventDelegate const *event_handler);
1172-
1173-/**
1174- * Get a window type that can be used for OpenGL ES 2.0 acceleration.
1175- * \param [in] surface The surface
1176- * \return An EGLNativeWindowType that the client can use
1177- */
1178-MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface);
1179-
1180-/**
1181- * Test for a valid surface
1182- * \param [in] surface The surface
1183- * \return True if the supplied surface is valid, or
1184- * false otherwise.
1185- */
1186-MirBool mir_surface_is_valid(MirSurface *surface);
1187-
1188-/**
1189- * Retrieve a text description of the error. The returned string is owned by
1190- * the library and remains valid until the surface or the associated
1191- * connection has been released.
1192- * \param [in] surface The surface
1193- * \return A text description of any error resulting in an
1194- * invalid surface, or the empty string "" if the
1195- * connection is valid.
1196- */
1197-char const *mir_surface_get_error_message(MirSurface *surface);
1198-
1199-/**
1200- * Get a surface's parameters.
1201- * \pre The surface is valid
1202- * \param [in] surface The surface
1203- * \param [out] parameters Structure to be populated
1204- */
1205-void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters);
1206-
1207-/**
1208- * Get the underlying platform type so the buffer obtained in "raw" representation
1209- * in mir_surface_get_current_buffer() can be understood
1210- * \pre The surface is valid
1211- * \param [in] surface The surface
1212- * \return One of mir_platform_type_android or mir_platform_type_gbm
1213- */
1214-MirPlatformType mir_surface_get_platform_type(MirSurface *surface);
1215-
1216-/**
1217- * Get a surface's buffer in "raw" representation.
1218- * \pre The surface is valid
1219- * \param [in] surface The surface
1220- * \param [out] buffer_package Structure to be populated
1221- */
1222-void mir_surface_get_current_buffer(MirSurface *surface, MirNativeBuffer **buffer_package);
1223-
1224-/**
1225- * Get a surface's graphics_region, i.e., map the graphics buffer to main
1226- * memory.
1227- * \pre The surface is valid
1228- * \param [in] surface The surface
1229- * \param [out] graphics_region Structure to be populated
1230- */
1231-void mir_surface_get_graphics_region(
1232- MirSurface *surface,
1233- MirGraphicsRegion *graphics_region);
1234-
1235-/**
1236- * Advance a surface's buffer. The returned handle remains valid until the next
1237- * call to mir_surface_swap_buffers, until the surface has been released or the
1238- * connection to the server has been released.
1239- * \warning callback could be called from another thread. You must do any
1240- * locking appropriate to protect your data accessed in the
1241- * callback.
1242- * \param [in] surface The surface
1243- * \param [in] callback Callback function to be invoked when the request
1244- * completes
1245- * \param [in,out] context User data passed to the callback function
1246- * \return A handle that can be passed to mir_wait_for
1247- */
1248-MirWaitHandle *mir_surface_swap_buffers(
1249- MirSurface *surface,
1250- mir_surface_callback callback,
1251- void *context);
1252-
1253-/**
1254- * Advance a surface's buffer as in mir_surface_swap_buffers(), but also wait
1255- * for the operation to complete.
1256- * \param [in] surface The surface whose buffer to advance
1257- */
1258-void mir_surface_swap_buffers_sync(MirSurface *surface);
1259-
1260-/**
1261- * Release the supplied surface and any associated buffer. The returned wait
1262- * handle remains valid until the connection to the server is released.
1263- * \warning callback could be called from another thread. You must do any
1264- * locking appropriate to protect your data accessed in the
1265- * callback.
1266- * \param [in] surface The surface
1267- * \param [in] callback Callback function to be invoked when the request
1268- * completes
1269- * \param [in,out] context User data passed to the callback function
1270- * \return A handle that can be passed to mir_wait_for
1271- */
1272-MirWaitHandle *mir_surface_release(
1273- MirSurface *surface,
1274- mir_surface_callback callback,
1275- void *context);
1276-
1277-/**
1278- * Release the specified surface like in mir_surface_release(), but also wait
1279- * for the operation to complete.
1280- * \param [in] surface The surface to be released
1281- */
1282-void mir_surface_release_sync(MirSurface *surface);
1283-
1284-/**
1285- * Wait on the supplied handle until all instances of the associated request
1286- * have completed.
1287- * \param [in] wait_handle Handle returned by an asynchronous request
1288- */
1289-void mir_wait_for(MirWaitHandle *wait_handle);
1290-
1291-/**
1292- * Wait on the supplied handle until one instance of the associated request
1293- * has completed. Use this instead of mir_wait_for in a threaded environment
1294- * to ensure that the act of waiting does not clear all results associated
1295- * with the wait handle; only one.
1296- * \param [in] wait_handle Handle returned by an asynchronous request
1297- */
1298-void mir_wait_for_one(MirWaitHandle *wait_handle);
1299-
1300-/**
1301- * \deprecated Use mir_debug_surface_id()
1302- */
1303-__attribute__((__deprecated__("Use mir_debug_surface_id()")))
1304-int mir_surface_get_id(MirSurface *surface);
1305-
1306-/**
1307- * Set the type (purpose) of a surface. This is not guaranteed to always work
1308- * with some shell types (e.g. phone/tablet UIs). As such, you may have to
1309- * wait on the function and check the result using mir_surface_get_type.
1310- * \param [in] surface The surface to operate on
1311- * \param [in] type The new type of the surface
1312- * \return A wait handle that can be passed to mir_wait_for
1313- */
1314-MirWaitHandle* mir_surface_set_type(MirSurface *surface, MirSurfaceType type);
1315-
1316-/**
1317- * Get the type (purpose) of a surface.
1318- * \param [in] surface The surface to query
1319- * \return The type of the surface
1320- */
1321-MirSurfaceType mir_surface_get_type(MirSurface *surface);
1322-
1323-/**
1324- * Change the state of a surface.
1325- * \param [in] surface The surface to operate on
1326- * \param [in] state The new state of the surface
1327- * \return A wait handle that can be passed to mir_wait_for
1328- */
1329-MirWaitHandle* mir_surface_set_state(MirSurface *surface,
1330- MirSurfaceState state);
1331-
1332-/**
1333- * Get the current state of a surface.
1334- * \param [in] surface The surface to query
1335- * \return The state of the surface
1336- */
1337-MirSurfaceState mir_surface_get_state(MirSurface *surface);
1338-
1339-/**
1340- * Set the swapinterval for mir_surface_swap_buffers. EGL users should use
1341- * eglSwapInterval directly.
1342- * At the time being, only swapinterval of 0 or 1 is supported.
1343- * \param [in] surface The surface to operate on
1344- * \param [in] interval The number of vblank signals that
1345- * mir_surface_swap_buffers will wait for
1346- * \return A wait handle that can be passed to mir_wait_for,
1347- * or NULL if the interval could not be supported
1348- */
1349-MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval);
1350-
1351-/**
1352- * Query the swapinterval that the surface is operating with.
1353- * The default interval is 1.
1354- * \param [in] surface The surface to operate on
1355- * \return The swapinterval value that the client is operating with.
1356- * Returns -1 if surface is invalid.
1357- */
1358-int mir_surface_get_swapinterval(MirSurface* surface);
1359-
1360-#ifdef __cplusplus
1361-}
1362-/**@}*/
1363-#endif
1364+#include <mir_toolkit/mir_connection.h>
1365+#include <mir_toolkit/mir_surface.h>
1366+#include <mir_toolkit/mir_wait.h>
1367
1368 #endif /* MIR_CLIENT_LIBRARY_H */
1369
1370=== added file 'include/client/mir_toolkit/mir_connection.h'
1371--- include/client/mir_toolkit/mir_connection.h 1970-01-01 00:00:00 +0000
1372+++ include/client/mir_toolkit/mir_connection.h 2014-04-30 13:15:30 +0000
1373@@ -0,0 +1,178 @@
1374+/*
1375+ * Copyright © 2012-2014 Canonical Ltd.
1376+ *
1377+ * This program is free software: you can redistribute it and/or modify it
1378+ * under the terms of the GNU Lesser General Public License version 3,
1379+ * as published by the Free Software Foundation.
1380+ *
1381+ * This program is distributed in the hope that it will be useful,
1382+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1383+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1384+ * GNU Lesser General Public License for more details.
1385+ *
1386+ * You should have received a copy of the GNU Lesser General Public License
1387+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1388+ *
1389+ */
1390+
1391+#ifndef MIR_TOOLKIT_MIR_CONNECTION_H_
1392+#define MIR_TOOLKIT_MIR_CONNECTION_H_
1393+
1394+#include <mir_toolkit/client_types.h>
1395+#include <mir_toolkit/common.h>
1396+
1397+#ifdef __cplusplus
1398+/**
1399+ * \addtogroup mir_toolkit
1400+ * @{
1401+ */
1402+extern "C" {
1403+#endif
1404+
1405+/**
1406+ * Request a connection to the Mir server. The supplied callback is called when
1407+ * the connection is established, or fails. The returned wait handle remains
1408+ * valid until the connection has been released.
1409+ * \warning callback could be called from another thread. You must do any
1410+ * locking appropriate to protect your data accessed in the
1411+ * callback.
1412+ * \param [in] server File path of the server socket to connect to, or
1413+ * NULL to choose the default server (can be set by
1414+ * the $MIR_SOCKET environment variable)
1415+ * \param [in] app_name A name referring to the application
1416+ * \param [in] callback Callback function to be invoked when request
1417+ * completes
1418+ * \param [in,out] context User data passed to the callback function
1419+ * \return A handle that can be passed to mir_wait_for
1420+ */
1421+MirWaitHandle *mir_connect(
1422+ char const *server,
1423+ char const *app_name,
1424+ mir_connected_callback callback,
1425+ void *context);
1426+
1427+/**
1428+ * Perform a mir_connect() but also wait for and return the result.
1429+ * \param [in] server File path of the server socket to connect to, or
1430+ * NULL to choose the default server
1431+ * \param [in] app_name A name referring to the application
1432+ * \return The resulting MirConnection
1433+ */
1434+MirConnection *mir_connect_sync(char const *server, char const *app_name);
1435+
1436+/**
1437+ * Test for a valid connection
1438+ * \param [in] connection The connection
1439+ * \return True if the supplied connection is valid, or
1440+ * false otherwise.
1441+ */
1442+MirBool mir_connection_is_valid(MirConnection *connection);
1443+
1444+/**
1445+ * Retrieve a text description of the last error. The returned string is owned
1446+ * by the library and remains valid until the connection has been released.
1447+ * \param [in] connection The connection
1448+ * \return A text description of any error resulting in an
1449+ * invalid connection, or the empty string "" if the
1450+ * connection is valid.
1451+ */
1452+char const *mir_connection_get_error_message(MirConnection *connection);
1453+
1454+/**
1455+ * Release a connection to the Mir server
1456+ * \param [in] connection The connection
1457+ */
1458+void mir_connection_release(MirConnection *connection);
1459+
1460+/**
1461+ * Query platform-specific data and/or file descriptors that are required to
1462+ * initialize GL/EGL features.
1463+ * \param [in] connection The connection
1464+ * \param [out] platform_package Structure to be populated
1465+ */
1466+void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package);
1467+
1468+/**
1469+ * Register a callback to be called when a Lifecycle state change occurs.
1470+ * \param [in] connection The connection
1471+ * \param [in] callback The function to be called when the state change occurs
1472+ * \param [in,out] context User data passed to the callback function
1473+ */
1474+void mir_connection_set_lifecycle_event_callback(MirConnection* connection,
1475+ mir_lifecycle_event_callback callback, void* context);
1476+
1477+/**
1478+ * \deprecated Use mir_connection_create_display_config
1479+ */
1480+__attribute__((__deprecated__("Use mir_connection_create_display_config()")))
1481+void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info);
1482+
1483+/**
1484+ * Query the display
1485+ * \warning return value must be destroyed via mir_display_config_destroy()
1486+ * \warning may return null if connection is invalid
1487+ * \param [in] connection The connection
1488+ * \return structure that describes the display configuration
1489+ */
1490+MirDisplayConfiguration* mir_connection_create_display_config(MirConnection *connection);
1491+
1492+/**
1493+ * Register a callback to be called when the hardware display configuration changes
1494+ *
1495+ * Once a change has occurred, you can use mir_connection_create_display_config to see
1496+ * the new configuration.
1497+ *
1498+ * \param [in] connection The connection
1499+ * \param [in] callback The function to be called when a display change occurs
1500+ * \param [in,out] context User data passed to the callback function
1501+ */
1502+void mir_connection_set_display_config_change_callback(
1503+ MirConnection* connection,
1504+ mir_display_config_callback callback, void* context);
1505+
1506+/**
1507+ * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config
1508+ * \param [in] display_configuration The display_configuration information resource to be destroyed
1509+ */
1510+void mir_display_config_destroy(MirDisplayConfiguration* display_configuration);
1511+
1512+/**
1513+ * Apply the display configuration
1514+ *
1515+ * The display configuration is applied to this connection only (per-connection
1516+ * configuration) and is invalidated when a hardware change occurs. Clients should
1517+ * register a callback with mir_connection_set_display_config_change_callback()
1518+ * to get notified about hardware changes, so that the can apply a new configuration.
1519+ *
1520+ * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message.
1521+ * \param [in] connection The connection
1522+ * \param [in] display_configuration The display_configuration to apply
1523+ * \return A handle that can be passed to mir_wait_for
1524+ */
1525+MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration);
1526+
1527+/**
1528+ * Get a display type that can be used for OpenGL ES 2.0 acceleration.
1529+ * \param [in] connection The connection
1530+ * \return An EGLNativeDisplayType that the client can use
1531+ */
1532+MirEGLNativeDisplayType mir_connection_get_egl_native_display(MirConnection *connection);
1533+
1534+/**
1535+ * Get the list of possible formats that a surface can be created with.
1536+ * \param [in] connection The connection
1537+ * \param [out] formats List of valid formats to create surfaces with
1538+ * \param [in] formats_size size of formats list
1539+ * \param [out] num_valid_formats number of valid formats returned in formats
1540+ */
1541+void mir_connection_get_available_surface_formats(
1542+ MirConnection* connection, MirPixelFormat* formats,
1543+ unsigned const int format_size, unsigned int *num_valid_formats);
1544+
1545+
1546+#ifdef __cplusplus
1547+}
1548+/**@}*/
1549+#endif
1550+
1551+#endif /* MIR_TOOLKIT_MIR_CONNECTION_H_ */
1552
1553=== added file 'include/client/mir_toolkit/mir_surface.h'
1554--- include/client/mir_toolkit/mir_surface.h 1970-01-01 00:00:00 +0000
1555+++ include/client/mir_toolkit/mir_surface.h 2014-04-30 13:15:30 +0000
1556@@ -0,0 +1,254 @@
1557+/*
1558+ * Copyright © 2012-2014 Canonical Ltd.
1559+ *
1560+ * This program is free software: you can redistribute it and/or modify it
1561+ * under the terms of the GNU Lesser General Public License version 3,
1562+ * as published by the Free Software Foundation.
1563+ *
1564+ * This program is distributed in the hope that it will be useful,
1565+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1566+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1567+ * GNU Lesser General Public License for more details.
1568+ *
1569+ * You should have received a copy of the GNU Lesser General Public License
1570+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1571+ *
1572+ */
1573+
1574+#ifndef MIR_TOOLKIT_MIR_SURFACE_H_
1575+#define MIR_TOOLKIT_MIR_SURFACE_H_
1576+
1577+#include <mir_toolkit/mir_native_buffer.h>
1578+#include <mir_toolkit/client_types.h>
1579+#include <mir_toolkit/common.h>
1580+
1581+#ifdef __cplusplus
1582+/**
1583+ * \addtogroup mir_toolkit
1584+ * @{
1585+ */
1586+extern "C" {
1587+#endif
1588+
1589+/**
1590+ * Request a new Mir surface on the supplied connection with the supplied
1591+ * parameters. The returned handle remains valid until the surface has been
1592+ * released.
1593+ * \warning callback could be called from another thread. You must do any
1594+ * locking appropriate to protect your data accessed in the
1595+ * callback.
1596+ * \param [in] connection The connection
1597+ * \param [in] surface_parameters Request surface parameters
1598+ * \param [in] callback Callback function to be invoked when
1599+ * request completes
1600+ * \param [in,out] context User data passed to the callback function
1601+ * \return A handle that can be passed to
1602+ * mir_wait_for
1603+ */
1604+MirWaitHandle *mir_connection_create_surface(
1605+ MirConnection *connection,
1606+ MirSurfaceParameters const *surface_parameters,
1607+ mir_surface_callback callback,
1608+ void *context);
1609+
1610+/**
1611+ * Create a surface like in mir_connection_create_surface(), but also wait for
1612+ * creation to complete and return the resulting surface.
1613+ * \param [in] connection The connection
1614+ * \param [in] params Parameters describing the desired surface
1615+ * \return The resulting surface
1616+ */
1617+MirSurface *mir_connection_create_surface_sync(
1618+ MirConnection *connection,
1619+ MirSurfaceParameters const *params);
1620+
1621+/**
1622+ * Set the event handler to be called when events arrive for a surface.
1623+ * \warning event_handler could be called from another thread. You must do
1624+ * any locking appropriate to protect your data accessed in the
1625+ * callback. There is also a chance that different events will be
1626+ * called back in different threads, for the same surface,
1627+ * simultaneously.
1628+ * \param [in] surface The surface
1629+ * \param [in] event_handler The event handler to call
1630+ */
1631+void mir_surface_set_event_handler(MirSurface *surface,
1632+ MirEventDelegate const *event_handler);
1633+
1634+/**
1635+ * Get a window type that can be used for OpenGL ES 2.0 acceleration.
1636+ * \param [in] surface The surface
1637+ * \return An EGLNativeWindowType that the client can use
1638+ */
1639+MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface);
1640+
1641+/**
1642+ * Test for a valid surface
1643+ * \param [in] surface The surface
1644+ * \return True if the supplied surface is valid, or
1645+ * false otherwise.
1646+ */
1647+MirBool mir_surface_is_valid(MirSurface *surface);
1648+
1649+/**
1650+ * Retrieve a text description of the error. The returned string is owned by
1651+ * the library and remains valid until the surface or the associated
1652+ * connection has been released.
1653+ * \param [in] surface The surface
1654+ * \return A text description of any error resulting in an
1655+ * invalid surface, or the empty string "" if the
1656+ * connection is valid.
1657+ */
1658+char const *mir_surface_get_error_message(MirSurface *surface);
1659+
1660+/**
1661+ * Get a surface's parameters.
1662+ * \pre The surface is valid
1663+ * \param [in] surface The surface
1664+ * \param [out] parameters Structure to be populated
1665+ */
1666+void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters);
1667+
1668+/**
1669+ * Get the underlying platform type so the buffer obtained in "raw" representation
1670+ * in mir_surface_get_current_buffer() can be understood
1671+ * \pre The surface is valid
1672+ * \param [in] surface The surface
1673+ * \return One of mir_platform_type_android or mir_platform_type_gbm
1674+ */
1675+MirPlatformType mir_surface_get_platform_type(MirSurface *surface);
1676+
1677+/**
1678+ * Get a surface's buffer in "raw" representation.
1679+ * \pre The surface is valid
1680+ * \param [in] surface The surface
1681+ * \param [out] buffer_package Structure to be populated
1682+ */
1683+void mir_surface_get_current_buffer(MirSurface *surface, MirNativeBuffer **buffer_package);
1684+
1685+/**
1686+ * Get a surface's graphics_region, i.e., map the graphics buffer to main
1687+ * memory.
1688+ * \pre The surface is valid
1689+ * \param [in] surface The surface
1690+ * \param [out] graphics_region Structure to be populated
1691+ */
1692+void mir_surface_get_graphics_region(
1693+ MirSurface *surface,
1694+ MirGraphicsRegion *graphics_region);
1695+
1696+/**
1697+ * Advance a surface's buffer. The returned handle remains valid until the next
1698+ * call to mir_surface_swap_buffers, until the surface has been released or the
1699+ * connection to the server has been released.
1700+ * \warning callback could be called from another thread. You must do any
1701+ * locking appropriate to protect your data accessed in the
1702+ * callback.
1703+ * \param [in] surface The surface
1704+ * \param [in] callback Callback function to be invoked when the request
1705+ * completes
1706+ * \param [in,out] context User data passed to the callback function
1707+ * \return A handle that can be passed to mir_wait_for
1708+ */
1709+MirWaitHandle *mir_surface_swap_buffers(
1710+ MirSurface *surface,
1711+ mir_surface_callback callback,
1712+ void *context);
1713+
1714+/**
1715+ * Advance a surface's buffer as in mir_surface_swap_buffers(), but also wait
1716+ * for the operation to complete.
1717+ * \param [in] surface The surface whose buffer to advance
1718+ */
1719+void mir_surface_swap_buffers_sync(MirSurface *surface);
1720+
1721+/**
1722+ * Release the supplied surface and any associated buffer. The returned wait
1723+ * handle remains valid until the connection to the server is released.
1724+ * \warning callback could be called from another thread. You must do any
1725+ * locking appropriate to protect your data accessed in the
1726+ * callback.
1727+ * \param [in] surface The surface
1728+ * \param [in] callback Callback function to be invoked when the request
1729+ * completes
1730+ * \param [in,out] context User data passed to the callback function
1731+ * \return A handle that can be passed to mir_wait_for
1732+ */
1733+MirWaitHandle *mir_surface_release(
1734+ MirSurface *surface,
1735+ mir_surface_callback callback,
1736+ void *context);
1737+
1738+/**
1739+ * Release the specified surface like in mir_surface_release(), but also wait
1740+ * for the operation to complete.
1741+ * \param [in] surface The surface to be released
1742+ */
1743+void mir_surface_release_sync(MirSurface *surface);
1744+
1745+/**
1746+ * \deprecated Use mir_debug_surface_id()
1747+ */
1748+__attribute__((__deprecated__("Use mir_debug_surface_id()")))
1749+int mir_surface_get_id(MirSurface *surface);
1750+
1751+/**
1752+ * Set the type (purpose) of a surface. This is not guaranteed to always work
1753+ * with some shell types (e.g. phone/tablet UIs). As such, you may have to
1754+ * wait on the function and check the result using mir_surface_get_type.
1755+ * \param [in] surface The surface to operate on
1756+ * \param [in] type The new type of the surface
1757+ * \return A wait handle that can be passed to mir_wait_for
1758+ */
1759+MirWaitHandle* mir_surface_set_type(MirSurface *surface, MirSurfaceType type);
1760+
1761+/**
1762+ * Get the type (purpose) of a surface.
1763+ * \param [in] surface The surface to query
1764+ * \return The type of the surface
1765+ */
1766+MirSurfaceType mir_surface_get_type(MirSurface *surface);
1767+
1768+/**
1769+ * Change the state of a surface.
1770+ * \param [in] surface The surface to operate on
1771+ * \param [in] state The new state of the surface
1772+ * \return A wait handle that can be passed to mir_wait_for
1773+ */
1774+MirWaitHandle* mir_surface_set_state(MirSurface *surface,
1775+ MirSurfaceState state);
1776+
1777+/**
1778+ * Get the current state of a surface.
1779+ * \param [in] surface The surface to query
1780+ * \return The state of the surface
1781+ */
1782+MirSurfaceState mir_surface_get_state(MirSurface *surface);
1783+
1784+/**
1785+ * Set the swapinterval for mir_surface_swap_buffers. EGL users should use
1786+ * eglSwapInterval directly.
1787+ * At the time being, only swapinterval of 0 or 1 is supported.
1788+ * \param [in] surface The surface to operate on
1789+ * \param [in] interval The number of vblank signals that
1790+ * mir_surface_swap_buffers will wait for
1791+ * \return A wait handle that can be passed to mir_wait_for,
1792+ * or NULL if the interval could not be supported
1793+ */
1794+MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval);
1795+
1796+/**
1797+ * Query the swapinterval that the surface is operating with.
1798+ * The default interval is 1.
1799+ * \param [in] surface The surface to operate on
1800+ * \return The swapinterval value that the client is operating with.
1801+ * Returns -1 if surface is invalid.
1802+ */
1803+int mir_surface_get_swapinterval(MirSurface* surface);
1804+
1805+#ifdef __cplusplus
1806+}
1807+/**@}*/
1808+#endif
1809+
1810+#endif /* MIR_TOOLKIT_MIR_SURFACE_H_ */
1811
1812=== added file 'include/client/mir_toolkit/mir_wait.h'
1813--- include/client/mir_toolkit/mir_wait.h 1970-01-01 00:00:00 +0000
1814+++ include/client/mir_toolkit/mir_wait.h 2014-04-30 13:15:30 +0000
1815@@ -0,0 +1,55 @@
1816+/*
1817+ * Copyright © 2012-2014 Canonical Ltd.
1818+ *
1819+ * This program is free software: you can redistribute it and/or modify it
1820+ * under the terms of the GNU Lesser General Public License version 3,
1821+ * as published by the Free Software Foundation.
1822+ *
1823+ * This program is distributed in the hope that it will be useful,
1824+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1825+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1826+ * GNU Lesser General Public License for more details.
1827+ *
1828+ * You should have received a copy of the GNU Lesser General Public License
1829+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1830+ *
1831+ */
1832+
1833+#ifndef MIR_TOOLKIT_MIR_WAIT_H_
1834+#define MIR_TOOLKIT_MIR_WAIT_H_
1835+
1836+#include <mir_toolkit/client_types.h>
1837+
1838+#ifdef __cplusplus
1839+/**
1840+ * \addtogroup mir_toolkit
1841+ * @{
1842+ */
1843+extern "C" {
1844+#endif
1845+
1846+struct MirWaitHandle;
1847+
1848+/**
1849+ * Wait on the supplied handle until all instances of the associated request
1850+ * have completed.
1851+ * \param [in] wait_handle Handle returned by an asynchronous request
1852+ */
1853+void mir_wait_for(MirWaitHandle *wait_handle);
1854+
1855+/**
1856+ * Wait on the supplied handle until one instance of the associated request
1857+ * has completed. Use this instead of mir_wait_for in a threaded environment
1858+ * to ensure that the act of waiting does not clear all results associated
1859+ * with the wait handle; only one.
1860+ * \param [in] wait_handle Handle returned by an asynchronous request
1861+ */
1862+void mir_wait_for_one(MirWaitHandle *wait_handle);
1863+
1864+
1865+#ifdef __cplusplus
1866+}
1867+/**@}*/
1868+#endif
1869+
1870+#endif /* MIR_TOOLKIT_MIR_WAIT_H_ */
1871
1872=== added file 'include/platform/mir/graphics/gl_program_factory.h'
1873--- include/platform/mir/graphics/gl_program_factory.h 1970-01-01 00:00:00 +0000
1874+++ include/platform/mir/graphics/gl_program_factory.h 2014-04-30 13:15:30 +0000
1875@@ -0,0 +1,50 @@
1876+/*
1877+ * Copyright © 2014 Canonical Ltd.
1878+ *
1879+ * This program is free software: you can redistribute it and/or modify it
1880+ * under the terms of the GNU Lesser General Public License version 3,
1881+ * as published by the Free Software Foundation.
1882+ *
1883+ * This program is distributed in the hope that it will be useful,
1884+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1885+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1886+ * GNU Lesser General Public License for more details.
1887+ *
1888+ * You should have received a copy of the GNU Lesser General Public License
1889+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1890+ *
1891+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1892+ */
1893+
1894+#ifndef MIR_COMPOSITOR_GL_PROGRAM_FACTORY_H_
1895+#define MIR_COMPOSITOR_GL_PROGRAM_FACTORY_H_
1896+
1897+#include "mir/graphics/gl_program.h"
1898+#include <memory>
1899+
1900+namespace mir
1901+{
1902+namespace graphics
1903+{
1904+
1905+class GLProgramFactory
1906+{
1907+public:
1908+ virtual ~GLProgramFactory() = default;
1909+
1910+ virtual std::unique_ptr<GLProgram>
1911+ create_gl_program(std::string const&, std::string const&) const = 0;
1912+
1913+protected:
1914+ GLProgramFactory() = default;
1915+
1916+private:
1917+ GLProgramFactory(GLProgramFactory const&) = delete;
1918+ GLProgramFactory& operator=(GLProgramFactory const&) = delete;
1919+
1920+};
1921+
1922+}
1923+}
1924+
1925+#endif /* MIR_COMPOSITOR_GL_PROGRAM_FACTORY_H_ */
1926
1927=== modified file 'include/platform/mir/graphics/renderable.h'
1928--- include/platform/mir/graphics/renderable.h 2014-03-28 22:40:30 +0000
1929+++ include/platform/mir/graphics/renderable.h 2014-04-30 13:15:30 +0000
1930@@ -33,6 +33,14 @@
1931 class Renderable
1932 {
1933 public:
1934+ typedef void const* ID; // Mostly opaque, but zero is reserved as "invalid"
1935+
1936+ /**
1937+ * Return a unique ID for the renderable, which may or may not be based
1938+ * on the underlying surface ID. You should not assume they are related.
1939+ */
1940+ virtual ID id() const = 0;
1941+
1942 /**
1943 * Return the next buffer that should be composited/rendered.
1944 *
1945
1946=== modified file 'include/server/mir/compositor/gl_renderer.h'
1947--- include/server/mir/compositor/gl_renderer.h 2014-03-26 05:48:59 +0000
1948+++ include/server/mir/compositor/gl_renderer.h 2014-04-30 13:15:30 +0000
1949@@ -20,10 +20,14 @@
1950 #define MIR_COMPOSITOR_GL_RENDERER_H_
1951
1952 #include <mir/compositor/renderer.h>
1953+#include <mir/graphics/gl_program.h>
1954 #include <mir/geometry/rectangle.h>
1955 #include <mir/graphics/buffer_id.h>
1956+#include <mir/graphics/renderable.h>
1957+#include <mir/graphics/gl_program_factory.h>
1958 #include <GLES2/gl2.h>
1959 #include <unordered_map>
1960+#include <unordered_set>
1961 #include <vector>
1962
1963 namespace mir
1964@@ -34,15 +38,16 @@
1965 class GLRenderer : public Renderer
1966 {
1967 public:
1968- GLRenderer(geometry::Rectangle const& display_area);
1969+ GLRenderer(
1970+ graphics::GLProgramFactory const& program_factory,
1971+ geometry::Rectangle const& display_area);
1972 virtual ~GLRenderer() noexcept;
1973
1974 // These are called with a valid GL context:
1975 void set_viewport(geometry::Rectangle const& rect) override;
1976 void set_rotation(float degrees) override;
1977 void begin() const override;
1978- void render(graphics::Renderable const& renderable,
1979- graphics::Buffer& buffer) const override;
1980+ void render(graphics::Renderable const& renderable) const override;
1981 void end() const override;
1982
1983 // This is called _without_ a GL context:
1984@@ -96,9 +101,7 @@
1985 graphics::Buffer& buffer) const;
1986
1987 private:
1988- GLuint vertex_shader;
1989- GLuint fragment_shader;
1990- GLuint program;
1991+ std::unique_ptr<graphics::GLProgram> program;
1992 GLuint position_attr_loc;
1993 GLuint texcoord_attr_loc;
1994 GLuint centre_uniform_loc;
1995@@ -109,14 +112,14 @@
1996
1997 geometry::Rectangle viewport;
1998
1999- typedef graphics::Renderable const* SurfaceID;
2000 struct Texture
2001 {
2002 GLuint id = 0;
2003 graphics::BufferID origin;
2004 bool used;
2005 };
2006- mutable std::unordered_map<SurfaceID, Texture> textures;
2007+ mutable std::unordered_map<graphics::Renderable::ID, Texture> textures;
2008+ mutable std::unordered_set<std::shared_ptr<graphics::Buffer>> saved_resources;
2009 mutable bool skipped = false;
2010
2011 };
2012
2013=== modified file 'include/server/mir/compositor/renderer.h'
2014--- include/server/mir/compositor/renderer.h 2014-03-26 05:48:59 +0000
2015+++ include/server/mir/compositor/renderer.h 2014-04-30 13:15:30 +0000
2016@@ -39,11 +39,7 @@
2017 virtual void set_viewport(geometry::Rectangle const& rect) = 0;
2018 virtual void set_rotation(float degrees) = 0;
2019 virtual void begin() const = 0;
2020-
2021- // XXX The buffer parameter here could now be replaced with
2022- // renderable::buffer().
2023- virtual void render(graphics::Renderable const& renderable,
2024- graphics::Buffer& buffer) const = 0;
2025+ virtual void render(graphics::Renderable const& renderable) const = 0;
2026 virtual void end() const = 0;
2027
2028 virtual void suspend() = 0; // called when begin/render/end skipped
2029
2030=== modified file 'include/server/mir/compositor/scene.h'
2031--- include/server/mir/compositor/scene.h 2014-03-31 17:06:37 +0000
2032+++ include/server/mir/compositor/scene.h 2014-04-30 13:15:30 +0000
2033@@ -27,37 +27,9 @@
2034
2035 namespace mir
2036 {
2037-namespace graphics { class Renderable; }
2038 namespace compositor
2039 {
2040
2041-class FilterForScene
2042-{
2043-public:
2044- virtual ~FilterForScene() {}
2045-
2046- virtual bool operator()(graphics::Renderable const&) = 0;
2047-
2048-protected:
2049- FilterForScene() = default;
2050- FilterForScene(const FilterForScene&) = delete;
2051- FilterForScene& operator=(const FilterForScene&) = delete;
2052-};
2053-
2054-class OperatorForScene
2055-{
2056-public:
2057- virtual ~OperatorForScene() {}
2058-
2059- virtual void operator()(graphics::Renderable const&) = 0;
2060-
2061-protected:
2062- OperatorForScene() = default;
2063- OperatorForScene(const OperatorForScene&) = delete;
2064- OperatorForScene& operator=(const OperatorForScene&) = delete;
2065-
2066-};
2067-
2068 class Scene
2069 {
2070 public:
2071@@ -69,9 +41,6 @@
2072 */
2073 virtual graphics::RenderableList generate_renderable_list() const = 0;
2074
2075- // Back to front; normal rendering order
2076- virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0;
2077-
2078 /**
2079 * Sets a callback to be called whenever the state of the
2080 * Scene changes.
2081@@ -82,10 +51,6 @@
2082 */
2083 virtual void set_change_callback(std::function<void()> const& f) = 0;
2084
2085- // Implement BasicLockable, to temporarily lock scene state:
2086- virtual void lock() = 0;
2087- virtual void unlock() = 0;
2088-
2089 protected:
2090 Scene() = default;
2091
2092
2093=== modified file 'include/server/mir/default_server_configuration.h'
2094--- include/server/mir/default_server_configuration.h 2014-03-31 10:59:59 +0000
2095+++ include/server/mir/default_server_configuration.h 2014-04-30 13:15:30 +0000
2096@@ -54,11 +54,8 @@
2097
2098 namespace shell
2099 {
2100-class SurfaceFactory;
2101 class InputTargeter;
2102 class FocusSetter;
2103-class PlacementStrategy;
2104-class SessionListener;
2105 class FocusController;
2106 class DisplayLayout;
2107 }
2108@@ -73,17 +70,17 @@
2109 class BufferStreamFactory;
2110 class MediatingDisplayChanger;
2111 class PixelBuffer;
2112+class PlacementStrategy;
2113 class SessionContainer;
2114 class SessionEventSink;
2115 class SessionEventHandlerRegister;
2116+class SessionListener;
2117 class SessionManager;
2118 class SnapshotStrategy;
2119 class SurfaceCoordinator;
2120 class SurfaceConfigurator;
2121 class SurfaceStackModel;
2122 class SurfaceStack;
2123-class SurfaceRanker;
2124-class SurfaceController;
2125 class InputRegistrar;
2126 class SceneReport;
2127 }
2128@@ -95,6 +92,7 @@
2129 class DisplayReport;
2130 class GraphicBufferAllocator;
2131 class GLConfig;
2132+class GLProgramFactory;
2133 namespace nested { class HostConnection; }
2134 }
2135 namespace input
2136@@ -200,10 +198,9 @@
2137 /** @name shell configuration - customization
2138 * configurable interfaces for modifying shell
2139 * @{ */
2140- virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory();
2141 virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter();
2142- virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy();
2143- virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener();
2144+ virtual std::shared_ptr<scene::PlacementStrategy> the_placement_strategy();
2145+ virtual std::shared_ptr<scene::SessionListener> the_session_listener();
2146 virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout();
2147 /** @} */
2148
2149@@ -217,7 +214,6 @@
2150 virtual std::shared_ptr<scene::SessionEventSink> the_session_event_sink();
2151 virtual std::shared_ptr<scene::SessionEventHandlerRegister> the_session_event_handler_register();
2152 virtual std::shared_ptr<scene::SurfaceStackModel> the_surface_stack_model();
2153- virtual std::shared_ptr<scene::SurfaceRanker> the_surface_ranker();
2154 virtual std::shared_ptr<scene::SurfaceFactory> the_surface_factory();
2155 virtual std::shared_ptr<scene::SurfaceCoordinator>the_surface_coordinator();
2156 virtual std::shared_ptr<scene::SurfaceConfigurator> the_surface_configurator();
2157@@ -252,6 +248,7 @@
2158 protected:
2159 std::shared_ptr<options::Option> the_options() const;
2160
2161+ virtual std::shared_ptr<graphics::GLProgramFactory> the_gl_program_factory();
2162 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();
2163 virtual std::shared_ptr<scene::MediatingDisplayChanger> the_mediating_display_changer();
2164 virtual std::shared_ptr<frontend::ProtobufIpcFactory> the_ipc_factory(
2165@@ -287,12 +284,12 @@
2166 CachedPtr<scene::SurfaceStack> surface_stack;
2167 CachedPtr<scene::SceneReport> scene_report;
2168
2169- CachedPtr<shell::SurfaceFactory> shell_surface_factory;
2170 CachedPtr<scene::SurfaceFactory> surface_factory;
2171 CachedPtr<scene::SessionContainer> session_container;
2172+ CachedPtr<scene::SurfaceCoordinator> surface_coordinator;
2173 CachedPtr<shell::FocusSetter> shell_focus_setter;
2174- CachedPtr<shell::PlacementStrategy> shell_placement_strategy;
2175- CachedPtr<shell::SessionListener> shell_session_listener;
2176+ CachedPtr<scene::PlacementStrategy> shell_placement_strategy;
2177+ CachedPtr<scene::SessionListener> session_listener;
2178 CachedPtr<scene::PixelBuffer> pixel_buffer;
2179 CachedPtr<scene::SnapshotStrategy> snapshot_strategy;
2180 CachedPtr<shell::DisplayLayout> shell_display_layout;
2181@@ -308,6 +305,7 @@
2182 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;
2183 CachedPtr<graphics::nested::HostConnection> host_connection;
2184 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;
2185+ CachedPtr<graphics::GLProgramFactory> gl_program_factory;
2186 CachedPtr<graphics::GLConfig> gl_config;
2187
2188 private:
2189@@ -320,13 +318,11 @@
2190 // default implementations of corresponding the Mir components
2191 CachedPtr<scene::BroadcastingSessionEventSink> broadcasting_session_event_sink;
2192 CachedPtr<input::NestedInputRelay> nested_input_relay;
2193- CachedPtr<scene::SurfaceController> surface_controller;
2194 CachedPtr<scene::SessionManager> session_manager;
2195
2196 std::shared_ptr<scene::BroadcastingSessionEventSink> the_broadcasting_session_event_sink();
2197 std::shared_ptr<input::NestedInputRelay> the_nested_input_relay();
2198 std::shared_ptr<scene::SessionManager> the_session_manager();
2199- std::shared_ptr<scene::SurfaceController> the_surface_controller();
2200
2201 auto report_factory(char const* report_opt) -> std::unique_ptr<report::ReportFactory>;
2202 };
2203
2204=== modified file 'include/server/mir/frontend/session.h'
2205--- include/server/mir/frontend/session.h 2013-08-28 03:41:48 +0000
2206+++ include/server/mir/frontend/session.h 2014-04-30 13:15:30 +0000
2207@@ -29,7 +29,7 @@
2208
2209 namespace mir
2210 {
2211-namespace shell
2212+namespace scene
2213 {
2214 struct SurfaceCreationParameters;
2215 }
2216@@ -48,7 +48,7 @@
2217 public:
2218 virtual ~Session() {}
2219
2220- virtual SurfaceId create_surface(shell::SurfaceCreationParameters const& params) = 0;
2221+ virtual SurfaceId create_surface(scene::SurfaceCreationParameters const& params) = 0;
2222 virtual void destroy_surface(SurfaceId surface) = 0;
2223 virtual std::shared_ptr<Surface> get_surface(SurfaceId surface) const = 0;
2224
2225@@ -57,9 +57,6 @@
2226 virtual void hide() = 0;
2227 virtual void show() = 0;
2228
2229- virtual void send_display_config(graphics::DisplayConfiguration const&) = 0;
2230- virtual int configure_surface(SurfaceId id, MirSurfaceAttrib attrib, int value) = 0;
2231-
2232 protected:
2233 Session() = default;
2234 Session(Session const&) = delete;
2235
2236=== modified file 'include/server/mir/frontend/shell.h'
2237--- include/server/mir/frontend/shell.h 2014-03-06 06:05:17 +0000
2238+++ include/server/mir/frontend/shell.h 2014-04-30 13:15:30 +0000
2239@@ -27,7 +27,7 @@
2240
2241 namespace mir
2242 {
2243-namespace shell
2244+namespace scene
2245 {
2246 struct SurfaceCreationParameters;
2247 }
2248@@ -48,8 +48,9 @@
2249
2250 virtual void close_session(std::shared_ptr<Session> const& session) = 0;
2251
2252- virtual SurfaceId create_surface_for(std::shared_ptr<Session> const& session,
2253- shell::SurfaceCreationParameters const& params) = 0;
2254+ virtual SurfaceId create_surface_for(
2255+ std::shared_ptr<Session> const& session,
2256+ scene::SurfaceCreationParameters const& params) = 0;
2257
2258 virtual void handle_surface_created(std::shared_ptr<Session> const& session) = 0;
2259
2260
2261=== modified file 'include/server/mir/frontend/surface.h'
2262--- include/server/mir/frontend/surface.h 2014-03-06 06:05:17 +0000
2263+++ include/server/mir/frontend/surface.h 2014-04-30 13:15:30 +0000
2264@@ -51,8 +51,6 @@
2265
2266 virtual ~Surface() {}
2267
2268- virtual void force_requests_to_complete() = 0;
2269-
2270 virtual geometry::Size size() const = 0;
2271 virtual MirPixelFormat pixel_format() const = 0;
2272
2273
2274=== added file 'include/server/mir/graphics/gl_program.h'
2275--- include/server/mir/graphics/gl_program.h 1970-01-01 00:00:00 +0000
2276+++ include/server/mir/graphics/gl_program.h 2014-04-30 13:15:30 +0000
2277@@ -0,0 +1,65 @@
2278+/*
2279+ * Copyright © 2013-2014 Canonical Ltd.
2280+ *
2281+ * This program is free software: you can redistribute it and/or modify it
2282+ * under the terms of the GNU General Public License version 3,
2283+ * as published by the Free Software Foundation.
2284+ *
2285+ * This program is distributed in the hope that it will be useful,
2286+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2287+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2288+ * GNU General Public License for more details.
2289+ *
2290+ * You should have received a copy of the GNU General Public License
2291+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2292+ *
2293+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
2294+ */
2295+
2296+#ifndef MIR_GRAPHICS_GL_PROGRAM_H_
2297+#define MIR_GRAPHICS_GL_PROGRAM_H_
2298+
2299+#include <GLES2/gl2.h>
2300+
2301+namespace mir
2302+{
2303+namespace graphics
2304+{
2305+
2306+class GLShader
2307+{
2308+public:
2309+ GLShader(GLchar const* shader_src, GLuint type);
2310+ ~GLShader();
2311+ operator GLuint() const;
2312+
2313+private:
2314+ GLShader(GLShader const&) = delete;
2315+ GLShader& operator=(GLShader const&) = delete;
2316+
2317+ GLuint const shader;
2318+};
2319+
2320+class GLProgram
2321+{
2322+public:
2323+ GLProgram(
2324+ GLchar const* vertex_shader_src,
2325+ GLchar const* fragment_shader_src);
2326+ ~GLProgram();
2327+
2328+ operator GLuint() const;
2329+
2330+private:
2331+ GLProgram(GLProgram const&) = delete;
2332+ GLProgram& operator=(GLProgram const&) = delete;
2333+
2334+ GLShader const vertex_shader;
2335+ GLShader const fragment_shader;
2336+ GLuint const program;
2337+};
2338+
2339+}
2340+}
2341+
2342+#endif /* MIR_GRAPHICS_GL_PROGRAM_H_ */
2343
2344=== modified file 'include/server/mir/input/input_targets.h'
2345--- include/server/mir/input/input_targets.h 2013-08-28 03:41:48 +0000
2346+++ include/server/mir/input/input_targets.h 2014-04-30 13:15:30 +0000
2347@@ -28,14 +28,14 @@
2348 {
2349 namespace input
2350 {
2351-class InputChannel;
2352+class Surface;
2353
2354 class InputTargets
2355 {
2356 public:
2357 virtual ~InputTargets() = default;
2358
2359- virtual void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback) = 0;
2360+ virtual void for_each(std::function<void(std::shared_ptr<input::Surface> const&)> const& callback) = 0;
2361
2362 protected:
2363 InputTargets() = default;
2364
2365=== modified file 'include/server/mir/input/surface.h'
2366--- include/server/mir/input/surface.h 2014-03-26 05:48:59 +0000
2367+++ include/server/mir/input/surface.h 2014-04-30 13:15:30 +0000
2368@@ -21,12 +21,16 @@
2369
2370 #include "mir/geometry/size.h"
2371 #include "mir/geometry/point.h"
2372+
2373 #include <string>
2374+#include <memory>
2375
2376 namespace mir
2377 {
2378 namespace input
2379 {
2380+class InputChannel;
2381+
2382 class Surface
2383 {
2384 public:
2385@@ -35,6 +39,8 @@
2386 virtual geometry::Size size() const = 0;
2387 virtual bool contains(geometry::Point const& point) const = 0;
2388
2389+ virtual std::shared_ptr<input::InputChannel> input_channel() const = 0;
2390+
2391 protected:
2392 Surface() = default;
2393 virtual ~Surface() = default;
2394
2395=== renamed file 'include/server/mir/shell/null_session_listener.h' => 'include/server/mir/scene/null_session_listener.h'
2396--- include/server/mir/shell/null_session_listener.h 2013-08-28 03:41:48 +0000
2397+++ include/server/mir/scene/null_session_listener.h 2014-04-30 13:15:30 +0000
2398@@ -1,5 +1,5 @@
2399 /*
2400- * Copyright © 2012 Canonical Ltd.
2401+ * Copyright © 2012-2014 Canonical Ltd.
2402 *
2403 * This program is free software: you can redistribute it and/or modify it
2404 * under the terms of the GNU General Public License version 3,
2405@@ -16,17 +16,15 @@
2406 * Authored by: Robert Carr <robert.carr@canonical.com>
2407 */
2408
2409-#ifndef MIR_SHELL_NULL_SESSION_LISTENER_H_
2410-#define MIR_SHELL_NULL_SESSION_LISTENER_H_
2411+#ifndef MIR_SCENE_NULL_SESSION_LISTENER_H_
2412+#define MIR_SCENE_NULL_SESSION_LISTENER_H_
2413
2414-#include "mir/shell/session_listener.h"
2415+#include "mir/scene/session_listener.h"
2416
2417 namespace mir
2418 {
2419-namespace shell
2420+namespace scene
2421 {
2422-class Session;
2423-
2424 class NullSessionListener : public SessionListener
2425 {
2426 public:
2427@@ -49,5 +47,4 @@
2428 }
2429 }
2430
2431-
2432-#endif // MIR_SHELL_NULL_SESSION_LISTENER_H_
2433+#endif // MIR_SCENE_NULL_SESSION_LISTENER_H_
2434
2435=== renamed file 'include/server/mir/shell/placement_strategy.h' => 'include/server/mir/scene/placement_strategy.h'
2436--- include/server/mir/shell/placement_strategy.h 2013-08-28 03:41:48 +0000
2437+++ include/server/mir/scene/placement_strategy.h 2014-04-30 13:15:30 +0000
2438@@ -1,5 +1,5 @@
2439 /*
2440- * Copyright © 2013 Canonical Ltd.
2441+ * Copyright © 2013-2014 Canonical Ltd.
2442 *
2443 * This program is free software: you can redistribute it and/or modify it
2444 * under the terms of the GNU General Public License version 3,
2445@@ -16,13 +16,12 @@
2446 * Authored by: Robert Carr <robert.carr@canonical.com>
2447 */
2448
2449-#ifndef MIR_SHELL_PLACEMENT_STRATEGY_H_
2450-#define MIR_SHELL_PLACEMENT_STRATEGY_H_
2451+#ifndef MIR_SCENE_PLACEMENT_STRATEGY_H_
2452+#define MIR_SCENE_PLACEMENT_STRATEGY_H_
2453
2454 namespace mir
2455 {
2456-
2457-namespace shell
2458+namespace scene
2459 {
2460 class Session;
2461 struct SurfaceCreationParameters;
2462@@ -30,19 +29,16 @@
2463 class PlacementStrategy
2464 {
2465 public:
2466- virtual ~PlacementStrategy() {}
2467- // TODO: It is strange to work in terms of SurfaceCreationParameters here,
2468- // perhaps a new interface is needed.
2469- virtual SurfaceCreationParameters place(shell::Session const& session, SurfaceCreationParameters const& request_parameters) = 0;
2470+ virtual ~PlacementStrategy() = default;
2471
2472+ virtual SurfaceCreationParameters place(Session const& session, SurfaceCreationParameters const& request_parameters) = 0;
2473
2474 protected:
2475 PlacementStrategy() = default;
2476 PlacementStrategy(PlacementStrategy const&) = delete;
2477 PlacementStrategy& operator=(PlacementStrategy const&) = delete;
2478 };
2479-
2480 }
2481 } // namespace mir
2482
2483-#endif // MIR_SHELL_PLACEMENT_STRATEGY_H_
2484+#endif // MIR_SCENE_PLACEMENT_STRATEGY_H_
2485
2486=== renamed file 'include/server/mir/shell/session.h' => 'include/server/mir/scene/session.h'
2487--- include/server/mir/shell/session.h 2014-03-26 05:48:59 +0000
2488+++ include/server/mir/scene/session.h 2014-04-30 13:15:30 +0000
2489@@ -16,17 +16,17 @@
2490 * Authored By: Robert Carr <racarr@canonical.com>
2491 */
2492
2493-#ifndef MIR_SHELL_SESSION_H_
2494-#define MIR_SHELL_SESSION_H_
2495+#ifndef MIR_SCENE_SESSION_H_
2496+#define MIR_SCENE_SESSION_H_
2497
2498 #include "mir/frontend/session.h"
2499-#include "mir/shell/snapshot.h"
2500+#include "mir/scene/snapshot.h"
2501
2502 #include <sys/types.h>
2503
2504 namespace mir
2505 {
2506-namespace shell
2507+namespace scene
2508 {
2509 class Surface;
2510
2511@@ -39,8 +39,9 @@
2512 virtual void take_snapshot(SnapshotCallback const& snapshot_taken) = 0;
2513 virtual std::shared_ptr<Surface> default_surface() const = 0;
2514 virtual void set_lifecycle_state(MirLifecycleState state) = 0;
2515+ virtual void send_display_config(graphics::DisplayConfiguration const&) = 0;
2516 };
2517 }
2518 }
2519
2520-#endif // MIR_SHELL_SESSION_H_
2521+#endif // MIR_SCENE_SESSION_H_
2522
2523=== renamed file 'include/server/mir/shell/session_listener.h' => 'include/server/mir/scene/session_listener.h'
2524--- include/server/mir/shell/session_listener.h 2014-03-06 06:05:17 +0000
2525+++ include/server/mir/scene/session_listener.h 2014-04-30 13:15:30 +0000
2526@@ -1,5 +1,5 @@
2527 /*
2528- * Copyright © 2012 Canonical Ltd.
2529+ * Copyright © 2012-2014 Canonical Ltd.
2530 *
2531 * This program is free software: you can redistribute it and/or modify it
2532 * under the terms of the GNU General Public License version 3,
2533@@ -16,17 +16,17 @@
2534 * Authored by: Robert Carr <robert.carr@canonical.com>
2535 */
2536
2537-#ifndef MIR_SHELL_SESSION_LISTENER_H_
2538-#define MIR_SHELL_SESSION_LISTENER_H_
2539+#ifndef MIR_SCENE_SESSION_LISTENER_H_
2540+#define MIR_SCENE_SESSION_LISTENER_H_
2541
2542 #include <memory>
2543
2544 namespace mir
2545 {
2546-namespace shell
2547+namespace scene
2548 {
2549+class Surface;
2550 class Session;
2551-class Surface;
2552
2553 class SessionListener
2554 {
2555@@ -51,4 +51,4 @@
2556 }
2557
2558
2559-#endif // MIR_SHELL_SESSION_LISTENER_H_
2560+#endif // MIR_SCENE_SESSION_LISTENER_H_
2561
2562=== renamed file 'include/server/mir/shell/snapshot.h' => 'include/server/mir/scene/snapshot.h'
2563--- include/server/mir/shell/snapshot.h 2014-03-06 06:05:17 +0000
2564+++ include/server/mir/scene/snapshot.h 2014-04-30 13:15:30 +0000
2565@@ -26,7 +26,7 @@
2566
2567 namespace mir
2568 {
2569-namespace shell
2570+namespace scene
2571 {
2572
2573 struct Snapshot
2574
2575=== modified file 'include/server/mir/scene/surface.h'
2576--- include/server/mir/scene/surface.h 2014-03-31 09:27:58 +0000
2577+++ include/server/mir/scene/surface.h 2014-04-30 13:15:30 +0000
2578@@ -21,11 +21,16 @@
2579
2580 #include "mir/graphics/renderable.h"
2581 #include "mir/input/surface.h"
2582-#include "mir/shell/surface.h"
2583+#include "mir/scene/surface_buffer_access.h"
2584+#include "mir/frontend/surface.h"
2585+
2586+#include <vector>
2587
2588 namespace mir
2589 {
2590 namespace input { class InputChannel; }
2591+namespace shell { class InputTargeter; }
2592+namespace geometry { class Rectangle; }
2593
2594 namespace scene
2595 {
2596@@ -34,24 +39,36 @@
2597 class Surface :
2598 public graphics::Renderable,
2599 public input::Surface,
2600- public shell::Surface
2601+ public frontend::Surface,
2602+ public SurfaceBufferAccess
2603 {
2604 public:
2605 // resolve ambiguous member function names
2606- std::string name() const = 0;
2607- geometry::Size size() const = 0;
2608- geometry::Point top_left() const = 0;
2609- float alpha() const = 0;
2610+ std::string name() const override = 0;
2611+ geometry::Size size() const override = 0;
2612+ geometry::Point top_left() const override = 0;
2613+ float alpha() const override = 0;
2614
2615 // member functions that don't exist in base classes
2616- // TODO input_channel() and on_change() relate to
2617- // TODO adding and removing the surface from the scene and are probably not
2618- // TODO cleanest interface for this.
2619- virtual std::shared_ptr<input::InputChannel> input_channel() const = 0;
2620- virtual void on_change(std::function<void()> change_notification) = 0;
2621+ virtual MirSurfaceType type() const = 0;
2622+ virtual MirSurfaceState state() const = 0;
2623+ virtual void hide() = 0;
2624+ virtual void show() = 0;
2625+ virtual void move_to(geometry::Point const& top_left) = 0;
2626+ virtual void take_input_focus(std::shared_ptr<shell::InputTargeter> const& targeter) = 0;
2627+ virtual void set_input_region(std::vector<geometry::Rectangle> const& region) = 0;
2628+ virtual void allow_framedropping(bool) = 0;
2629+ virtual void resize(geometry::Size const& size) = 0;
2630+ virtual void set_transformation(glm::mat4 const& t) = 0;
2631+ virtual void set_alpha(float alpha) = 0;
2632+ virtual void force_requests_to_complete() = 0;
2633
2634 virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
2635 virtual void remove_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
2636+
2637+ // TODO input_channel() relates to adding and removing the surface
2638+ // TODO from the scene and is probably not cleanest interface for this.
2639+ virtual std::shared_ptr<input::InputChannel> input_channel() const = 0;
2640 };
2641 }
2642 }
2643
2644=== renamed file 'include/server/mir/shell/surface_buffer_access.h' => 'include/server/mir/scene/surface_buffer_access.h'
2645--- include/server/mir/shell/surface_buffer_access.h 2013-08-28 03:41:48 +0000
2646+++ include/server/mir/scene/surface_buffer_access.h 2014-04-30 13:15:30 +0000
2647@@ -1,5 +1,5 @@
2648 /*
2649- * Copyright © 2013 Canonical Ltd.
2650+ * Copyright © 2013-2014 Canonical Ltd.
2651 *
2652 * This program is free software: you can redistribute it and/or modify it
2653 * under the terms of the GNU General Public License version 3,
2654@@ -16,8 +16,8 @@
2655 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
2656 */
2657
2658-#ifndef MIR_SHELL_SURFACE_BUFFER_ACCESS_H_
2659-#define MIR_SHELL_SURFACE_BUFFER_ACCESS_H_
2660+#ifndef MIR_SCENE_SURFACE_BUFFER_ACCESS_H_
2661+#define MIR_SCENE_SURFACE_BUFFER_ACCESS_H_
2662
2663 #include <functional>
2664
2665@@ -27,7 +27,7 @@
2666 {
2667 class Buffer;
2668 }
2669-namespace shell
2670+namespace scene
2671 {
2672
2673 class SurfaceBufferAccess
2674@@ -47,4 +47,4 @@
2675 }
2676 }
2677
2678-#endif /* MIR_SHELL_SURFACE_BUFFER_ACCESS_H_ */
2679+#endif /* MIR_SCENE_SURFACE_BUFFER_ACCESS_H_ */
2680
2681=== modified file 'include/server/mir/scene/surface_coordinator.h'
2682--- include/server/mir/scene/surface_coordinator.h 2014-03-28 17:47:07 +0000
2683+++ include/server/mir/scene/surface_coordinator.h 2014-04-30 13:15:30 +0000
2684@@ -20,28 +20,25 @@
2685 #ifndef MIR_SCENE_SURFACE_COORDINATOR_H_
2686 #define MIR_SCENE_SURFACE_COORDINATOR_H_
2687
2688-#include "mir/scene/surface_ranker.h"
2689-
2690 #include <memory>
2691
2692 namespace mir
2693 {
2694-namespace shell
2695-{
2696-struct SurfaceCreationParameters;
2697-}
2698-
2699 namespace scene
2700 {
2701 class Surface;
2702+struct SurfaceCreationParameters;
2703 class SurfaceObserver;
2704+class Session;
2705
2706-class SurfaceCoordinator : public SurfaceRanker
2707+class SurfaceCoordinator
2708 {
2709 public:
2710 virtual std::shared_ptr<Surface> add_surface(
2711- shell::SurfaceCreationParameters const& params,
2712- std::shared_ptr<SurfaceObserver> const& observer) = 0;
2713+ SurfaceCreationParameters const& params,
2714+ Session* session) = 0;
2715+
2716+ virtual void raise(std::weak_ptr<Surface> const& surface) = 0;
2717
2718 virtual void remove_surface(std::weak_ptr<Surface> const& surface) = 0;
2719 protected:
2720
2721=== renamed file 'include/server/mir/shell/surface_creation_parameters.h' => 'include/server/mir/scene/surface_creation_parameters.h'
2722--- include/server/mir/shell/surface_creation_parameters.h 2014-03-06 06:05:17 +0000
2723+++ include/server/mir/scene/surface_creation_parameters.h 2014-04-30 13:15:30 +0000
2724@@ -16,8 +16,8 @@
2725 * Authored by: Alan Griffiths <alan@octopull.co.uk>
2726 */
2727
2728-#ifndef MIR_SHELL_SURFACE_CREATION_PARAMETERS_H_
2729-#define MIR_SHELL_SURFACE_CREATION_PARAMETERS_H_
2730+#ifndef MIR_SCENE_SURFACE_CREATION_PARAMETERS_H_
2731+#define MIR_SCENE_SURFACE_CREATION_PARAMETERS_H_
2732
2733 #include "mir_toolkit/common.h"
2734 #include "mir/geometry/point.h"
2735@@ -32,7 +32,7 @@
2736
2737 namespace mir
2738 {
2739-namespace shell
2740+namespace scene
2741 {
2742
2743 struct SurfaceCreationParameters
2744@@ -74,4 +74,4 @@
2745 }
2746 }
2747
2748-#endif /* MIR_SHELL_SURFACE_CREATION_PARAMETERS_H_ */
2749+#endif /* MIR_SCENE_SURFACE_CREATION_PARAMETERS_H_ */
2750
2751=== modified file 'include/server/mir/scene/surface_event_source.h'
2752--- include/server/mir/scene/surface_event_source.h 2014-03-31 09:02:16 +0000
2753+++ include/server/mir/scene/surface_event_source.h 2014-04-30 13:15:30 +0000
2754@@ -36,8 +36,8 @@
2755 frontend::SurfaceId id,
2756 std::shared_ptr<frontend::EventSink> const& event_sink);
2757
2758- void attrib_change(MirSurfaceAttrib attrib, int value);
2759- void resize(geometry::Size const& size);
2760+ void attrib_changed(MirSurfaceAttrib attrib, int value);
2761+ void resized_to(geometry::Size const& size);
2762
2763 private:
2764 frontend::SurfaceId const id;
2765
2766=== modified file 'include/server/mir/scene/surface_factory.h'
2767--- include/server/mir/scene/surface_factory.h 2014-03-31 10:18:49 +0000
2768+++ include/server/mir/scene/surface_factory.h 2014-04-30 13:15:30 +0000
2769@@ -19,7 +19,7 @@
2770 #ifndef MIR_SCENE_SURFACE_FACTORY_H_
2771 #define MIR_SCENE_SURFACE_FACTORY_H_
2772
2773-#include "mir/shell/surface_creation_parameters.h"
2774+#include "mir/scene/surface_creation_parameters.h"
2775 #include <memory>
2776
2777 namespace mir
2778@@ -34,8 +34,7 @@
2779 SurfaceFactory() = default;
2780 virtual ~SurfaceFactory() = default;
2781
2782- virtual std::shared_ptr<Surface> create_surface(
2783- shell::SurfaceCreationParameters const& params) = 0;
2784+ virtual std::shared_ptr<Surface> create_surface(SurfaceCreationParameters const& params) = 0;
2785
2786 private:
2787 SurfaceFactory(const SurfaceFactory&) = delete;
2788
2789=== modified file 'include/server/mir/scene/surface_observer.h'
2790--- include/server/mir/scene/surface_observer.h 2014-03-31 09:02:16 +0000
2791+++ include/server/mir/scene/surface_observer.h 2014-04-30 13:15:30 +0000
2792@@ -19,19 +19,30 @@
2793 #ifndef MIR_SCENE_SURFACE_OBSERVER_H_
2794 #define MIR_SCENE_SURFACE_OBSERVER_H_
2795
2796-#include "mir/geometry/size.h"
2797 #include "mir_toolkit/common.h"
2798
2799+#include <glm/glm.hpp>
2800+
2801 namespace mir
2802 {
2803+namespace geometry
2804+{
2805+struct Size;
2806+struct Point;
2807+}
2808+
2809 namespace scene
2810 {
2811-// Initial cut - supporting the frontend requirement, more will follow
2812 class SurfaceObserver
2813 {
2814 public:
2815- virtual void attrib_change(MirSurfaceAttrib attrib, int value) = 0;
2816- virtual void resize(geometry::Size const& size) = 0;
2817+ virtual void attrib_changed(MirSurfaceAttrib attrib, int value);
2818+ virtual void resized_to(geometry::Size const& size);
2819+ virtual void moved_to(geometry::Point const& top_left);
2820+ virtual void hidden_set_to(bool hide);
2821+ virtual void frame_posted();
2822+ virtual void alpha_set_to(float alpha);
2823+ virtual void transformation_set_to(glm::mat4 const& t);
2824
2825 protected:
2826 SurfaceObserver() = default;
2827
2828=== removed file 'include/server/mir/scene/surface_ranker.h'
2829--- include/server/mir/scene/surface_ranker.h 2014-03-26 14:20:14 +0000
2830+++ include/server/mir/scene/surface_ranker.h 1970-01-01 00:00:00 +0000
2831@@ -1,46 +0,0 @@
2832-/*
2833- * Copyright © 2013 Canonical Ltd.
2834- *
2835- * This program is free software: you can redistribute it and/or modify it
2836- * under the terms of the GNU General Public License version 3,
2837- * as published by the Free Software Foundation.
2838- *
2839- * This program is distributed in the hope that it will be useful,
2840- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2841- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2842- * GNU General Public License for more details.
2843- *
2844- * You should have received a copy of the GNU General Public License
2845- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2846- *
2847- * Authored by: Robert Carr <robert.carr@canonical.com>
2848- */
2849-
2850-
2851-#ifndef MIR_SHELL_SURFACE_RANKER_H_
2852-#define MIR_SHELL_SURFACE_RANKER_H_
2853-
2854-#include <memory>
2855-
2856-namespace mir
2857-{
2858-namespace scene
2859-{
2860-class Surface;
2861-
2862-class SurfaceRanker
2863-{
2864-public:
2865- virtual void raise(std::weak_ptr<Surface> const& surface) = 0;
2866-
2867-protected:
2868- SurfaceRanker() = default;
2869- virtual ~SurfaceRanker() = default;
2870- SurfaceRanker(SurfaceRanker const&) = delete;
2871- SurfaceRanker& operator=(SurfaceRanker const&) = delete;
2872-};
2873-}
2874-}
2875-
2876-
2877-#endif /* MIR_SHELL_SURFACE_RANKER_H_ */
2878
2879=== modified file 'include/server/mir/shell/focus_controller.h'
2880--- include/server/mir/shell/focus_controller.h 2014-03-06 06:05:17 +0000
2881+++ include/server/mir/shell/focus_controller.h 2014-04-30 13:15:30 +0000
2882@@ -23,9 +23,10 @@
2883
2884 namespace mir
2885 {
2886+namespace scene { class Session; }
2887+
2888 namespace shell
2889 {
2890-class Session;
2891
2892 class FocusController
2893 {
2894@@ -33,8 +34,8 @@
2895 virtual ~FocusController() = default;
2896
2897 virtual void focus_next() = 0;
2898- virtual std::weak_ptr<Session> focussed_application() const = 0;
2899- virtual void set_focus_to(std::shared_ptr<Session> const& focus) = 0;
2900+ virtual std::weak_ptr<scene::Session> focussed_application() const = 0;
2901+ virtual void set_focus_to(std::shared_ptr<scene::Session> const& focus) = 0;
2902
2903 protected:
2904 FocusController() = default;
2905
2906=== modified file 'include/server/mir/shell/focus_setter.h'
2907--- include/server/mir/shell/focus_setter.h 2014-03-06 06:05:17 +0000
2908+++ include/server/mir/shell/focus_setter.h 2014-04-30 13:15:30 +0000
2909@@ -23,11 +23,11 @@
2910
2911 namespace mir
2912 {
2913+namespace scene { class Session; }
2914+
2915
2916 namespace shell
2917 {
2918-class Session;
2919-
2920 /// Interface used by the Shell to propagate changes in the focus model to interested views
2921 /// e.g. Input, or Surfaces.
2922 class FocusSetter
2923@@ -35,7 +35,7 @@
2924 public:
2925 virtual ~FocusSetter() {}
2926
2927- virtual void set_focus_to(std::shared_ptr<shell::Session> const& new_focus) = 0;
2928+ virtual void set_focus_to(std::shared_ptr<scene::Session> const& new_focus) = 0;
2929
2930 protected:
2931 FocusSetter() = default;
2932
2933=== removed file 'include/server/mir/shell/surface.h'
2934--- include/server/mir/shell/surface.h 2014-03-26 14:20:14 +0000
2935+++ include/server/mir/shell/surface.h 1970-01-01 00:00:00 +0000
2936@@ -1,62 +0,0 @@
2937-/*
2938- * Copyright © 2013 Canonical Ltd.
2939- *
2940- * This program is free software: you can redistribute it and/or modify it
2941- * under the terms of the GNU General Public License version 3,
2942- * as published by the Free Software Foundation.
2943- *
2944- * This program is distributed in the hope that it will be useful,
2945- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2946- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2947- * GNU General Public License for more details.
2948- *
2949- * You should have received a copy of the GNU General Public License
2950- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2951- *
2952- * Authored by: Alan Griffiths <alan@octopull.co.uk>
2953- */
2954-
2955-
2956-#ifndef MIR_SHELL_SURFACE_H_
2957-#define MIR_SHELL_SURFACE_H_
2958-
2959-#include "mir/shell/surface_buffer_access.h"
2960-#include "mir/geometry/rectangle.h"
2961-#include "mir/frontend/surface.h"
2962-
2963-#include <string>
2964-#include <vector>
2965-
2966-namespace mir
2967-{
2968-namespace scene { class SurfaceRanker; }
2969-namespace shell
2970-{
2971-class InputTargeter;
2972-
2973-class Surface : public frontend::Surface, public shell::SurfaceBufferAccess
2974-{
2975-public:
2976- virtual std::string name() const = 0;
2977- virtual MirSurfaceType type() const = 0;
2978- virtual MirSurfaceState state() const = 0;
2979- virtual void hide() = 0;
2980- virtual void show() = 0;
2981- virtual void move_to(geometry::Point const& top_left) = 0;
2982- virtual geometry::Point top_left() const = 0;
2983-
2984- virtual void take_input_focus(std::shared_ptr<InputTargeter> const& targeter) = 0;
2985- virtual void set_input_region(std::vector<geometry::Rectangle> const& region) = 0;
2986-
2987- virtual void allow_framedropping(bool) = 0;
2988-
2989- virtual void resize(geometry::Size const& size) = 0;
2990- virtual void set_transformation(glm::mat4 const& t) = 0;
2991-
2992- virtual float alpha() const = 0;
2993- virtual void set_alpha(float alpha) = 0;
2994-};
2995-}
2996-}
2997-
2998-#endif /* MIR_SHELL_SURFACE_H_ */
2999
3000=== removed file 'include/server/mir/shell/surface_factory.h'
3001--- include/server/mir/shell/surface_factory.h 2014-03-28 17:47:07 +0000
3002+++ include/server/mir/shell/surface_factory.h 1970-01-01 00:00:00 +0000
3003@@ -1,53 +0,0 @@
3004-/*
3005- * Copyright © 2012-2014 Canonical Ltd.
3006- *
3007- * This program is free software: you can redistribute it and/or modify it
3008- * under the terms of the GNU General Public License version 3,
3009- * as published by the Free Software Foundation.
3010- *
3011- * This program is distributed in the hope that it will be useful,
3012- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3013- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3014- * GNU General Public License for more details.
3015- *
3016- * You should have received a copy of the GNU General Public License
3017- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3018- *
3019- * Authored by: Thomas Voss <thomas.voss@canonical.com>
3020- */
3021-
3022-#ifndef MIR_SHELL_SURFACE_FACTORY_H_
3023-#define MIR_SHELL_SURFACE_FACTORY_H_
3024-
3025-#include <memory>
3026-
3027-namespace mir
3028-{
3029-namespace scene { class SurfaceObserver; }
3030-
3031-namespace shell
3032-{
3033-class Session;
3034-class Surface;
3035-struct SurfaceCreationParameters;
3036-
3037-class SurfaceFactory
3038-{
3039-public:
3040- virtual std::shared_ptr<Surface> create_surface(
3041- Session* session,
3042- SurfaceCreationParameters const& params,
3043- std::shared_ptr<scene::SurfaceObserver> const& observer) = 0;
3044-
3045- virtual void destroy_surface(std::shared_ptr<Surface> const& surface) = 0;
3046-
3047-protected:
3048- virtual ~SurfaceFactory() {}
3049- SurfaceFactory() = default;
3050- SurfaceFactory(const SurfaceFactory&) = delete;
3051- SurfaceFactory& operator=(const SurfaceFactory&) = delete;
3052-};
3053-}
3054-}
3055-
3056-#endif // MIR_SHELL_SURFACE_FACTORY_H_
3057
3058=== added file 'include/test/mir_test/spin_wait.h'
3059--- include/test/mir_test/spin_wait.h 1970-01-01 00:00:00 +0000
3060+++ include/test/mir_test/spin_wait.h 2014-04-30 13:15:30 +0000
3061@@ -0,0 +1,38 @@
3062+/*
3063+ * Copyright © 2014 Canonical Ltd.
3064+ *
3065+ * This program is free software: you can redistribute it and/or modify it
3066+ * under the terms of the GNU General Public License version 3,
3067+ * as published by the Free Software Foundation.
3068+ *
3069+ * This program is distributed in the hope that it will be useful,
3070+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3071+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3072+ * GNU General Public License for more details.
3073+ *
3074+ * You should have received a copy of the GNU General Public License
3075+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3076+ *
3077+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3078+ */
3079+
3080+#ifndef MIR_TEST_SPIN_WAIT_H_
3081+#define MIR_TEST_SPIN_WAIT_H_
3082+
3083+#include <functional>
3084+#include <chrono>
3085+
3086+namespace mir
3087+{
3088+namespace test
3089+{
3090+
3091+bool spin_wait_for_condition_or_timeout(
3092+ std::function<bool()> const& condition,
3093+ std::chrono::milliseconds timeout,
3094+ std::chrono::milliseconds spin_period = std::chrono::milliseconds{10});
3095+
3096+}
3097+}
3098+
3099+#endif /* MIR_TEST_SPIN_WAIT_H_ */
3100
3101=== modified file 'include/test/mir_test/wait_condition.h'
3102--- include/test/mir_test/wait_condition.h 2013-04-24 05:22:20 +0000
3103+++ include/test/mir_test/wait_condition.h 2014-04-30 13:15:30 +0000
3104@@ -31,24 +31,31 @@
3105 {
3106 struct WaitCondition
3107 {
3108- WaitCondition() : woken(false) {}
3109+ WaitCondition() : woken_(false) {}
3110
3111 void wait_for_at_most_seconds(int seconds)
3112 {
3113 std::unique_lock<std::mutex> ul(guard);
3114- if (!woken) condition.wait_for(ul, std::chrono::seconds(seconds));
3115+ condition.wait_for(ul, std::chrono::seconds(seconds),
3116+ [this] { return woken_; });
3117 }
3118
3119 void wake_up_everyone()
3120 {
3121 std::unique_lock<std::mutex> ul(guard);
3122- woken = true;
3123+ woken_ = true;
3124 condition.notify_all();
3125 }
3126
3127+ bool woken()
3128+ {
3129+ std::unique_lock<std::mutex> ul(guard);
3130+ return woken_;
3131+ }
3132+
3133 std::mutex guard;
3134 std::condition_variable condition;
3135- bool woken;
3136+ bool woken_;
3137 };
3138
3139 ACTION_P(ReturnFalseAndWakeUp, wait_condition)
3140
3141=== modified file 'include/test/mir_test_doubles/fake_renderable.h'
3142--- include/test/mir_test_doubles/fake_renderable.h 2014-03-28 22:40:30 +0000
3143+++ include/test/mir_test_doubles/fake_renderable.h 2014-04-30 13:15:30 +0000
3144@@ -47,6 +47,11 @@
3145 {
3146 }
3147
3148+ ID id() const override
3149+ {
3150+ return this;
3151+ }
3152+
3153 float alpha() const override
3154 {
3155 return opacity;
3156
3157=== modified file 'include/test/mir_test_doubles/mock_buffer_stream.h'
3158--- include/test/mir_test_doubles/mock_buffer_stream.h 2014-03-26 05:48:59 +0000
3159+++ include/test/mir_test_doubles/mock_buffer_stream.h 2014-04-30 13:15:30 +0000
3160@@ -31,6 +31,19 @@
3161 {
3162 struct MockBufferStream : public compositor::BufferStream
3163 {
3164+ int buffers_ready_{0};
3165+ int buffers_ready()
3166+ {
3167+ if (buffers_ready_)
3168+ return buffers_ready_--;
3169+ return 0;
3170+ }
3171+
3172+ MockBufferStream()
3173+ {
3174+ ON_CALL(*this, buffers_ready_for_compositor())
3175+ .WillByDefault(testing::Invoke(this, &MockBufferStream::buffers_ready));
3176+ }
3177 MOCK_METHOD2(swap_client_buffers, void(graphics::Buffer*, std::function<void(graphics::Buffer*)> completee));
3178 MOCK_METHOD1(lock_compositor_buffer,
3179 std::shared_ptr<graphics::Buffer>(void const*));
3180@@ -42,7 +55,7 @@
3181 MOCK_METHOD0(force_client_completion, void());
3182 MOCK_METHOD1(allow_framedropping, void(bool));
3183 MOCK_METHOD0(force_requests_to_complete, void());
3184- int buffers_ready_for_compositor() const override { return 1; }
3185+ MOCK_CONST_METHOD0(buffers_ready_for_compositor, int());
3186 };
3187 }
3188 }
3189
3190=== modified file 'include/test/mir_test_doubles/mock_focus_setter.h'
3191--- include/test/mir_test_doubles/mock_focus_setter.h 2014-03-06 06:05:17 +0000
3192+++ include/test/mir_test_doubles/mock_focus_setter.h 2014-04-30 13:15:30 +0000
3193@@ -32,7 +32,7 @@
3194
3195 struct MockFocusSetter : public shell::FocusSetter
3196 {
3197- MOCK_METHOD1(set_focus_to, void(std::shared_ptr<shell::Session> const&));
3198+ MOCK_METHOD1(set_focus_to, void(std::shared_ptr<scene::Session> const&));
3199 };
3200
3201 }
3202
3203=== modified file 'include/test/mir_test_doubles/mock_framebuffer_bundle.h'
3204--- include/test/mir_test_doubles/mock_framebuffer_bundle.h 2014-03-06 06:05:17 +0000
3205+++ include/test/mir_test_doubles/mock_framebuffer_bundle.h 2014-04-30 13:15:30 +0000
3206@@ -40,6 +40,7 @@
3207 }
3208 MOCK_METHOD0(fb_format, MirPixelFormat());
3209 MOCK_METHOD0(fb_size, geometry::Size());
3210+ MOCK_METHOD0(fb_refresh_rate, double());
3211 MOCK_METHOD0(buffer_for_render, std::shared_ptr<graphics::Buffer>());
3212 MOCK_METHOD0(last_rendered_buffer, std::shared_ptr<graphics::Buffer>());
3213 MOCK_METHOD1(wait_for_consumed_buffer, void(bool));
3214
3215=== modified file 'include/test/mir_test_doubles/mock_input_surface.h'
3216--- include/test/mir_test_doubles/mock_input_surface.h 2014-03-26 05:48:59 +0000
3217+++ include/test/mir_test_doubles/mock_input_surface.h 2014-04-30 13:15:30 +0000
3218@@ -34,7 +34,7 @@
3219 public:
3220 MockInputSurface()
3221 {
3222- using namespace testing;
3223+ using namespace ::testing;
3224 ON_CALL(*this, top_left())
3225 .WillByDefault(
3226 Return(geometry::Point{}));
3227@@ -43,13 +43,17 @@
3228 Return(geometry::Size{}));
3229 static std::string n;
3230 ON_CALL(*this, name())
3231- .WillByDefault(testing::Return(n));
3232+ .WillByDefault(Return(n));
3233+ static std::shared_ptr<input::InputChannel> c{nullptr};
3234+ ON_CALL(*this, input_channel())
3235+ .WillByDefault(Return(c));
3236 }
3237 ~MockInputSurface() noexcept {}
3238 MOCK_CONST_METHOD0(top_left, geometry::Point());
3239 MOCK_CONST_METHOD0(size, geometry::Size());
3240 MOCK_CONST_METHOD0(name, std::string());
3241 MOCK_CONST_METHOD1(contains, bool(geometry::Point const&));
3242+ MOCK_CONST_METHOD0(input_channel, std::shared_ptr<input::InputChannel>());
3243 };
3244
3245 typedef ::testing::NiceMock<MockInputSurface> StubInputSurface;
3246
3247=== removed file 'include/test/mir_test_doubles/mock_render_function.h.moved'
3248--- include/test/mir_test_doubles/mock_render_function.h.moved 2014-02-25 22:02:56 +0000
3249+++ include/test/mir_test_doubles/mock_render_function.h.moved 1970-01-01 00:00:00 +0000
3250@@ -1,40 +0,0 @@
3251-/*
3252- * Copyright © 2014 Canonical Ltd.
3253- *
3254- * This program is free software: you can redistribute it and/or modify it
3255- * under the terms of the GNU General Public License version 3,
3256- * as published by the Free Software Foundation.
3257- *
3258- * This program is distributed in the hope that it will be useful,
3259- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3260- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3261- * GNU General Public License for more details.
3262- *
3263- * You should have received a copy of the GNU General Public License
3264- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3265- *
3266- * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
3267- */
3268-
3269-#ifndef MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_
3270-#define MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_
3271-
3272-#include <mir/graphics/renderable.h>
3273-
3274-namespace mir
3275-{
3276-namespace test
3277-{
3278-namespace doubles
3279-{
3280-
3281-struct MockRenderFunction
3282-{
3283- MOCK_METHOD1(called, void(graphics::Renderable const&));
3284-};
3285-
3286-}
3287-}
3288-}
3289-
3290-#endif /* MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ */
3291
3292=== modified file 'include/test/mir_test_doubles/mock_renderable.h'
3293--- include/test/mir_test_doubles/mock_renderable.h 2014-04-01 20:39:59 +0000
3294+++ include/test/mir_test_doubles/mock_renderable.h 2014-04-30 13:15:30 +0000
3295@@ -47,6 +47,7 @@
3296 .WillByDefault(testing::Return(true));
3297 }
3298
3299+ MOCK_CONST_METHOD0(id, ID());
3300 MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(void const*));
3301 MOCK_CONST_METHOD0(alpha_enabled, bool());
3302 MOCK_CONST_METHOD0(screen_position, geometry::Rectangle());
3303
3304=== modified file 'include/test/mir_test_doubles/mock_renderer.h'
3305--- include/test/mir_test_doubles/mock_renderer.h 2014-03-26 05:48:59 +0000
3306+++ include/test/mir_test_doubles/mock_renderer.h 2014-04-30 13:15:30 +0000
3307@@ -34,7 +34,7 @@
3308 MOCK_METHOD1(set_viewport, void(geometry::Rectangle const&));
3309 MOCK_METHOD1(set_rotation, void(float));
3310 MOCK_CONST_METHOD0(begin, void());
3311- MOCK_CONST_METHOD2(render, void(graphics::Renderable const&, graphics::Buffer&));
3312+ MOCK_CONST_METHOD1(render, void(graphics::Renderable const&));
3313 MOCK_CONST_METHOD0(end, void());
3314 MOCK_METHOD0(suspend, void());
3315
3316
3317=== modified file 'include/test/mir_test_doubles/mock_scene.h'
3318--- include/test/mir_test_doubles/mock_scene.h 2014-03-24 22:06:43 +0000
3319+++ include/test/mir_test_doubles/mock_scene.h 2014-04-30 13:15:30 +0000
3320@@ -38,8 +38,6 @@
3321 .WillByDefault(testing::Return(graphics::RenderableList{}));
3322 }
3323 MOCK_CONST_METHOD0(generate_renderable_list, graphics::RenderableList());
3324- MOCK_METHOD2(for_each_if, void(compositor::FilterForScene&,
3325- compositor::OperatorForScene&));
3326 MOCK_METHOD1(set_change_callback, void(std::function<void()> const&));
3327 MOCK_METHOD0(lock, void());
3328 MOCK_METHOD0(unlock, void());
3329
3330=== renamed file 'include/test/mir_test_doubles/mock_shell_session.h' => 'include/test/mir_test_doubles/mock_scene_session.h'
3331--- include/test/mir_test_doubles/mock_shell_session.h 2014-03-06 06:05:17 +0000
3332+++ include/test/mir_test_doubles/mock_scene_session.h 2014-04-30 13:15:30 +0000
3333@@ -16,11 +16,11 @@
3334 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
3335 */
3336
3337-#ifndef MIR_TEST_DOUBLES_MOCK_SHELL_SESSION_H_
3338-#define MIR_TEST_DOUBLES_MOCK_SHELL_SESSION_H_
3339+#ifndef MIR_TEST_DOUBLES_MOCK_SCENE_SESSION_H_
3340+#define MIR_TEST_DOUBLES_MOCK_SCENE_SESSION_H_
3341
3342-#include "mir/shell/session.h"
3343-#include "mir/shell/surface_creation_parameters.h"
3344+#include "mir/scene/session.h"
3345+#include "mir/scene/surface_creation_parameters.h"
3346 #include "mir/graphics/display_configuration.h"
3347
3348 #include <gmock/gmock.h>
3349@@ -32,14 +32,14 @@
3350 namespace doubles
3351 {
3352
3353-struct MockShellSession : public shell::Session
3354+struct MockSceneSession : public scene::Session
3355 {
3356- MOCK_METHOD1(create_surface, frontend::SurfaceId(shell::SurfaceCreationParameters const&));
3357+ MOCK_METHOD1(create_surface, frontend::SurfaceId(scene::SurfaceCreationParameters const&));
3358 MOCK_METHOD1(destroy_surface, void(frontend::SurfaceId));
3359 MOCK_CONST_METHOD1(get_surface, std::shared_ptr<frontend::Surface>(frontend::SurfaceId));
3360
3361- MOCK_METHOD1(take_snapshot, void(shell::SnapshotCallback const&));
3362- MOCK_CONST_METHOD0(default_surface, std::shared_ptr<shell::Surface>());
3363+ MOCK_METHOD1(take_snapshot, void(scene::SnapshotCallback const&));
3364+ MOCK_CONST_METHOD0(default_surface, std::shared_ptr<scene::Surface>());
3365
3366 MOCK_CONST_METHOD0(name, std::string());
3367 MOCK_CONST_METHOD0(process_id, pid_t());
3368
3369=== modified file 'include/test/mir_test_doubles/mock_session.h'
3370--- include/test/mir_test_doubles/mock_session.h 2013-08-28 03:41:48 +0000
3371+++ include/test/mir_test_doubles/mock_session.h 2014-04-30 13:15:30 +0000
3372@@ -20,7 +20,7 @@
3373 #define MIR_TEST_DOUBLES_MOCK_SESSION_H_
3374
3375 #include "mir/frontend/session.h"
3376-#include "mir/shell/surface_creation_parameters.h"
3377+#include "mir/scene/surface_creation_parameters.h"
3378
3379 #include <gmock/gmock.h>
3380
3381@@ -33,7 +33,7 @@
3382
3383 struct MockSession : public frontend::Session
3384 {
3385- MOCK_METHOD1(create_surface, frontend::SurfaceId(shell::SurfaceCreationParameters const&));
3386+ MOCK_METHOD1(create_surface, frontend::SurfaceId(scene::SurfaceCreationParameters const&));
3387 MOCK_METHOD1(destroy_surface, void(frontend::SurfaceId));
3388 MOCK_CONST_METHOD1(get_surface, std::shared_ptr<frontend::Surface>(frontend::SurfaceId));
3389
3390
3391=== modified file 'include/test/mir_test_doubles/mock_session_listener.h'
3392--- include/test/mir_test_doubles/mock_session_listener.h 2014-03-06 06:05:17 +0000
3393+++ include/test/mir_test_doubles/mock_session_listener.h 2014-04-30 13:15:30 +0000
3394@@ -19,7 +19,7 @@
3395 #ifndef MIR_TEST_DOUBLES_MOCK_SESSION_LISTENER_H_
3396 #define MIR_TEST_DOUBLES_MOCK_SESSION_LISTENER_H_
3397
3398-#include "mir/shell/session_listener.h"
3399+#include "mir/scene/session_listener.h"
3400
3401 #include <gmock/gmock.h>
3402
3403@@ -30,17 +30,17 @@
3404 namespace doubles
3405 {
3406
3407-struct MockSessionListener : public shell::SessionListener
3408+struct MockSessionListener : public scene::SessionListener
3409 {
3410 virtual ~MockSessionListener() noexcept(true) {}
3411
3412- MOCK_METHOD1(starting, void(std::shared_ptr<shell::Session> const&));
3413- MOCK_METHOD1(stopping, void(std::shared_ptr<shell::Session> const&));
3414- MOCK_METHOD1(focused, void(std::shared_ptr<shell::Session> const&));
3415+ MOCK_METHOD1(starting, void(std::shared_ptr<scene::Session> const&));
3416+ MOCK_METHOD1(stopping, void(std::shared_ptr<scene::Session> const&));
3417+ MOCK_METHOD1(focused, void(std::shared_ptr<scene::Session> const&));
3418 MOCK_METHOD0(unfocused, void());
3419
3420- MOCK_METHOD2(surface_created, void(shell::Session&, std::shared_ptr<shell::Surface> const&));
3421- MOCK_METHOD2(destroying_surface, void(shell::Session&, std::shared_ptr<shell::Surface> const&));
3422+ MOCK_METHOD2(surface_created, void(scene::Session&, std::shared_ptr<scene::Surface> const&));
3423+ MOCK_METHOD2(destroying_surface, void(scene::Session&, std::shared_ptr<scene::Surface> const&));
3424 };
3425
3426 }
3427
3428=== modified file 'include/test/mir_test_doubles/mock_shell.h'
3429--- include/test/mir_test_doubles/mock_shell.h 2014-03-06 06:05:17 +0000
3430+++ include/test/mir_test_doubles/mock_shell.h 2014-04-30 13:15:30 +0000
3431@@ -19,7 +19,7 @@
3432 #ifndef MIR_TEST_DOUBLES_SHELL_H_
3433 #define MIR_TEST_DOUBLES_SHELL_H_
3434
3435-#include "mir/shell/surface_creation_parameters.h"
3436+#include "mir/scene/surface_creation_parameters.h"
3437 #include "mir/frontend/shell.h"
3438 #include "mir/frontend/surface_id.h"
3439
3440@@ -41,7 +41,7 @@
3441
3442 MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&));
3443
3444- MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, shell::SurfaceCreationParameters const&));
3445+ MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, scene::SurfaceCreationParameters const&));
3446 MOCK_METHOD1(handle_surface_created, void(std::shared_ptr<frontend::Session> const&));
3447 };
3448
3449
3450=== modified file 'include/test/mir_test_doubles/mock_surface.h'
3451--- include/test/mir_test_doubles/mock_surface.h 2014-03-31 10:18:49 +0000
3452+++ include/test/mir_test_doubles/mock_surface.h 2014-04-30 13:15:30 +0000
3453@@ -49,8 +49,7 @@
3454
3455 MOCK_METHOD0(hide, void());
3456 MOCK_METHOD0(show, void());
3457- MOCK_METHOD0(visible, bool());
3458- MOCK_METHOD1(raise, void(std::shared_ptr<scene::SurfaceRanker> const&));
3459+ MOCK_CONST_METHOD0(visible, bool());
3460
3461 MOCK_METHOD0(force_requests_to_complete, void());
3462 MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>());
3463
3464=== renamed file 'include/test/mir_test_doubles/mock_surface_ranker.h' => 'include/test/mir_test_doubles/mock_surface_coordinator.h'
3465--- include/test/mir_test_doubles/mock_surface_ranker.h 2014-03-26 14:20:14 +0000
3466+++ include/test/mir_test_doubles/mock_surface_coordinator.h 2014-04-30 13:15:30 +0000
3467@@ -1,5 +1,5 @@
3468 /*
3469- * Copyright © 2013 Canonical Ltd.
3470+ * Copyright © 2013-2014 Canonical Ltd.
3471 *
3472 * This program is free software: you can redistribute it and/or modify it
3473 * under the terms of the GNU General Public License version 3,
3474@@ -17,10 +17,10 @@
3475 */
3476
3477
3478-#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_
3479-#define MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_
3480+#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_COORDINATOR_H_
3481+#define MIR_TEST_DOUBLES_MOCK_SURFACE_COORDINATOR_H_
3482
3483-#include "mir/scene/surface_ranker.h"
3484+#include "mir/scene/surface_coordinator.h"
3485
3486 #include <gmock/gmock.h>
3487
3488@@ -31,9 +31,15 @@
3489 namespace doubles
3490 {
3491
3492-struct MockSurfaceRanker : public scene::SurfaceRanker
3493+struct MockSurfaceCoordinator : public scene::SurfaceCoordinator
3494 {
3495 MOCK_METHOD1(raise, void(std::weak_ptr<scene::Surface> const&));
3496+
3497+ MOCK_METHOD2(add_surface, std::shared_ptr<scene::Surface>(
3498+ scene::SurfaceCreationParameters const& params,
3499+ scene::Session* session));
3500+
3501+ MOCK_METHOD1(remove_surface, void(std::weak_ptr<scene::Surface> const& surface));
3502 };
3503
3504 }
3505@@ -41,4 +47,4 @@
3506 }
3507
3508
3509-#endif /* MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_ */
3510+#endif /* MIR_TEST_DOUBLES_MOCK_SURFACE_COORDINATOR_H_ */
3511
3512=== removed file 'include/test/mir_test_doubles/mock_surface_factory.h'
3513--- include/test/mir_test_doubles/mock_surface_factory.h 2014-03-28 17:47:07 +0000
3514+++ include/test/mir_test_doubles/mock_surface_factory.h 1970-01-01 00:00:00 +0000
3515@@ -1,48 +0,0 @@
3516-/*
3517- * Copyright © 2012 Canonical Ltd.
3518- *
3519- * This program is free software: you can redistribute it and/or modify it
3520- * under the terms of the GNU General Public License version 3,
3521- * as published by the Free Software Foundation.
3522- *
3523- * This program is distributed in the hope that it will be useful,
3524- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3525- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3526- * GNU General Public License for more details.
3527- *
3528- * You should have received a copy of the GNU General Public License
3529- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3530- *
3531- * Authored by: Robert Carr <robert.carr@canonical.com>
3532- */
3533-
3534-#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_FACTORY_H_
3535-#define MIR_TEST_DOUBLES_MOCK_SURFACE_FACTORY_H_
3536-
3537-#include "mir/shell/surface_factory.h"
3538-
3539-#include <gmock/gmock.h>
3540-#include <gtest/gtest.h>
3541-
3542-namespace mir
3543-{
3544-namespace test
3545-{
3546-namespace doubles
3547-{
3548-
3549-struct MockSurfaceFactory : public shell::SurfaceFactory
3550-{
3551- MOCK_METHOD3(create_surface, std::shared_ptr<shell::Surface>(
3552- shell::Session*,
3553- const shell::SurfaceCreationParameters&,
3554- std::shared_ptr<scene::SurfaceObserver> const&));
3555-
3556- void destroy_surface(std::shared_ptr<shell::Surface> const& /*surface*/) override {}
3557-};
3558-
3559-}
3560-}
3561-}
3562-
3563-#endif // MIR_TEST_DOUBLES_MOCK_SURFACE_FACTORY_H_
3564
3565=== added file 'include/test/mir_test_doubles/null_display_buffer_compositor_factory.h'
3566--- include/test/mir_test_doubles/null_display_buffer_compositor_factory.h 1970-01-01 00:00:00 +0000
3567+++ include/test/mir_test_doubles/null_display_buffer_compositor_factory.h 2014-04-30 13:15:30 +0000
3568@@ -0,0 +1,52 @@
3569+/*
3570+ * Copyright © 2014 Canonical Ltd.
3571+ *
3572+ * This program is free software: you can redistribute it and/or modify it
3573+ * under the terms of the GNU General Public License version 3,
3574+ * as published by the Free Software Foundation.
3575+ *
3576+ * This program is distributed in the hope that it will be useful,
3577+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3578+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3579+ * GNU General Public License for more details.
3580+ *
3581+ * You should have received a copy of the GNU General Public License
3582+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3583+ *
3584+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3585+ */
3586+
3587+#ifndef MIR_TEST_DOUBLES_NULL_DISPLAY_BUFFER_COMPOSITOR_FACTORY_H_
3588+#define MIR_TEST_DOUBLES_NULL_DISPLAY_BUFFER_COMPOSITOR_FACTORY_H_
3589+
3590+#include "mir/compositor/display_buffer_compositor_factory.h"
3591+#include "mir/compositor/display_buffer_compositor.h"
3592+
3593+namespace mir
3594+{
3595+namespace test
3596+{
3597+namespace doubles
3598+{
3599+
3600+class NullDisplayBufferCompositorFactory : public compositor::DisplayBufferCompositorFactory
3601+{
3602+public:
3603+ auto create_compositor_for(graphics::DisplayBuffer&)
3604+ -> std::unique_ptr<compositor::DisplayBufferCompositor> override
3605+ {
3606+ struct NullDisplayBufferCompositor : compositor::DisplayBufferCompositor
3607+ {
3608+ bool composite() { return false; }
3609+ };
3610+
3611+ auto raw = new NullDisplayBufferCompositor{};
3612+ return std::unique_ptr<NullDisplayBufferCompositor>(raw);
3613+ }
3614+};
3615+
3616+}
3617+}
3618+}
3619+
3620+#endif /* MIR_TEST_DOUBLES_NULL_DISPLAY_BUFFER_COMPOSITOR_FACTORY_H_ */
3621
3622=== added file 'include/test/mir_test_doubles/null_event_filter.h'
3623--- include/test/mir_test_doubles/null_event_filter.h 1970-01-01 00:00:00 +0000
3624+++ include/test/mir_test_doubles/null_event_filter.h 2014-04-30 13:15:30 +0000
3625@@ -0,0 +1,40 @@
3626+/*
3627+ * Copyright © 2014 Canonical Ltd.
3628+ *
3629+ * This program is free software: you can redistribute it and/or modify it
3630+ * under the terms of the GNU General Public License version 3,
3631+ * as published by the Free Software Foundation.
3632+ *
3633+ * This program is distributed in the hope that it will be useful,
3634+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3635+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3636+ * GNU General Public License for more details.
3637+ *
3638+ * You should have received a copy of the GNU General Public License
3639+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3640+ *
3641+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3642+ */
3643+
3644+#ifndef MIR_TEST_DOUBLES_NULL_EVENT_FILTER_H_
3645+#define MIR_TEST_DOUBLES_NULL_EVENT_FILTER_H_
3646+
3647+#include "mir/input/event_filter.h"
3648+
3649+namespace mir
3650+{
3651+namespace test
3652+{
3653+namespace doubles
3654+{
3655+
3656+struct NullEventFilter : public mir::input::EventFilter
3657+{
3658+ bool handle(MirEvent const&) override { return true; }
3659+};
3660+
3661+}
3662+}
3663+}
3664+
3665+#endif /* MIR_TEST_DOUBLES_NULL_EVENT_FILTER_H_ */
3666
3667=== modified file 'include/test/mir_test_doubles/null_session_event_sink.h'
3668--- include/test/mir_test_doubles/null_session_event_sink.h 2014-03-06 06:05:17 +0000
3669+++ include/test/mir_test_doubles/null_session_event_sink.h 2014-04-30 13:15:30 +0000
3670@@ -31,9 +31,9 @@
3671 class NullSessionEventSink : public scene::SessionEventSink
3672 {
3673 public:
3674- void handle_focus_change(std::shared_ptr<shell::Session> const&) {}
3675+ void handle_focus_change(std::shared_ptr<scene::Session> const&) {}
3676 void handle_no_focus() {}
3677- void handle_session_stopping(std::shared_ptr<shell::Session> const&) {}
3678+ void handle_session_stopping(std::shared_ptr<scene::Session> const&) {}
3679 };
3680
3681 }
3682
3683=== modified file 'include/test/mir_test_doubles/null_snapshot_strategy.h'
3684--- include/test/mir_test_doubles/null_snapshot_strategy.h 2014-03-06 06:05:17 +0000
3685+++ include/test/mir_test_doubles/null_snapshot_strategy.h 2014-04-30 13:15:30 +0000
3686@@ -30,8 +30,9 @@
3687
3688 struct NullSnapshotStrategy : public scene::SnapshotStrategy
3689 {
3690- void take_snapshot_of(std::shared_ptr<shell::SurfaceBufferAccess> const&,
3691- shell::SnapshotCallback const&)
3692+ void take_snapshot_of(
3693+ std::shared_ptr<scene::SurfaceBufferAccess> const&,
3694+ scene::SnapshotCallback const&)
3695 {
3696 }
3697 };
3698
3699=== added file 'include/test/mir_test_doubles/stub_host_connection.h'
3700--- include/test/mir_test_doubles/stub_host_connection.h 1970-01-01 00:00:00 +0000
3701+++ include/test/mir_test_doubles/stub_host_connection.h 2014-04-30 13:15:30 +0000
3702@@ -0,0 +1,72 @@
3703+/*
3704+ * Copyright © 2014 Canonical Ltd.
3705+ *
3706+ * This program is free software: you can redistribute it and/or modify it
3707+ * under the terms of the GNU General Public License version 3,
3708+ * as published by the Free Software Foundation.
3709+ *
3710+ * This program is distributed in the hope that it will be useful,
3711+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3712+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3713+ * GNU General Public License for more details.
3714+ *
3715+ * You should have received a copy of the GNU General Public License
3716+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3717+ *
3718+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3719+ */
3720+
3721+#ifndef MIR_TEST_DOUBLES_STUB_HOST_CONNECTION_H_
3722+#define MIR_TEST_DOUBLES_STUB_HOST_CONNECTION_H_
3723+
3724+#include "src/server/graphics/nested/host_connection.h"
3725+
3726+namespace mir
3727+{
3728+namespace test
3729+{
3730+namespace doubles
3731+{
3732+
3733+class StubHostConnection : public graphics::nested::HostConnection
3734+{
3735+public:
3736+ std::vector<int> platform_fd_items() override { return {}; }
3737+
3738+ EGLNativeDisplayType egl_native_display() override { return {}; }
3739+
3740+ std::shared_ptr<MirDisplayConfiguration> create_display_config() override
3741+ {
3742+ return std::shared_ptr<MirDisplayConfiguration>{
3743+ new MirDisplayConfiguration{0, nullptr, 0, nullptr}};
3744+ }
3745+
3746+ void set_display_config_change_callback(std::function<void()> const&) override
3747+ {
3748+ }
3749+
3750+ void apply_display_config(MirDisplayConfiguration&) override {}
3751+
3752+ std::shared_ptr<graphics::nested::HostSurface>
3753+ create_surface(MirSurfaceParameters const&) override
3754+ {
3755+ class NullHostSurface : public graphics::nested::HostSurface
3756+ {
3757+ public:
3758+ EGLNativeWindowType egl_native_window() override { return {}; }
3759+ void set_event_handler(MirEventDelegate const*) override {}
3760+ };
3761+
3762+ return std::make_shared<NullHostSurface>();
3763+ }
3764+
3765+ void drm_auth_magic(int) override {}
3766+ void drm_set_gbm_device(struct gbm_device*) override {}
3767+};
3768+
3769+
3770+}
3771+}
3772+}
3773+
3774+#endif /* MIR_TEST_DOUBLES_STUB_HOST_CONNECTION_H_ */
3775
3776=== added file 'include/test/mir_test_doubles/stub_input_targets.h'
3777--- include/test/mir_test_doubles/stub_input_targets.h 1970-01-01 00:00:00 +0000
3778+++ include/test/mir_test_doubles/stub_input_targets.h 2014-04-30 13:15:30 +0000
3779@@ -0,0 +1,42 @@
3780+/*
3781+ * Copyright © 2014 Canonical Ltd.
3782+ *
3783+ * This program is free software: you can redistribute it and/or modify it
3784+ * under the terms of the GNU General Public License version 3,
3785+ * as published by the Free Software Foundation.
3786+ *
3787+ * This program is distributed in the hope that it will be useful,
3788+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3789+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3790+ * GNU General Public License for more details.
3791+ *
3792+ * You should have received a copy of the GNU General Public License
3793+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3794+ *
3795+ * Authored by: Robert Carr <robert.carr@canonical.com>
3796+ */
3797+
3798+#ifndef MIR_TEST_DOUBLES_STUB_INPUT_TARGETS_H_
3799+#define MIR_TEST_DOUBLES_STUB_INPUT_TARGETS_H_
3800+
3801+#include "mir/input/input_targets.h"
3802+
3803+namespace mir
3804+{
3805+namespace test
3806+{
3807+namespace doubles
3808+{
3809+
3810+class StubInputTargets : public input::InputTargets
3811+{
3812+ void for_each(std::function<void(std::shared_ptr<input::Surface> const&)> const& ) override
3813+ {
3814+ }
3815+};
3816+
3817+}
3818+}
3819+} // namespace mir
3820+
3821+#endif /* MIR_TEST_DOUBLES_STUB_INPUT_TARGETS_H_ */
3822
3823=== modified file 'include/test/mir_test_doubles/stub_renderable.h'
3824--- include/test/mir_test_doubles/stub_renderable.h 2014-03-28 22:40:30 +0000
3825+++ include/test/mir_test_doubles/stub_renderable.h 2014-04-30 13:15:30 +0000
3826@@ -33,6 +33,10 @@
3827 class StubRenderable : public graphics::Renderable
3828 {
3829 public:
3830+ ID id() const override
3831+ {
3832+ return this;
3833+ }
3834 std::shared_ptr<graphics::Buffer> buffer(void const*) const override
3835 {
3836 return std::make_shared<StubBuffer>();
3837
3838=== modified file 'include/test/mir_test_doubles/stub_renderer.h'
3839--- include/test/mir_test_doubles/stub_renderer.h 2014-03-26 05:48:59 +0000
3840+++ include/test/mir_test_doubles/stub_renderer.h 2014-04-30 13:15:30 +0000
3841@@ -20,6 +20,7 @@
3842 #define MIR_TEST_DOUBLES_STUB_RENDERER_H_
3843
3844 #include "mir/compositor/renderer.h"
3845+#include "mir/graphics/renderable.h"
3846
3847 namespace mir
3848 {
3849@@ -43,9 +44,10 @@
3850 {
3851 }
3852
3853- void render(graphics::Renderable const&,
3854- graphics::Buffer&) const override
3855+ void render(graphics::Renderable const& r) const override
3856 {
3857+ auto buffer = r.buffer(this); // We need to consume a buffer to
3858+ // unblock tests with clients.
3859 }
3860
3861 void end() const override
3862
3863=== renamed file 'include/test/mir_test_doubles/stub_shell_session.h' => 'include/test/mir_test_doubles/stub_scene_session.h'
3864--- include/test/mir_test_doubles/stub_shell_session.h 2014-03-06 06:05:17 +0000
3865+++ include/test/mir_test_doubles/stub_scene_session.h 2014-04-30 13:15:30 +0000
3866@@ -16,10 +16,10 @@
3867 * Authored by: Robert Carr <robert.carr@canonical.com>
3868 */
3869
3870-#ifndef MIR_TEST_DOUBLES_STUB_SHELL_SESSION_H_
3871-#define MIR_TEST_DOUBLES_STUB_SHELL_SESSION_H_
3872+#ifndef MIR_TEST_DOUBLES_STUB_SCENE_SESSION_H_
3873+#define MIR_TEST_DOUBLES_STUB_SCENE_SESSION_H_
3874
3875-#include "mir/shell/session.h"
3876+#include "mir/scene/session.h"
3877
3878 namespace mir
3879 {
3880@@ -28,9 +28,9 @@
3881 namespace doubles
3882 {
3883
3884-struct StubShellSession : public shell::Session
3885+struct StubSceneSession : public scene::Session
3886 {
3887- frontend::SurfaceId create_surface(shell::SurfaceCreationParameters const& /* params */) override
3888+ frontend::SurfaceId create_surface(scene::SurfaceCreationParameters const& /* params */) override
3889 {
3890 return frontend::SurfaceId{0};
3891 }
3892@@ -59,22 +59,18 @@
3893 void show() override
3894 {
3895 }
3896- int configure_surface(frontend::SurfaceId, MirSurfaceAttrib, int) override
3897- {
3898- return 0;
3899- }
3900
3901 void send_display_config(graphics::DisplayConfiguration const&) override
3902 {
3903 }
3904
3905- void take_snapshot(shell::SnapshotCallback const&) override
3906+ void take_snapshot(scene::SnapshotCallback const&) override
3907 {
3908 }
3909
3910- std::shared_ptr<shell::Surface> default_surface() const override
3911+ std::shared_ptr<scene::Surface> default_surface() const override
3912 {
3913- return std::shared_ptr<shell::Surface>();
3914+ return std::shared_ptr<scene::Surface>();
3915 }
3916
3917 void set_lifecycle_state(MirLifecycleState /*state*/)
3918@@ -86,5 +82,5 @@
3919 }
3920 } // namespace mir
3921
3922-#endif // MIR_TEST_DOUBLES_STUB_SHELL_SESSION_H_
3923+#endif // MIR_TEST_DOUBLES_STUB_SCENE_SESSION_H_
3924
3925
3926=== modified file 'include/test/mir_test_doubles/stub_session.h'
3927--- include/test/mir_test_doubles/stub_session.h 2013-08-28 03:41:48 +0000
3928+++ include/test/mir_test_doubles/stub_session.h 2014-04-30 13:15:30 +0000
3929@@ -30,39 +30,25 @@
3930
3931 struct StubSession : public frontend::Session
3932 {
3933- frontend::SurfaceId create_surface(shell::SurfaceCreationParameters const& /* params */)
3934+ frontend::SurfaceId create_surface(scene::SurfaceCreationParameters const& /* params */) override
3935 {
3936 return frontend::SurfaceId{0};
3937 }
3938- void destroy_surface(frontend::SurfaceId /* surface */)
3939+ void destroy_surface(frontend::SurfaceId /* surface */) override
3940 {
3941 }
3942- std::shared_ptr<frontend::Surface> get_surface(frontend::SurfaceId /* surface */) const
3943+ std::shared_ptr<frontend::Surface> get_surface(frontend::SurfaceId /* surface */) const override
3944 {
3945 return std::shared_ptr<frontend::Surface>();
3946 }
3947- std::string name() const
3948+ std::string name() const override
3949 {
3950 return std::string();
3951 }
3952- void force_requests_to_complete()
3953- {
3954- }
3955- void hide()
3956- {
3957- }
3958- void show()
3959- {
3960- }
3961- int configure_surface(frontend::SurfaceId, MirSurfaceAttrib, int)
3962- {
3963- return 0;
3964- }
3965- void set_event_sink(std::shared_ptr<frontend::EventSink> const&)
3966- {
3967- }
3968-
3969- void send_display_config(graphics::DisplayConfiguration const&)
3970+ void hide() override
3971+ {
3972+ }
3973+ void show() override
3974 {
3975 }
3976 };
3977
3978=== modified file 'include/test/mir_test_doubles/stub_shell.h'
3979--- include/test/mir_test_doubles/stub_shell.h 2014-03-06 06:05:17 +0000
3980+++ include/test/mir_test_doubles/stub_shell.h 2014-04-30 13:15:30 +0000
3981@@ -42,7 +42,7 @@
3982 {
3983 }
3984 frontend::SurfaceId create_surface_for(std::shared_ptr<frontend::Session> const& /* session */,
3985- shell::SurfaceCreationParameters const& /* params */) override
3986+ scene::SurfaceCreationParameters const& /* params */) override
3987 {
3988 return frontend::SurfaceId{0};
3989 }
3990
3991=== modified file 'include/test/mir_test_framework/declarative_placement_strategy.h'
3992--- include/test/mir_test_framework/declarative_placement_strategy.h 2014-03-20 18:41:16 +0000
3993+++ include/test/mir_test_framework/declarative_placement_strategy.h 2014-04-30 13:15:30 +0000
3994@@ -19,7 +19,7 @@
3995 #ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_
3996 #define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_
3997
3998-#include "mir/shell/placement_strategy.h"
3999+#include "mir/scene/placement_strategy.h"
4000 #include "mir/geometry/rectangle.h"
4001 #include "mir/scene/depth_id.h"
4002
4003@@ -36,25 +36,25 @@
4004 /// a static list of surface geometries and relative depths. Used, for example,
4005 /// in input tests where it is necessary to set up scenarios depending on
4006 /// multiple surfaces geometry and stacking.
4007-class DeclarativePlacementStrategy : public mir::shell::PlacementStrategy
4008+class DeclarativePlacementStrategy : public mir::scene::PlacementStrategy
4009 {
4010 public:
4011 // Placement requests will be passed through to default strategy, and then overriden if the surface appears
4012 // in the geometry or depth map. This allows for the convenience of leaving some surfaces geometries unspecified
4013 // and receiving the default behavior.
4014- DeclarativePlacementStrategy(std::shared_ptr<mir::shell::PlacementStrategy> const& default_strategy,
4015+ DeclarativePlacementStrategy(std::shared_ptr<mir::scene::PlacementStrategy> const& default_strategy,
4016 SurfaceGeometries const& positions_by_name, SurfaceDepths const& depths_by_name);
4017
4018 virtual ~DeclarativePlacementStrategy() = default;
4019
4020- mir::shell::SurfaceCreationParameters place(mir::shell::Session const& session, mir::shell::SurfaceCreationParameters const& request_parameters) override;
4021+ mir::scene::SurfaceCreationParameters place(mir::scene::Session const& session, mir::scene::SurfaceCreationParameters const& request_parameters) override;
4022
4023 protected:
4024 DeclarativePlacementStrategy(const DeclarativePlacementStrategy&) = delete;
4025 DeclarativePlacementStrategy& operator=(const DeclarativePlacementStrategy&) = delete;
4026
4027 private:
4028- std::shared_ptr<mir::shell::PlacementStrategy> const default_strategy;
4029+ std::shared_ptr<mir::scene::PlacementStrategy> const default_strategy;
4030
4031 SurfaceGeometries surface_geometries_by_name;
4032 SurfaceDepths surface_depths_by_name;
4033
4034=== modified file 'include/test/mir_test_framework/display_server_test_fixture.h'
4035--- include/test/mir_test_framework/display_server_test_fixture.h 2014-03-06 06:05:17 +0000
4036+++ include/test/mir_test_framework/display_server_test_fixture.h 2014-04-30 13:15:30 +0000
4037@@ -65,6 +65,7 @@
4038
4039 bool shutdown_server_process();
4040 Result wait_for_shutdown_server_process();
4041+ bool kill_server_process();
4042 void kill_client_processes();
4043 void terminate_client_processes();
4044
4045
4046=== modified file 'include/test/mir_test_framework/testing_process_manager.h'
4047--- include/test/mir_test_framework/testing_process_manager.h 2014-03-06 06:05:17 +0000
4048+++ include/test/mir_test_framework/testing_process_manager.h 2014-04-30 13:15:30 +0000
4049@@ -58,6 +58,7 @@
4050 void tear_down_server();
4051 void tear_down_all();
4052 Result shutdown_server_process();
4053+ Result kill_server_process();
4054 Result wait_for_shutdown_server_process();
4055 void kill_client_processes();
4056 void terminate_client_processes();
4057
4058=== modified file 'src/client/CMakeLists.txt'
4059--- src/client/CMakeLists.txt 2014-03-11 16:19:27 +0000
4060+++ src/client/CMakeLists.txt 2014-04-30 13:15:30 +0000
4061@@ -32,10 +32,13 @@
4062 aging_buffer.cpp
4063 client_buffer_depository.cpp
4064 display_configuration.cpp
4065- mir_client_library.cpp
4066+ error_connections.cpp
4067 mir_connection.cpp
4068+ mir_connection_api.cpp
4069 mir_wait_handle.cpp
4070+ mir_wait_api.cpp
4071 mir_surface.cpp
4072+ mir_surface_api.cpp
4073 logging/rpc_report.cpp
4074 logging/input_receiver_report.cpp
4075 default_connection_configuration.cpp
4076
4077=== modified file 'src/client/android/client_surface_interpreter.cpp'
4078--- src/client/android/client_surface_interpreter.cpp 2014-03-06 06:05:17 +0000
4079+++ src/client/android/client_surface_interpreter.cpp 2014-04-30 13:15:30 +0000
4080@@ -73,6 +73,8 @@
4081 return 0;
4082 case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
4083 return 2;
4084+ case NATIVE_WINDOW_CONCRETE_TYPE:
4085+ return NATIVE_WINDOW_SURFACE;
4086 default:
4087 throw std::runtime_error("driver requested unsupported query");
4088 }
4089
4090=== added file 'src/client/error_connections.cpp'
4091--- src/client/error_connections.cpp 1970-01-01 00:00:00 +0000
4092+++ src/client/error_connections.cpp 2014-04-30 13:15:30 +0000
4093@@ -0,0 +1,55 @@
4094+/*
4095+ * Copyright © 2014 Canonical Ltd.
4096+ *
4097+ * This program is free software: you can redistribute it and/or modify it
4098+ * under the terms of the GNU Lesser General Public License version 3,
4099+ * as published by the Free Software Foundation.
4100+ *
4101+ * This program is distributed in the hope that it will be useful,
4102+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4103+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4104+ * GNU Lesser General Public License for more details.
4105+ *
4106+ * You should have received a copy of the GNU Lesser General Public License
4107+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4108+ *
4109+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
4110+ */
4111+
4112+#include "error_connections.h"
4113+
4114+namespace mcl = mir::client;
4115+
4116+namespace
4117+{
4118+std::once_flag error_connections_init;
4119+}
4120+
4121+mcl::ErrorConnections& mcl::ErrorConnections::instance()
4122+{
4123+ static ErrorConnections* error_connections = nullptr;
4124+
4125+ std::call_once(
4126+ error_connections_init,
4127+ [&] { error_connections = new ErrorConnections();});
4128+
4129+ return *error_connections;
4130+}
4131+
4132+void mcl::ErrorConnections::insert(MirConnection* connection)
4133+{
4134+ std::lock_guard<std::mutex> lock(connection_guard);
4135+ connections.insert(connection);
4136+}
4137+
4138+void mcl::ErrorConnections::remove(MirConnection* connection)
4139+{
4140+ std::lock_guard<std::mutex> lock(connection_guard);
4141+ connections.erase(connection);
4142+}
4143+
4144+bool mcl::ErrorConnections::contains(MirConnection* connection) const
4145+{
4146+ std::lock_guard<std::mutex> lock(connection_guard);
4147+ return connections.count(connection);
4148+}
4149
4150=== added file 'src/client/error_connections.h'
4151--- src/client/error_connections.h 1970-01-01 00:00:00 +0000
4152+++ src/client/error_connections.h 2014-04-30 13:15:30 +0000
4153@@ -0,0 +1,52 @@
4154+/*
4155+ * Copyright © 2012-2014 Canonical Ltd.
4156+ *
4157+ * This program is free software: you can redistribute it and/or modify it
4158+ * under the terms of the GNU Lesser General Public License version 3,
4159+ * as published by the Free Software Foundation.
4160+ *
4161+ * This program is distributed in the hope that it will be useful,
4162+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4163+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4164+ * GNU Lesser General Public License for more details.
4165+ *
4166+ * You should have received a copy of the GNU Lesser General Public License
4167+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4168+ *
4169+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
4170+ */
4171+
4172+#ifndef MIR_CLIENT_ERROR_CONNECTIONS_H_
4173+#define MIR_CLIENT_ERROR_CONNECTIONS_H_
4174+
4175+#include "mir_toolkit/client_types.h"
4176+#include <mutex>
4177+#include <unordered_set>
4178+
4179+namespace mir
4180+{
4181+namespace client
4182+{
4183+
4184+class ErrorConnections
4185+{
4186+public:
4187+ static ErrorConnections& instance();
4188+
4189+ void insert(MirConnection* connection);
4190+ void remove(MirConnection* connection);
4191+ bool contains(MirConnection* connection) const;
4192+
4193+private:
4194+ ErrorConnections() = default;
4195+ ErrorConnections(ErrorConnections const&) = delete;
4196+ ErrorConnections& operator=(ErrorConnections const&) = delete;
4197+
4198+ mutable std::mutex connection_guard;
4199+ std::unordered_set<MirConnection*> connections;
4200+};
4201+
4202+}
4203+}
4204+
4205+#endif /* MIR_CLIENT_ERROR_CONNECTIONS_H_ */
4206
4207=== removed file 'src/client/mir_client_library.cpp'
4208--- src/client/mir_client_library.cpp 2014-03-26 05:48:59 +0000
4209+++ src/client/mir_client_library.cpp 1970-01-01 00:00:00 +0000
4210@@ -1,546 +0,0 @@
4211-/*
4212- * Copyright © 2012 Canonical Ltd.
4213- *
4214- * This program is free software: you can redistribute it and/or modify it
4215- * under the terms of the GNU Lesser General Public License version 3,
4216- * as published by the Free Software Foundation.
4217- *
4218- * This program is distributed in the hope that it will be useful,
4219- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4220- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4221- * GNU Lesser General Public License for more details.
4222- *
4223- * You should have received a copy of the GNU Lesser General Public License
4224- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4225- *
4226- * Authored by: Thomas Guest <thomas.guest@canonical.com>
4227- */
4228-
4229-#include "mir/default_configuration.h"
4230-#include "mir/raii.h"
4231-#include "mir_toolkit/mir_client_library.h"
4232-#include "mir_toolkit/mir_client_library_drm.h"
4233-#include "mir_toolkit/mir_client_library_debug.h"
4234-
4235-#include "mir_connection.h"
4236-#include "display_configuration.h"
4237-#include "mir_surface.h"
4238-#include "egl_native_display_container.h"
4239-#include "default_connection_configuration.h"
4240-#include "lifecycle_control.h"
4241-#include "api_impl_types.h"
4242-
4243-#include <set>
4244-#include <unordered_set>
4245-#include <cstddef>
4246-#include <cstring>
4247-
4248-namespace mcl = mir::client;
4249-
4250-namespace
4251-{
4252-class ConnectionList
4253-{
4254-public:
4255- void insert(MirConnection* connection)
4256- {
4257- std::lock_guard<std::mutex> lock(connection_guard);
4258- connections.insert(connection);
4259- }
4260-
4261- void remove(MirConnection* connection)
4262- {
4263- std::lock_guard<std::mutex> lock(connection_guard);
4264- connections.erase(connection);
4265- }
4266-
4267- bool contains(MirConnection* connection)
4268- {
4269- std::lock_guard<std::mutex> lock(connection_guard);
4270- return connections.count(connection);
4271- }
4272-
4273-private:
4274- std::mutex connection_guard;
4275- std::unordered_set<MirConnection*> connections;
4276-};
4277-
4278-ConnectionList error_connections;
4279-
4280-// assign_result is compatible with all 2-parameter callbacks
4281-void assign_result(void *result, void **context)
4282-{
4283- if (context)
4284- *context = result;
4285-}
4286-
4287-size_t division_ceiling(size_t a, size_t b)
4288-{
4289- return ((a - 1) / b) + 1;
4290-}
4291-
4292-}
4293-
4294-MirWaitHandle* mir_default_connect(
4295- char const* socket_file, char const* name, mir_connected_callback callback, void * context)
4296-{
4297-
4298- try
4299- {
4300- std::string sock;
4301- if (socket_file)
4302- sock = socket_file;
4303- else
4304- {
4305- auto socket_env = getenv("MIR_SOCKET");
4306- if (socket_env)
4307- sock = socket_env;
4308- else
4309- sock = mir::default_server_socket;
4310- }
4311-
4312- mcl::DefaultConnectionConfiguration conf{sock};
4313-
4314- std::unique_ptr<MirConnection> connection{new MirConnection(conf)};
4315- auto const result = connection->connect(name, callback, context);
4316- connection.release();
4317- return result;
4318- }
4319- catch (std::exception const& x)
4320- {
4321- MirConnection* error_connection = new MirConnection(x.what());
4322- error_connections.insert(error_connection);
4323- callback(error_connection, context);
4324- return nullptr;
4325- }
4326-}
4327-
4328-
4329-void mir_default_connection_release(MirConnection * connection)
4330-{
4331- if (!error_connections.contains(connection))
4332- {
4333- try
4334- {
4335- auto wait_handle = connection->disconnect();
4336- wait_handle->wait_for_all();
4337- }
4338- catch (std::exception const&)
4339- {
4340- // We're implementing a C API so no exceptions are to be
4341- // propagated. And that's OK because if disconnect() fails,
4342- // we don't care why. We're finished with the connection anyway.
4343- }
4344- }
4345- else
4346- {
4347- error_connections.remove(connection);
4348- }
4349-
4350- delete connection;
4351-}
4352-
4353-//mir_connect and mir_connection_release can be overridden by test code that sets these function
4354-//pointers to do things like stub out the graphics drivers or change the connection configuration.
4355-
4356-//TODO: we could have a more comprehensive solution that allows us to substitute any of the functions
4357-//for test purposes, not just the connect functions
4358-mir_connect_impl_func mir_connect_impl = mir_default_connect;
4359-mir_connection_release_impl_func mir_connection_release_impl = mir_default_connection_release;
4360-
4361-MirWaitHandle* mir_connect(char const* socket_file, char const* name, mir_connected_callback callback, void * context)
4362-{
4363- try
4364- {
4365- return mir_connect_impl(socket_file, name, callback, context);
4366- }
4367- catch (std::exception const&)
4368- {
4369- return nullptr;
4370- }
4371-}
4372-
4373-void mir_connection_release(MirConnection *connection)
4374-{
4375- try
4376- {
4377- return mir_connection_release_impl(connection);
4378- }
4379- catch (std::exception const&)
4380- {
4381- }
4382-}
4383-
4384-MirConnection *mir_connect_sync(char const *server,
4385- char const *app_name)
4386-{
4387- MirConnection *conn = nullptr;
4388- mir_wait_for(mir_connect(server, app_name,
4389- reinterpret_cast<mir_connected_callback>
4390- (assign_result),
4391- &conn));
4392- return conn;
4393-}
4394-
4395-MirBool mir_connection_is_valid(MirConnection * connection)
4396-{
4397- return MirConnection::is_valid(connection) ? mir_true : mir_false;
4398-}
4399-
4400-char const * mir_connection_get_error_message(MirConnection * connection)
4401-{
4402- return connection->get_error_message();
4403-}
4404-
4405-MirEGLNativeDisplayType mir_connection_get_egl_native_display(MirConnection *connection)
4406-{
4407- return connection->egl_native_display();
4408-}
4409-
4410-void mir_connection_get_available_surface_formats(
4411- MirConnection * connection, MirPixelFormat* formats,
4412- unsigned const int format_size, unsigned int *num_valid_formats)
4413-{
4414- if ((connection) && (formats) && (num_valid_formats))
4415- connection->available_surface_formats(formats, format_size, *num_valid_formats);
4416-}
4417-
4418-MirWaitHandle* mir_connection_create_surface(
4419- MirConnection* connection,
4420- MirSurfaceParameters const* params,
4421- mir_surface_callback callback,
4422- void* context)
4423-{
4424- if (error_connections.contains(connection)) return 0;
4425-
4426- try
4427- {
4428- return connection->create_surface(*params, callback, context);
4429- }
4430- catch (std::exception const&)
4431- {
4432- // TODO callback with an error surface
4433- return nullptr;
4434- }
4435-
4436-}
4437-
4438-MirSurface* mir_connection_create_surface_sync(
4439- MirConnection* connection,
4440- MirSurfaceParameters const* params)
4441-{
4442- MirSurface *surface = nullptr;
4443-
4444- mir_wait_for(mir_connection_create_surface(connection, params,
4445- reinterpret_cast<mir_surface_callback>(assign_result),
4446- &surface));
4447-
4448- return surface;
4449-}
4450-
4451-void mir_surface_set_event_handler(MirSurface *surface,
4452- MirEventDelegate const *event_handler)
4453-{
4454- surface->set_event_handler(event_handler);
4455-}
4456-
4457-MirWaitHandle* mir_surface_release(
4458- MirSurface * surface,
4459- mir_surface_callback callback, void * context)
4460-{
4461- try
4462- {
4463- return surface->release_surface(callback, context);
4464- }
4465- catch (std::exception const&)
4466- {
4467- return nullptr;
4468- }
4469-}
4470-
4471-void mir_surface_release_sync(MirSurface *surface)
4472-{
4473- mir_wait_for(mir_surface_release(surface,
4474- reinterpret_cast<mir_surface_callback>(assign_result),
4475- nullptr));
4476-}
4477-
4478-int mir_surface_get_id(MirSurface * surface)
4479-{
4480- return mir_debug_surface_id(surface);
4481-}
4482-
4483-int mir_debug_surface_id(MirSurface * surface)
4484-{
4485- return surface->id();
4486-}
4487-
4488-MirBool mir_surface_is_valid(MirSurface* surface)
4489-{
4490- return surface->is_valid() ? mir_true : mir_false;
4491-}
4492-
4493-char const * mir_surface_get_error_message(MirSurface * surface)
4494-{
4495- return surface->get_error_message();
4496-}
4497-
4498-void mir_surface_get_parameters(MirSurface * surface, MirSurfaceParameters *parameters)
4499-{
4500- *parameters = surface->get_parameters();
4501-}
4502-
4503-MirPlatformType mir_surface_get_platform_type(MirSurface * surface)
4504-{
4505- return surface->platform_type();
4506-}
4507-
4508-void mir_surface_get_current_buffer(MirSurface * surface, MirNativeBuffer ** buffer_package_out)
4509-{
4510- *buffer_package_out = surface->get_current_buffer_package();
4511-}
4512-
4513-uint32_t mir_debug_surface_current_buffer_id(MirSurface * surface)
4514-{
4515- return surface->get_current_buffer_id();
4516-}
4517-
4518-void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package)
4519-{
4520- connection->populate(*platform_package);
4521-}
4522-
4523-MirDisplayConfiguration* mir_connection_create_display_config(MirConnection *connection)
4524-{
4525- if (connection)
4526- return connection->create_copy_of_display_config();
4527- return nullptr;
4528-}
4529-
4530-void mir_display_config_destroy(MirDisplayConfiguration* configuration)
4531-{
4532- mcl::delete_config_storage(configuration);
4533-}
4534-
4535-//TODO: DEPRECATED: remove this function
4536-void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info)
4537-{
4538- auto const config = mir::raii::deleter_for(
4539- mir_connection_create_display_config(connection),
4540- &mir_display_config_destroy);
4541-
4542- if (config->num_outputs < 1)
4543- return;
4544-
4545- MirDisplayOutput* state = nullptr;
4546- // We can't handle more than one display, so just populate based on the first
4547- // active display we find.
4548- for (unsigned int i = 0; i < config->num_outputs; ++i)
4549- {
4550- if (config->outputs[i].used && config->outputs[i].connected &&
4551- config->outputs[i].current_mode < config->outputs[i].num_modes)
4552- {
4553- state = &config->outputs[i];
4554- break;
4555- }
4556- }
4557- // Oh, oh! No connected outputs?!
4558- if (state == nullptr)
4559- {
4560- memset(display_info, 0, sizeof(*display_info));
4561- return;
4562- }
4563-
4564- MirDisplayMode mode = state->modes[state->current_mode];
4565-
4566- display_info->width = mode.horizontal_resolution;
4567- display_info->height = mode.vertical_resolution;
4568-
4569- unsigned int format_items;
4570- if (state->num_output_formats > mir_supported_pixel_format_max)
4571- format_items = mir_supported_pixel_format_max;
4572- else
4573- format_items = state->num_output_formats;
4574-
4575- display_info->supported_pixel_format_items = format_items;
4576- for(auto i=0u; i < format_items; i++)
4577- {
4578- display_info->supported_pixel_format[i] = state->output_formats[i];
4579- }
4580-}
4581-
4582-void mir_surface_get_graphics_region(MirSurface * surface, MirGraphicsRegion * graphics_region)
4583-{
4584- surface->get_cpu_region( *graphics_region);
4585-}
4586-
4587-MirWaitHandle* mir_surface_swap_buffers(MirSurface *surface, mir_surface_callback callback, void * context)
4588-try
4589-{
4590- return surface->next_buffer(callback, context);
4591-}
4592-catch (std::exception const&)
4593-{
4594- return nullptr;
4595-}
4596-
4597-void mir_surface_swap_buffers_sync(MirSurface *surface)
4598-{
4599- mir_wait_for(mir_surface_swap_buffers(surface,
4600- reinterpret_cast<mir_surface_callback>(assign_result),
4601- nullptr));
4602-}
4603-
4604-void mir_wait_for(MirWaitHandle* wait_handle)
4605-{
4606- if (wait_handle)
4607- wait_handle->wait_for_all();
4608-}
4609-
4610-void mir_wait_for_one(MirWaitHandle* wait_handle)
4611-{
4612- if (wait_handle)
4613- wait_handle->wait_for_one();
4614-}
4615-
4616-MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface)
4617-{
4618- return reinterpret_cast<MirEGLNativeWindowType>(surface->generate_native_window());
4619-}
4620-
4621-MirWaitHandle* mir_surface_set_type(MirSurface *surf,
4622- MirSurfaceType type)
4623-{
4624- try
4625- {
4626- return surf ? surf->configure(mir_surface_attrib_type, type) : nullptr;
4627- }
4628- catch (std::exception const&)
4629- {
4630- return nullptr;
4631- }
4632-}
4633-
4634-MirSurfaceType mir_surface_get_type(MirSurface *surf)
4635-{
4636- MirSurfaceType type = mir_surface_type_normal;
4637-
4638- if (surf)
4639- {
4640- // Only the client will ever change the type of a surface so it is
4641- // safe to get the type from a local cache surf->attrib().
4642-
4643- int t = surf->attrib(mir_surface_attrib_type);
4644- type = static_cast<MirSurfaceType>(t);
4645- }
4646-
4647- return type;
4648-}
4649-
4650-MirWaitHandle* mir_surface_set_state(MirSurface *surf, MirSurfaceState state)
4651-{
4652- try
4653- {
4654- return surf ? surf->configure(mir_surface_attrib_state, state) : nullptr;
4655- }
4656- catch (std::exception const&)
4657- {
4658- return nullptr;
4659- }
4660-}
4661-
4662-MirSurfaceState mir_surface_get_state(MirSurface *surf)
4663-{
4664- MirSurfaceState state = mir_surface_state_unknown;
4665-
4666- try
4667- {
4668- if (surf)
4669- {
4670- int s = surf->attrib(mir_surface_attrib_state);
4671-
4672- if (s == mir_surface_state_unknown)
4673- {
4674- surf->configure(mir_surface_attrib_state,
4675- mir_surface_state_unknown)->wait_for_all();
4676- s = surf->attrib(mir_surface_attrib_state);
4677- }
4678-
4679- state = static_cast<MirSurfaceState>(s);
4680- }
4681- }
4682- catch (std::exception const&)
4683- {
4684- }
4685-
4686- return state;
4687-}
4688-
4689-MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surf, int interval)
4690-{
4691- if ((interval < 0) || (interval > 1))
4692- return nullptr;
4693-
4694- try
4695- {
4696- return surf ? surf->configure(mir_surface_attrib_swapinterval, interval) : nullptr;
4697- }
4698- catch (std::exception const&)
4699- {
4700- return nullptr;
4701- }
4702-}
4703-
4704-int mir_surface_get_swapinterval(MirSurface* surf)
4705-{
4706- return surf ? surf->attrib(mir_surface_attrib_swapinterval) : -1;
4707-}
4708-
4709-void mir_connection_set_lifecycle_event_callback(MirConnection* connection,
4710- mir_lifecycle_event_callback callback, void* context)
4711-{
4712- if (!error_connections.contains(connection))
4713- connection->register_lifecycle_event_callback(callback, context);
4714-}
4715-
4716-void mir_connection_set_display_config_change_callback(MirConnection* connection,
4717- mir_display_config_callback callback, void* context)
4718-{
4719- if (connection)
4720- connection->register_display_change_callback(callback, context);
4721-}
4722-
4723-MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration)
4724-{
4725- try
4726- {
4727- return connection ? connection->configure_display(display_configuration) : nullptr;
4728- }
4729- catch (std::exception const&)
4730- {
4731- return nullptr;
4732- }
4733-}
4734-
4735-/**************************
4736- * DRM specific functions *
4737- **************************/
4738-
4739-MirWaitHandle *mir_connection_drm_auth_magic(MirConnection* connection,
4740- unsigned int magic,
4741- mir_drm_auth_magic_callback callback,
4742- void* context)
4743-{
4744- return connection->drm_auth_magic(magic, callback, context);
4745-}
4746-
4747-int mir_connection_drm_set_gbm_device(MirConnection* connection,
4748- struct gbm_device* gbm_dev)
4749-{
4750- size_t const pointer_size_in_ints = division_ceiling(sizeof(gbm_dev), sizeof(int));
4751- std::vector<int> extra_data(pointer_size_in_ints);
4752-
4753- memcpy(extra_data.data(), &gbm_dev, sizeof(gbm_dev));
4754-
4755- return connection->set_extra_platform_data(extra_data);
4756-}
4757
4758=== added file 'src/client/mir_connection_api.cpp'
4759--- src/client/mir_connection_api.cpp 1970-01-01 00:00:00 +0000
4760+++ src/client/mir_connection_api.cpp 2014-04-30 13:15:30 +0000
4761@@ -0,0 +1,312 @@
4762+/*
4763+ * Copyright © 2014 Canonical Ltd.
4764+ *
4765+ * This program is free software: you can redistribute it and/or modify it
4766+ * under the terms of the GNU Lesser General Public License version 3,
4767+ * as published by the Free Software Foundation.
4768+ *
4769+ * This program is distributed in the hope that it will be useful,
4770+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4771+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4772+ * GNU Lesser General Public License for more details.
4773+ *
4774+ * You should have received a copy of the GNU Lesser General Public License
4775+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4776+ *
4777+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
4778+ */
4779+
4780+#include "mir_toolkit/mir_connection.h"
4781+#include "mir_toolkit/mir_client_library_drm.h"
4782+#include "mir/default_configuration.h"
4783+#include "mir/raii.h"
4784+
4785+#include "mir_connection.h"
4786+//#include "egl_native_display_container.h"
4787+#include "default_connection_configuration.h"
4788+#include "display_configuration.h"
4789+#include "api_impl_types.h"
4790+#include "error_connections.h"
4791+
4792+
4793+#include <unordered_set>
4794+#include <cstddef>
4795+#include <cstring>
4796+
4797+namespace mcl = mir::client;
4798+
4799+namespace
4800+{
4801+// assign_result is compatible with all 2-parameter callbacks
4802+void assign_result(void* result, void** context)
4803+{
4804+ if (context)
4805+ *context = result;
4806+}
4807+
4808+size_t division_ceiling(size_t a, size_t b)
4809+{
4810+ return ((a - 1) / b) + 1;
4811+}
4812+
4813+
4814+MirWaitHandle* mir_default_connect(
4815+ char const* socket_file,
4816+ char const* name,
4817+ mir_connected_callback callback,
4818+ void* context)
4819+{
4820+
4821+ try
4822+ {
4823+ std::string sock;
4824+ if (socket_file)
4825+ sock = socket_file;
4826+ else
4827+ {
4828+ auto socket_env = getenv("MIR_SOCKET");
4829+ if (socket_env)
4830+ sock = socket_env;
4831+ else
4832+ sock = mir::default_server_socket;
4833+ }
4834+
4835+ mcl::DefaultConnectionConfiguration conf{sock};
4836+
4837+ std::unique_ptr<MirConnection> connection{new MirConnection(conf)};
4838+ auto const result = connection->connect(name, callback, context);
4839+ connection.release();
4840+ return result;
4841+ }
4842+ catch (std::exception const& x)
4843+ {
4844+ MirConnection* error_connection = new MirConnection(x.what());
4845+ mcl::ErrorConnections::instance().insert(error_connection);
4846+ callback(error_connection, context);
4847+ return nullptr;
4848+ }
4849+}
4850+
4851+
4852+void mir_default_connection_release(MirConnection* connection)
4853+{
4854+ if (!mcl::ErrorConnections::instance().contains(connection))
4855+ {
4856+ try
4857+ {
4858+ auto wait_handle = connection->disconnect();
4859+ wait_handle->wait_for_all();
4860+ }
4861+ catch (std::exception const&)
4862+ {
4863+ // We're implementing a C API so no exceptions are to be
4864+ // propagated. And that's OK because if disconnect() fails,
4865+ // we don't care why. We're finished with the connection anyway.
4866+ }
4867+ }
4868+ else
4869+ {
4870+ mcl::ErrorConnections::instance().remove(connection);
4871+ }
4872+
4873+ delete connection;
4874+}
4875+
4876+}
4877+
4878+//mir_connect and mir_connection_release can be overridden by test code that sets these function
4879+//pointers to do things like stub out the graphics drivers or change the connection configuration.
4880+
4881+//TODO: we could have a more comprehensive solution that allows us to substitute any of the functions
4882+//for test purposes, not just the connect functions
4883+mir_connect_impl_func mir_connect_impl = mir_default_connect;
4884+mir_connection_release_impl_func mir_connection_release_impl = mir_default_connection_release;
4885+
4886+MirWaitHandle* mir_connect(
4887+ char const* socket_file,
4888+ char const* name,
4889+ mir_connected_callback callback,
4890+ void* context)
4891+{
4892+ try
4893+ {
4894+ return mir_connect_impl(socket_file, name, callback, context);
4895+ }
4896+ catch (std::exception const&)
4897+ {
4898+ return nullptr;
4899+ }
4900+}
4901+
4902+MirConnection* mir_connect_sync(
4903+ char const* server,
4904+ char const* app_name)
4905+{
4906+ MirConnection* conn = nullptr;
4907+ mir_wait_for(mir_connect(server, app_name,
4908+ reinterpret_cast<mir_connected_callback>
4909+ (assign_result),
4910+ &conn));
4911+ return conn;
4912+}
4913+
4914+MirBool mir_connection_is_valid(MirConnection* connection)
4915+{
4916+ return MirConnection::is_valid(connection) ? mir_true : mir_false;
4917+}
4918+
4919+char const* mir_connection_get_error_message(MirConnection* connection)
4920+{
4921+ return connection->get_error_message();
4922+}
4923+
4924+void mir_connection_release(MirConnection* connection)
4925+{
4926+ try
4927+ {
4928+ return mir_connection_release_impl(connection);
4929+ }
4930+ catch (std::exception const&)
4931+ {
4932+ }
4933+}
4934+
4935+void mir_connection_get_platform(
4936+ MirConnection* connection,
4937+ MirPlatformPackage* platform_package)
4938+{
4939+ connection->populate(*platform_package);
4940+}
4941+
4942+void mir_connection_set_lifecycle_event_callback(
4943+ MirConnection* connection,
4944+ mir_lifecycle_event_callback callback,
4945+ void* context)
4946+{
4947+ if (!mcl::ErrorConnections::instance().contains(connection))
4948+ connection->register_lifecycle_event_callback(callback, context);
4949+}
4950+
4951+//TODO: DEPRECATED: remove this function
4952+void mir_connection_get_display_info(
4953+ MirConnection* connection,
4954+ MirDisplayInfo* display_info)
4955+{
4956+ auto const config = mir::raii::deleter_for(
4957+ mir_connection_create_display_config(connection),
4958+ &mir_display_config_destroy);
4959+
4960+ if (config->num_outputs < 1)
4961+ return;
4962+
4963+ MirDisplayOutput* state = nullptr;
4964+ // We can't handle more than one display, so just populate based on the first
4965+ // active display we find.
4966+ for (unsigned int i = 0; i < config->num_outputs; ++i)
4967+ {
4968+ if (config->outputs[i].used && config->outputs[i].connected &&
4969+ config->outputs[i].current_mode < config->outputs[i].num_modes)
4970+ {
4971+ state = &config->outputs[i];
4972+ break;
4973+ }
4974+ }
4975+ // Oh, oh! No connected outputs?!
4976+ if (state == nullptr)
4977+ {
4978+ memset(display_info, 0, sizeof(*display_info));
4979+ return;
4980+ }
4981+
4982+ MirDisplayMode mode = state->modes[state->current_mode];
4983+
4984+ display_info->width = mode.horizontal_resolution;
4985+ display_info->height = mode.vertical_resolution;
4986+
4987+ unsigned int format_items;
4988+ if (state->num_output_formats > mir_supported_pixel_format_max)
4989+ format_items = mir_supported_pixel_format_max;
4990+ else
4991+ format_items = state->num_output_formats;
4992+
4993+ display_info->supported_pixel_format_items = format_items;
4994+ for(auto i=0u; i < format_items; i++)
4995+ {
4996+ display_info->supported_pixel_format[i] = state->output_formats[i];
4997+ }
4998+}
4999+
5000+MirDisplayConfiguration* mir_connection_create_display_config(
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: