summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/CMakeLists.txt4
-rw-r--r--gui/init.cpp11
2 files changed, 15 insertions, 0 deletions
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index cb5e2bdc..e22017ea 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -15,3 +15,7 @@ elseif(LINUX)
otr_pkgconfig(${self} libprocps)
endif()
+if(NOT APPLE AND NOT WIN32)
+ target_compile_definitions(${self} PRIVATE -DOTR_X11_THREADS)
+ otr_pkgconfig(${self} x11)
+endif()
diff --git a/gui/init.cpp b/gui/init.cpp
index 9cb32e2c..04334782 100644
--- a/gui/init.cpp
+++ b/gui/init.cpp
@@ -71,6 +71,14 @@ static void set_fp_mask()
#endif
}
+#ifdef OTR_X11_THREADS
+#include <X11/Xlib.h>
+static void enable_x11_threads()
+{
+ (void)XInitThreads();
+}
+#endif
+
static void set_qt_style()
{
#if defined _WIN32 || defined __APPLE__
@@ -237,6 +245,9 @@ static int run_window(std::unique_ptr<QWidget> main_window)
int otr_main(int argc, char** argv, std::function<QWidget*()> const& make_main_window)
{
set_fp_mask();
+#ifdef OTR_X11_THREADS
+ enable_x11_threads();
+#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);