mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 07:21:32 +08:00
Removes dependency on QtX11Extras for Qt6.2-beta (#331)
* Removes dependency on QtX11Extras and implements placeholder solution with QtGUI private API * Fixes CMakeLists.txt to work with Qt5 and Qt6 * Removes all other uses of X11extras * Renames and moves x11 methods into ads::internal * Fixes typo * Adds gui-private to src.pro
This commit is contained in:
parent
3a99bdcfb4
commit
fc91502162
1
.github/workflows/linux-builds.yml
vendored
1
.github/workflows/linux-builds.yml
vendored
@ -16,7 +16,6 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get install qt5-default
|
||||
sudo apt-get install libqt5x11extras5-dev
|
||||
- name: qmake
|
||||
run: qmake
|
||||
- name: make
|
||||
|
20
.travis.yml
20
.travis.yml
@ -9,8 +9,6 @@ matrix:
|
||||
os: linux
|
||||
dist: trusty
|
||||
group: stable
|
||||
before_install:
|
||||
- sudo apt-get -y install libqt5x11extras5-dev
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -20,8 +18,6 @@ matrix:
|
||||
packages:
|
||||
- qt55base
|
||||
- qt55tools
|
||||
- qt55x11extras
|
||||
- libqt5x11extras5-dev
|
||||
- gcc-9
|
||||
- g++-9
|
||||
script:
|
||||
@ -39,8 +35,6 @@ matrix:
|
||||
services:
|
||||
- xvfb
|
||||
compiler: gcc
|
||||
before_install:
|
||||
- sudo apt-get -y install libqt5x11extras5-dev
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -50,8 +44,6 @@ matrix:
|
||||
packages:
|
||||
- qt514base
|
||||
- qt514tools
|
||||
- qt514x11extras
|
||||
- libqt5x11extras5-dev
|
||||
- gcc-9
|
||||
- g++-9
|
||||
- libc6-i386
|
||||
@ -73,8 +65,6 @@ matrix:
|
||||
services:
|
||||
- xvfb
|
||||
compiler: gcc
|
||||
before_install:
|
||||
- sudo apt-get -y install libqt5x11extras5-dev
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -84,8 +74,6 @@ matrix:
|
||||
packages:
|
||||
- qt514base
|
||||
- qt514tools
|
||||
- qt514x11extras
|
||||
- libqt5x11extras5-dev
|
||||
- gcc-9
|
||||
- g++-9
|
||||
- libc6-i386
|
||||
@ -107,8 +95,6 @@ matrix:
|
||||
services:
|
||||
- xvfb
|
||||
compiler: gcc
|
||||
before_install:
|
||||
- sudo apt-get -y install libqt5x11extras5-dev
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -118,8 +104,6 @@ matrix:
|
||||
packages:
|
||||
- qt514base
|
||||
- qt514tools
|
||||
- qt514x11extras
|
||||
- libqt5x11extras5-dev
|
||||
- gcc-9
|
||||
- g++-9
|
||||
- libc6-i386
|
||||
@ -147,8 +131,6 @@ matrix:
|
||||
services:
|
||||
- xvfb
|
||||
compiler: gcc
|
||||
before_install:
|
||||
- sudo apt-get -y install libqt5x11extras5-dev
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -158,8 +140,6 @@ matrix:
|
||||
packages:
|
||||
- qt514base
|
||||
- qt514tools
|
||||
- qt514x11extras
|
||||
- libqt5x11extras5-dev
|
||||
- gcc-9
|
||||
- g++-9
|
||||
- libc6-i386
|
||||
|
@ -2,7 +2,4 @@ include(CMakeFindDependencyMacro)
|
||||
find_dependency(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_dependency(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
find_dependency(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_dependency(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake")
|
4
setup.py
4
setup.py
@ -227,9 +227,7 @@ class build_ext(sipdistutils.build_ext):
|
||||
extension.extra_link_args += ['-F' + self.qtconfig.QT_INSTALL_LIBS,
|
||||
'-mmacosx-version-min=10.9']
|
||||
elif sys.platform == 'linux':
|
||||
extension.extra_compile_args += ['-D', 'QT_X11EXTRAS_LIB', '-std=c++11']
|
||||
extension.include_dirs += [os.path.join(self.qt_include_dir, 'QtX11Extras')]
|
||||
extension.libraries += ['Qt5X11Extras' + self.qt_libinfix]
|
||||
extension.extra_compile_args += ['-std=c++11']
|
||||
|
||||
return super().swig_sources(sources, extension)
|
||||
|
||||
|
@ -3,7 +3,7 @@ project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS X11Extras REQUIRED)
|
||||
include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
|
||||
endif()
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
if(BUILD_STATIC)
|
||||
@ -64,10 +64,6 @@ endif()
|
||||
target_link_libraries(qtadvanceddocking PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(qtadvanceddocking PUBLIC Qt${QT_VERSION_MAJOR}::X11Extras)
|
||||
target_link_libraries(qtadvanceddocking PRIVATE xcb)
|
||||
endif()
|
||||
set_target_properties(qtadvanceddocking PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
|
@ -39,13 +39,11 @@
|
||||
#include "ads_globals.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <QX11Info>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#endif
|
||||
|
||||
|
||||
#include <QApplication>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
|
||||
namespace ads
|
||||
{
|
||||
@ -57,10 +55,31 @@ static QString _window_manager;
|
||||
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool is_platform_x11()
|
||||
{
|
||||
return QGuiApplication::platformName() == QLatin1String("xcb");
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
xcb_connection_t* x11_connection()
|
||||
{
|
||||
if (!qApp)
|
||||
return nullptr;
|
||||
QPlatformNativeInterface *native = qApp->platformNativeInterface();
|
||||
if (!native)
|
||||
return nullptr;
|
||||
|
||||
void *connection = native->nativeResourceForIntegration(QByteArray("connection"));
|
||||
return reinterpret_cast<xcb_connection_t *>(connection);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
xcb_atom_t xcb_get_atom(const char *name)
|
||||
{
|
||||
if (!QX11Info::isPlatformX11())
|
||||
if (!is_platform_x11())
|
||||
{
|
||||
return XCB_ATOM_NONE;
|
||||
}
|
||||
@ -69,7 +88,7 @@ xcb_atom_t xcb_get_atom(const char *name)
|
||||
{
|
||||
return _xcb_atom_cache[key];
|
||||
}
|
||||
xcb_connection_t *connection = QX11Info::connection();
|
||||
xcb_connection_t *connection = x11_connection();
|
||||
xcb_intern_atom_cookie_t request = xcb_intern_atom(connection, 1, strlen(name), name);
|
||||
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, request, NULL);
|
||||
if (!reply)
|
||||
@ -93,7 +112,7 @@ xcb_atom_t xcb_get_atom(const char *name)
|
||||
//============================================================================
|
||||
void xcb_update_prop(bool set, WId window, const char *type, const char *prop, const char *prop2)
|
||||
{
|
||||
auto connection = QX11Info::connection();
|
||||
auto connection = x11_connection();
|
||||
xcb_atom_t type_atom = xcb_get_atom(type);
|
||||
xcb_atom_t prop_atom = xcb_get_atom(prop);
|
||||
xcb_client_message_event_t event;
|
||||
@ -118,11 +137,11 @@ void xcb_update_prop(bool set, WId window, const char *type, const char *prop, c
|
||||
//============================================================================
|
||||
xcb_get_property_reply_t* _xcb_get_props(WId window, const char *type, unsigned int atom_type)
|
||||
{
|
||||
if (!QX11Info::isPlatformX11())
|
||||
if (!is_platform_x11())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
xcb_connection_t *connection = QX11Info::connection();
|
||||
xcb_connection_t *connection = x11_connection();
|
||||
xcb_atom_t type_atom = xcb_get_atom(type);
|
||||
if (type_atom == XCB_ATOM_NONE)
|
||||
{
|
||||
@ -191,7 +210,7 @@ bool xcb_dump_props(WId window, const char *type)
|
||||
QVector<xcb_atom_t> atoms;
|
||||
xcb_get_prop_list(window, type, atoms, XCB_ATOM_ATOM);
|
||||
qDebug() << "\n\n!!!" << type << " - " << atoms.length();
|
||||
xcb_connection_t *connection = QX11Info::connection();
|
||||
xcb_connection_t *connection = x11_connection();
|
||||
for (auto atom : atoms)
|
||||
{
|
||||
auto foo = xcb_get_atom_name(connection, atom);
|
||||
@ -206,7 +225,7 @@ bool xcb_dump_props(WId window, const char *type)
|
||||
//============================================================================
|
||||
void xcb_add_prop(bool state, WId window, const char *type, const char *prop)
|
||||
{
|
||||
if (!QX11Info::isPlatformX11())
|
||||
if (!is_platform_x11())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -227,7 +246,7 @@ void xcb_add_prop(bool state, WId window, const char *type, const char *prop)
|
||||
{
|
||||
atoms.remove(index);
|
||||
}
|
||||
xcb_connection_t *connection = QX11Info::connection();
|
||||
xcb_connection_t *connection = x11_connection();
|
||||
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, type_atom, XCB_ATOM_ATOM, 32, atoms.count(), atoms.constData());
|
||||
xcb_flush(connection);
|
||||
}
|
||||
@ -238,11 +257,11 @@ QString detectWindowManagerX11()
|
||||
{
|
||||
// Tries to detect the windowmanager via X11.
|
||||
// See: https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.html#idm46018259946000
|
||||
if (!QX11Info::isPlatformX11())
|
||||
if (!is_platform_x11())
|
||||
{
|
||||
return "UNKNOWN";
|
||||
}
|
||||
xcb_connection_t *connection = QX11Info::connection();
|
||||
xcb_connection_t *connection = x11_connection();
|
||||
xcb_screen_t *first_screen = xcb_setup_roots_iterator (xcb_get_setup (connection)).data;
|
||||
if(!first_screen)
|
||||
{
|
||||
|
@ -73,8 +73,8 @@ SOURCES += \
|
||||
unix:!macx {
|
||||
HEADERS += linux/FloatingWidgetTitleBar.h
|
||||
SOURCES += linux/FloatingWidgetTitleBar.cpp
|
||||
QT += x11extras
|
||||
LIBS += -lxcb
|
||||
QT += gui-private
|
||||
}
|
||||
|
||||
isEmpty(PREFIX){
|
||||
|
Loading…
Reference in New Issue
Block a user