~afrantzis/mir/reproduce-1444047

« back to all changes in this revision

Viewing changes to src/server/frontend/session_mediator.cpp

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2015-04-13 10:22:21 UTC
  • mfrom: (2464.3.10 mir3)
  • Revision ID: tarmac-20150413102221-yqyds6otecvr9mir
RPC, frontend: "wiring up" to pass generic surface modification requests from wire to the shell.

Approved by Chris Halse Rogers, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
420
420
    mir::protobuf::Void* /*response*/,
421
421
    google::protobuf::Closure* done)
422
422
{
 
423
    auto const& surface_specification = request->surface_specification();
 
424
 
423
425
    {
424
426
        std::unique_lock<std::mutex> lock(session_mutex);
425
427
 
426
 
        auto session = weak_session.lock();
 
428
        auto const session = weak_session.lock();
427
429
        if (!session)
428
430
            BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session"));
429
431
 
430
432
        msh::SurfaceSpecification mods;
431
 
        if (request->has_name())
432
 
            mods.name = request->name();
433
 
        // TODO: More fields soon (LP: #1422522) (LP: #1420573)
 
433
 
 
434
        #define COPY_IF_SET(name)\
 
435
            if (surface_specification.has_##name())\
 
436
                mods.name = decltype(mods.name.value())(surface_specification.name())
 
437
 
 
438
        COPY_IF_SET(width);
 
439
        COPY_IF_SET(height);
 
440
        COPY_IF_SET(pixel_format);
 
441
        COPY_IF_SET(buffer_usage);
 
442
        COPY_IF_SET(name);
 
443
        COPY_IF_SET(output_id);
 
444
        COPY_IF_SET(type);
 
445
        COPY_IF_SET(state);
 
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);
 
454
 
 
455
        #undef COPY_IF_SET
 
456
 
 
457
        if (surface_specification.has_aux_rect())
 
458
        {
 
459
            auto const& rect = surface_specification.aux_rect();
 
460
            mods.aux_rect = {{rect.left(), rect.top()}, {rect.width(), rect.height()}};
 
461
        }
434
462
 
435
463
        auto const id = mf::SurfaceId(request->surface_id().value());
436
464