qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
src
platform
x11_display.cpp
Go to the documentation of this file.
1
/*
2
Copyright © 2017-2019 by The qTox Project Contributors
3
4
This file is part of qTox, a Qt-based graphical interface for Tox.
5
6
qTox is libre software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
qTox is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with qTox. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <QtCore/qsystemdetection.h>
21
#include "
src/platform/x11_display.h
"
22
#include <QMutex>
23
#include <X11/Xlib.h>
24
25
namespace
Platform
{
26
27
struct
X11DisplayPrivate
28
{
29
Display*
display
;
30
QMutex
mutex
;
31
32
X11DisplayPrivate
()
33
:
display
(XOpenDisplay(nullptr))
34
{
35
}
36
~X11DisplayPrivate
()
37
{
38
if
(
display
) {
39
XCloseDisplay(
display
);
40
}
41
}
42
static
X11DisplayPrivate
&
getSingleInstance
()
43
{
44
// object created on-demand
45
static
X11DisplayPrivate
singleInstance;
46
return
singleInstance;
47
}
48
};
49
50
Display* X11Display::lock()
51
{
52
X11DisplayPrivate& singleInstance =
X11DisplayPrivate::getSingleInstance
();
53
singleInstance.mutex.lock();
54
return
singleInstance.display;
55
}
56
57
void
X11Display::unlock()
58
{
59
X11DisplayPrivate::getSingleInstance
().
mutex
.unlock();
60
}
61
}
Platform::X11DisplayPrivate::~X11DisplayPrivate
~X11DisplayPrivate()
Definition:
x11_display.cpp:36
Platform::X11DisplayPrivate::mutex
QMutex mutex
Definition:
x11_display.cpp:30
x11_display.h
Platform::X11DisplayPrivate::X11DisplayPrivate
X11DisplayPrivate()
Definition:
x11_display.cpp:32
Platform
Definition:
autorun_win.cpp:45
Platform::X11DisplayPrivate
Definition:
x11_display.cpp:27
Platform::X11DisplayPrivate::getSingleInstance
static X11DisplayPrivate & getSingleInstance()
Definition:
x11_display.cpp:42
Platform::X11DisplayPrivate::display
Display * display
Definition:
x11_display.cpp:29
Generated by
1.8.17