OSDN Git Service

okular: hack for KMediaPlayer
authorIvailo Monev <xakepa10@gmail.com>
Sun, 27 Nov 2022 18:24:02 +0000 (20:24 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 27 Nov 2022 18:24:02 +0000 (20:24 +0200)
see 47ec3236740662c482f4359bb07a971a3e14e580

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
okular/shell/main.cpp

index 1628960..e62d142 100644 (file)
 #include "okular_main.h"
 #include "shellutils.h"
 
+// NOTE: this has to be done before application instance is created and KMediaPlayer requires it,
+// i.e. it is too late to do it from the kmediaplayer library itself if it is dlopen-ed
+#if defined(Q_WS_X11)
+static int okular_x11_init_threads() {
+    QApplication::setAttribute(Qt::AA_X11InitThreads, true);
+    return 1;
+};
+Q_CONSTRUCTOR_FUNCTION(okular_x11_init_threads)
+#endif
+
 int main(int argc, char** argv)
 {
     KAboutData about = okularAboutData( "okular", I18N_NOOP( "Okular" ) );