~alan-griffiths/miral/debug

« back to all changes in this revision

Viewing changes to include/miral/toolkit/surface_spec.h

  • Committer: Alan Griffiths
  • Date: 2016-09-14 09:03:34 UTC
  • Revision ID: alam@octopull.co.uk-20160914090334-r7oyyrmp68dwo5se
Tidy code

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef MIRAL_TOOLKIT_SURFACE_SPEC_H
20
20
#define MIRAL_TOOLKIT_SURFACE_SPEC_H
21
21
 
 
22
#include <miral/toolkit/surface.h>
 
23
 
22
24
#include <mir_toolkit/mir_surface.h>
23
25
#include <mir_toolkit/mir_connection.h>
 
26
#include <mir_toolkit/version.h>
24
27
 
25
28
#include <memory>
26
29
 
87
90
        return *this;
88
91
    }
89
92
 
 
93
#if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0)
 
94
    auto set_placement(const MirRectangle* rect,
 
95
                       MirPlacementGravity rect_gravity,
 
96
                       MirPlacementGravity surface_gravity,
 
97
                       MirPlacementHints   placement_hints,
 
98
                       int                 offset_dx,
 
99
                       int                 offset_dy) -> SurfaceSpec&
 
100
    {
 
101
        mir_surface_spec_set_placement(*this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy);
 
102
        return *this;
 
103
    }
 
104
#endif
 
105
 
90
106
    template<typename Context>
91
107
    void create_surface(void (*callback)(MirSurface*, Context*), Context* context) const
92
108
    {
93
109
        mir_surface_create(*this, reinterpret_cast<mir_surface_callback>(callback), context);
94
110
    }
95
111
 
96
 
    auto create_surface() const -> MirSurface*
 
112
    auto create_surface() const -> Surface
97
113
    {
98
 
        return mir_surface_create_sync(*this);
 
114
        return Surface{mir_surface_create_sync(*this)};
99
115
    }
100
116
 
101
 
    void apply_to(MirSurface* surface)
 
117
    void apply_to(MirSurface* surface) const
102
118
    {
103
119
        mir_surface_apply_spec(surface, *this);
104
120
    }