blob: 9d99c156fdfe48384863625841c37bea1304ed8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* Copyright (C) 2017-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include <set>
#include <string>
#include <vector>
class CWindowTranslator
{
public:
/*!
* \brief Get a list of all known window names
*/
static void GetWindows(std::vector<std::string>& windowList);
/*!
* \brief Translate between a window name and its ID
* \param window The name of the window
* \return ID of the window, or WINDOW_INVALID if not found
*/
static int TranslateWindow(const std::string& window);
/*!
* \brief Translate between a window id and it's name
* \param window id of the window
* \return name of the window, or an empty string if not found
*/
static std::string TranslateWindow(int windowId);
/*!
* \brief Get the window ID that should be used as fallback for keymap input
* \return The fallback window, or -1 for no fallback window
*/
static int GetFallbackWindow(int windowId);
/*!
* \brief Get the special window ID if conditions met
* \return The special window ID or the given window ID
*/
static int GetVirtualWindow(int windowId);
private:
struct WindowMapItem
{
const char* windowName;
int windowId;
};
struct WindowNameCompare
{
bool operator()(const WindowMapItem& lhs, const WindowMapItem& rhs) const;
};
struct WindowIDCompare
{
bool operator()(const WindowMapItem& lhs, const WindowMapItem& rhs) const;
};
using WindowMapByName = std::set<WindowMapItem, WindowNameCompare>;
using WindowMapByID = std::set<WindowMapItem, WindowIDCompare>;
static WindowMapByID CreateWindowMappingByID();
static const WindowMapByName WindowMappingByName;
};
|