| 1 |
/* |
| 2 |
* Copyright (C) 2017-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "Connection.h" |
| 10 |
|
| 11 |
#include "utils/log.h" |
| 12 |
|
| 13 |
#include <cassert> |
| 14 |
#include <stdexcept> |
| 15 |
|
| 16 |
using namespace KODI::WINDOWING::WAYLAND; |
| 17 |
|
| 18 |
CConnection::CConnection() |
| 19 |
{ |
| 20 |
try |
| 21 |
{ |
| 22 |
m_display = std::make_unique<wayland::display_t>(); |
| 23 |
} |
| 24 |
catch (const std::exception& err) |
| 25 |
{ |
| 26 |
CLog::Log(LOGERROR, "Wayland connection error: {}", err.what()); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
bool CConnection::HasDisplay() const |
| 31 |
{ |
| 32 |
return static_cast<bool>(m_display); |
| 33 |
} |
| 34 |
|
| 35 |
wayland::display_t& CConnection::GetDisplay() |
| 36 |
{ |
| 37 |
assert(m_display); |
| 38 |
return *m_display; |
| 39 |
} |