~brandontschaefer/mir/first-round-deprecation

« back to all changes in this revision

Viewing changes to src/client/rpc/mir_protobuf_rpc_channel.cpp

  • Committer: Brandon Schaefer
  • Date: 2016-12-13 17:59:30 UTC
  • mfrom: (3787.1.93 development-branch)
  • Revision ID: brandon.schaefer@canonical.com-20161213175930-j9o7qn0b11n3kzlm
* Merge trunk, fix conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
    if (auto map = surface_map.lock()) 
106
106
    {
107
107
        map->with_all_streams_do(
108
 
            [](mcl::ClientBufferStream* receiver) {
 
108
            [](MirBufferStream* receiver) {
109
109
                if (receiver) receiver->buffer_unavailable();
110
110
            });
111
111
    }
269
269
        display_configuration->update_configuration(seq.display_configuration());
270
270
    }
271
271
 
272
 
    if (seq.input_devices_size())
 
272
    if (seq.has_input_devices())
273
273
    {
274
 
        std::vector<mir::input::DeviceData> devices;
275
 
 
276
 
        devices.reserve(seq.input_devices_size());
277
 
 
278
 
        for (auto const& dev : seq.input_devices())
279
 
            devices.emplace_back(dev.id(), dev.capabilities(), dev.name(), dev.unique_id());
280
 
 
281
 
        input_devices->update_devices(std::move(devices));
 
274
        input_devices->update_devices(seq.input_devices());
282
275
    }
283
276
 
284
277
    if (seq.has_lifecycle_event())
319
312
            {
320
313
                if (seq.buffer_request().has_id())
321
314
                {
322
 
                    map->with_stream_do(mf::BufferStreamId(seq.buffer_request().id().value()),
323
 
                    [&] (mcl::ClientBufferStream* receiver) {
 
315
                    mf::BufferStreamId stream_id(seq.buffer_request().id().value());
 
316
                    if (auto receiver = map->stream(stream_id))
324
317
                        receiver->buffer_available(seq.buffer_request().buffer());
325
 
                    });
326
318
                }
327
319
                
328
320
                else if (seq.buffer_request().has_operation())
379
371
                {
380
372
                    rpc_report->event_parsing_succeeded(*e);
381
373
 
382
 
                    auto const send_e = [&e](MirSurface* surface)
383
 
                        { surface->handle_event(*e); };
 
374
                    int surface_id = 0;
 
375
                    bool is_surface_event = true;
384
376
 
385
377
                    switch (e->type())
386
378
                    {
387
379
                    case mir_event_type_surface:
388
 
                        if (auto map = surface_map.lock())
389
 
                            map->with_surface_do(mf::SurfaceId(e->to_surface()->id()), send_e);
 
380
                        surface_id = e->to_surface()->id();
390
381
                        break;
391
 
 
392
382
                    case mir_event_type_resize:
393
 
                        if (auto map = surface_map.lock())
394
 
                            map->with_surface_do(mf::SurfaceId(e->to_resize()->surface_id()), send_e);
 
383
                        surface_id = e->to_resize()->surface_id();
395
384
                        break;
396
 
 
397
385
                    case mir_event_type_orientation:
398
 
                        if (auto map = surface_map.lock())
399
 
                            map->with_surface_do(mf::SurfaceId(e->to_orientation()->surface_id()), send_e);
 
386
                        surface_id = e->to_orientation()->surface_id();
400
387
                        break;
401
 
 
402
388
                    case mir_event_type_close_surface:
403
 
                        if (auto map = surface_map.lock())
404
 
                            map->with_surface_do(mf::SurfaceId(e->to_close_surface()->surface_id()), send_e);
 
389
                        surface_id = e->to_close_surface()->surface_id();
405
390
                        break;
406
391
                    case mir_event_type_keymap:
407
 
                        if (auto map = surface_map.lock())
408
 
                            map->with_surface_do(mf::SurfaceId(e->to_keymap()->surface_id()), send_e);
 
392
                        surface_id = e->to_keymap()->surface_id();
409
393
                        break;
410
394
                    case mir_event_type_surface_output:
411
 
                        if (auto map = surface_map.lock())
412
 
                            map->with_surface_do(mf::SurfaceId(e->to_surface_output()->surface_id()), send_e);
 
395
                        surface_id = e->to_surface_output()->surface_id();
413
396
                        break;
414
397
                    case mir_event_type_surface_placement:
415
 
                        if (auto map = surface_map.lock())
416
 
                            map->with_surface_do(mf::SurfaceId(e->to_surface_placement()->id()), send_e);
 
398
                        surface_id = e->to_surface_placement()->id();
417
399
                        break;
418
 
 
419
400
                    default:
 
401
                        is_surface_event = false;
420
402
                        event_sink->handle_event(*e);
421
403
                    }
 
404
 
 
405
                    if (is_surface_event)
 
406
                        if (auto map = surface_map.lock())
 
407
                            if (auto surf = map->surface(mf::SurfaceId(surface_id)))
 
408
                                surf->handle_event(*e);
422
409
                }
423
410
            }
424
411
            catch(...)