420
420
mir::protobuf::Void* /*response*/,
421
421
google::protobuf::Closure* done)
423
auto const& surface_specification = request->surface_specification();
424
426
std::unique_lock<std::mutex> lock(session_mutex);
426
auto session = weak_session.lock();
428
auto const session = weak_session.lock();
428
430
BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session"));
430
432
msh::SurfaceSpecification mods;
431
if (request->has_name())
432
mods.name = request->name();
433
// TODO: More fields soon (LP: #1422522) (LP: #1420573)
434
#define COPY_IF_SET(name)\
435
if (surface_specification.has_##name())\
436
mods.name = decltype(mods.name.value())(surface_specification.name())
440
COPY_IF_SET(pixel_format);
441
COPY_IF_SET(buffer_usage);
443
COPY_IF_SET(output_id);
446
COPY_IF_SET(preferred_orientation);
447
COPY_IF_SET(parent_id);
448
// aux_rect is a special case (below)
449
COPY_IF_SET(edge_attachment);
450
COPY_IF_SET(min_width);
451
COPY_IF_SET(min_height);
452
COPY_IF_SET(max_width);
453
COPY_IF_SET(max_height);
457
if (surface_specification.has_aux_rect())
459
auto const& rect = surface_specification.aux_rect();
460
mods.aux_rect = {{rect.left(), rect.top()}, {rect.width(), rect.height()}};
435
463
auto const id = mf::SurfaceId(request->surface_id().value());