Skip to content

Commit

Permalink
X11: Fix accessing correct X11 display
Browse files Browse the repository at this point in the history
Fixes #1860
  • Loading branch information
hluk committed Jan 2, 2022
1 parent 7d69742 commit 6d0a340
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ sudo apt install \
libqt5svg5 \
libqt5svg5-dev \
libqt5waylandclient5-dev \
libqt5x11extras5-dev \
libwayland-dev \
libxfixes-dev \
libxtst-dev \
Expand All @@ -265,6 +266,7 @@ sudo yum install \
qt5-qtsvg-devel \
qt5-qttools-devel \
qt5-qtwayland-devel \
qt5-qtx11extras-devel \
wayland-devel \
kf5-knotifications-devel
```
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Build-Depends:
libxfixes-dev,
libxtst-dev,
libqt5waylandclient5-dev,
libqt5x11extras5-dev,
qtbase5-private-dev,
qtdeclarative5-dev,
qttools5-dev,
Expand Down
2 changes: 2 additions & 0 deletions docs/build-source-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ On **Ubuntu** you can install all build dependencies with:
libqt5svg5 \
libqt5svg5-dev \
libqt5waylandclient5-dev \
libqt5x11extras5-dev \
libwayland-dev \
libxfixes-dev \
libxtst-dev \
Expand Down Expand Up @@ -69,6 +70,7 @@ On **Fedora** and derivatives you can install all build dependencies with:
qt5-qtsvg-devel \
qt5-qttools-devel \
qt5-qtwayland-devel \
qt5-qtx11extras-devel \
wayland-devel

Build and Install
Expand Down
10 changes: 7 additions & 3 deletions src/platform/x11/x11info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

#include <QGuiApplication>

#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
# include <QX11Info>
#else
# include <QtGui/private/qtx11extras_p.h>
#endif

#include <X11/Xlib.h>

bool X11Info::isPlatformX11()
Expand All @@ -30,7 +36,5 @@ bool X11Info::isPlatformX11()

Display *X11Info::display()
{
static const QByteArray displayName = qgetenv("DISPLAY");
static Display *display = XOpenDisplay(displayName.constData());
return display;
return QX11Info::display();
}
6 changes: 6 additions & 0 deletions src/platform/x11/x11platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ set(USE_QXT TRUE)

set(copyq_LIBRARIES ${copyq_LIBRARIES} ${X11_LIBRARIES} ${X11_Xfixes_LIB})

if(WITH_QT6)
list(APPEND copyq_LIBRARIES Qt::GuiPrivate)
else()
list(APPEND copyq_qt_modules X11Extras)
endif()

# Wayland clipboard
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
Expand Down
2 changes: 1 addition & 1 deletion utils/fedora/copyq.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Url: https://hluk.github.io/%{project}/
Source0: https://github.com/hluk/%{project}/archive/%{revision}.tar.gz
BuildRequires: libXtst-devel, libXfixes-devel, desktop-file-utils
BuildRequires: kf5-rpm-macros, qt5-qtbase-devel, qt5-qtsvg-devel
BuildRequires: qt5-qttools-devel, qt5-qtscript-devel, qwt-qt5-devel
BuildRequires: qt5-qttools-devel, qt5-qtscript-devel, qwt-qt5-devel, qt5-qtx11extras-devel
BuildRequires: extra-cmake-modules, appstream-qt-devel, libappstream-glib
BuildRequires: qt5-qtbase-private-devel
BuildRequires: qt5-qtwayland-devel wayland-devel
Expand Down
2 changes: 2 additions & 0 deletions utils/github/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ packages=(
qttools5-dev
qttools5-dev-tools

libqt5x11extras5-dev

libqt5svg5-dev
libqt5svg5

Expand Down
1 change: 1 addition & 0 deletions utils/gitlab/build-before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ apt -y install \
libqt5svg5 \
libqt5svg5-dev \
libqt5waylandclient5-dev \
libqt5x11extras5-dev \
libwayland-dev \
libxfixes-dev \
libxtst-dev \
Expand Down
1 change: 1 addition & 0 deletions utils/gitlab/test-before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ packages=(
libqt5svg5
libqt5xml5
libqt5test5
libqt5x11extras5

libx11-6
libxtst6
Expand Down

0 comments on commit 6d0a340

Please sign in to comment.