Skip to content

Commit 6c8f3e5

Browse files
authored
bugfix: initial_placement_done is only available on Mir >= 2.19 (#459)
1 parent 73e1f12 commit 6c8f3e5

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

src/forwarding_surface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ void ForwardingSurface::unregister_interest(const mir::scene::SurfaceObserver& o
146146
surface_->unregister_interest(observer);
147147
}
148148

149+
#if (MIR_SERVER_MAJOR_VERSION > 2) || (MIR_SERVER_MAJOR_VERSION == 2 && MIR_SERVER_MINOR_VERSION >= 19)
149150
void ForwardingSurface::initial_placement_done()
150151
{
151152
}
153+
#endif
152154

153155
std::string ForwardingSurface::name() const
154156
{

src/forwarding_surface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#define ANIMATING_SURFACE_H
2020

2121
#include <mir/scene/surface.h>
22+
#include <mir/version.h>
2223

2324
namespace miracle
2425
{
@@ -47,7 +48,9 @@ class ForwardingSurface : public mir::scene::Surface
4748
void register_interest(const std::weak_ptr<mir::scene::SurfaceObserver>& observer, mir::Executor& executor) override;
4849
void register_early_observer(const std::weak_ptr<mir::scene::SurfaceObserver>& observer, mir::Executor& executor) override;
4950
void unregister_interest(const mir::scene::SurfaceObserver& observer) override;
51+
#if (MIR_SERVER_MAJOR_VERSION > 2) || (MIR_SERVER_MAJOR_VERSION == 2 && MIR_SERVER_MINOR_VERSION >= 19)
5052
void initial_placement_done() override;
53+
#endif
5154
std::string name() const override;
5255
mir::geometry::Size content_size() const override;
5356
mir::geometry::Rectangle input_bounds() const override;

tests/mock_surface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <gmock/gmock.h>
2121
#include <mir/scene/surface.h>
22+
#include <mir/version.h>
2223

2324
namespace miracle
2425
{
@@ -27,7 +28,9 @@ namespace test
2728
class MockSurface : public mir::scene::Surface
2829
{
2930
public:
31+
#if (MIR_SERVER_MAJOR_VERSION > 2) || (MIR_SERVER_MAJOR_VERSION == 2 && MIR_SERVER_MINOR_VERSION >= 19)
3032
MOCK_METHOD(void, initial_placement_done, (), (override));
33+
#endif
3134
MOCK_METHOD(mir::geometry::Displacement, content_offset, (), (const, override));
3235
MOCK_METHOD(std::shared_ptr<mir::frontend::BufferStream>, primary_buffer_stream, (), (const, override));
3336
MOCK_METHOD((mir::wayland::Weak<mir::frontend::WlSurface> const&), wayland_surface, (), (override));

tests/stub_surface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace miracle::test
2525
class StubSurface : public mir::scene::Surface
2626
{
2727
public:
28-
#if MIR_SERVER_MAJOR_VERSION >= 2 && MIR_SERVER_MINOR_VERSION >= 19
28+
#if (MIR_SERVER_MAJOR_VERSION > 2) || (MIR_SERVER_MAJOR_VERSION == 2 && MIR_SERVER_MINOR_VERSION >= 19)
2929
void initial_placement_done() override { }
3030
#endif
3131

0 commit comments

Comments
 (0)