Browse Source

FIX: Qt5 version - execute under wayland session

Alexander Koblov 7 years ago
parent
commit
0a756bb17e
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/platform/unix/uqt5workaround.pas

+ 5 - 0
src/platform/unix/uqt5workaround.pas

@@ -11,12 +11,17 @@ uses
 
 
 procedure _exit(status: cint); cdecl; external clib;
 procedure _exit(status: cint); cdecl; external clib;
 function atexit(func: pointer): cint; cdecl; external clib;
 function atexit(func: pointer): cint; cdecl; external clib;
+function setenv(const name, value: pchar; overwrite: cint): cint; cdecl; external clib;
 
 
 procedure DoExit; cdecl;
 procedure DoExit; cdecl;
 begin
 begin
   _exit(ExitCode);
   _exit(ExitCode);
 end;
 end;
 
 
+initialization
+  if (LowerCase(fpGetEnv(PAnsiChar('XDG_SESSION_TYPE'))) = 'wayland') then
+    setenv('QT_QPA_PLATFORM', 'xcb', 1);
+
 finalization
 finalization
   // Workaround: https://doublecmd.sourceforge.io/mantisbt/view.php?id=2079
   // Workaround: https://doublecmd.sourceforge.io/mantisbt/view.php?id=2079
   if (UpCase(fpGetEnv(PAnsiChar('XDG_CURRENT_DESKTOP'))) = 'KDE') then
   if (UpCase(fpGetEnv(PAnsiChar('XDG_CURRENT_DESKTOP'))) = 'KDE') then