~kdub/unity-system-compositor/unblock-silo0

« back to all changes in this revision

Viewing changes to src/unity_screen_service.cpp

  • Committer: Gerry Boland
  • Date: 2015-07-08 16:01:11 UTC
  • mfrom: (200.3.5 ubuntu)
  • Revision ID: gerry.boland@canonical.com-20150708160111-04q86t55rpvujtzq
Merge fix-1461476-display-off-ubuntu

Show diffs side-by-side

added added

removed removed

Lines of Context:
323
323
{
324
324
    std::lock_guard<std::mutex> lock{keep_display_on_mutex};
325
325
 
 
326
    bool id_removed{false};
 
327
 
326
328
    auto range = keep_display_on_ids.equal_range(sender);
327
329
    for (auto iter = range.first;
328
330
         iter != range.second;
331
333
        if (iter->second == id)
332
334
        {
333
335
            keep_display_on_ids.erase(iter);
 
336
            id_removed = true;
334
337
            break;
335
338
        }
336
339
    }
337
340
 
338
 
    if (keep_display_on_ids.empty())
 
341
    if (id_removed && keep_display_on_ids.empty())
339
342
        screen->keep_display_on(false);
340
343
}
341
344
 
355
358
    if (new_owner.empty() && old_owner == name)
356
359
    {
357
360
        std::lock_guard<std::mutex> lock{keep_display_on_mutex};
358
 
        keep_display_on_ids.erase(name);
359
 
        if (keep_display_on_ids.empty())
 
361
        // If the disconnected client had issued keepDisplayOn requests
 
362
        // and after removing them there are now no more requests left,
 
363
        // tell the screen we don't need to keep the display on.
 
364
        if (keep_display_on_ids.erase(name) > 0 &&
 
365
            keep_display_on_ids.empty())
 
366
        {
360
367
            screen->keep_display_on(false);
 
368
        }
361
369
    }
362
370
}
363
371