19 #ifndef MIRAL_TOOLKIT_SURFACE_SPEC_H 20 #define MIRAL_TOOLKIT_SURFACE_SPEC_H 24 #include <mir_toolkit/mir_surface.h> 25 #include <mir_toolkit/mir_connection.h> 26 #include <mir_toolkit/version.h> 38 explicit SurfaceSpec(MirSurfaceSpec* spec) : self{spec, deleter} {}
42 return SurfaceSpec{mir_connection_create_spec_for_normal_surface(connection, width, height, format)};
45 static auto for_menu(MirConnection* connection,
48 MirPixelFormat format,
53 return SurfaceSpec{mir_connection_create_spec_for_menu(connection, width, height, format, parent, rect, edge)};
58 return SurfaceSpec{mir_connection_create_spec_for_changes(connection)};
63 mir_surface_spec_set_buffer_usage(*
this, usage);
69 mir_surface_spec_set_type(*
this, type);
75 mir_surface_spec_set_min_width(*
this, min_width);
76 mir_surface_spec_set_min_height(*
this, min_height);
82 mir_surface_spec_set_max_width(*
this, max_width);
83 mir_surface_spec_set_max_height(*
this, max_height);
89 mir_surface_spec_set_width_increment(*
this, width_inc);
90 mir_surface_spec_set_height_increment(*
this, height_inc);
96 mir_surface_spec_set_width(*
this, width);
97 mir_surface_spec_set_height(*
this, height);
103 mir_surface_spec_set_name(*
this, name);
109 mir_surface_spec_set_event_handler(*
this, callback, context);
113 #if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3, 4, 0) 115 MirPlacementGravity rect_gravity,
116 MirPlacementGravity surface_gravity,
117 MirPlacementHints placement_hints,
121 mir_surface_spec_set_placement(*
this, rect, rect_gravity, surface_gravity, placement_hints, offset_dx, offset_dy);
126 template<
typename Context>
127 void create_surface(
void (*callback)(MirSurface*, Context*), Context* context)
const 129 mir_surface_create(*
this, reinterpret_cast<mir_surface_callback>(callback), context);
134 return Surface{mir_surface_create_sync(*
this)};
139 mir_surface_apply_spec(surface, *
this);
142 operator MirSurfaceSpec*()
const {
return self.get(); }
145 static void deleter(MirSurfaceSpec* spec) { mir_surface_spec_release(spec); }
146 std::shared_ptr<MirSurfaceSpec>
self;
151 #endif //MIRAL_TOOLKIT_SURFACE_SPEC_H_H
Mir Abstraction Layer.
Definition: active_outputs.h:27