Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Window Manager interaction (Qt 6 version) #2029

Closed
wants to merge 69 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
5dc5d82
CMake: FindXCB components are upper case
gfgit Feb 11, 2024
07f702a
CMake: update dependencies for Qt6
gfgit Feb 8, 2024
b4fe335
CMake: link to dbusmenu-lxqt instead of dbusmenu-qt6
gfgit Feb 22, 2024
96a6dc6
Replace qAsConst() with std::as_const
gfgit Feb 9, 2024
bfcf78a
Replace QPair with std::pair
gfgit Feb 9, 2024
61893fb
Replace QLatin1Literal with QLatin1String
gfgit Feb 9, 2024
fb5c5c8
QEvent: port pos() to position() and globalPos() to globalPosition()
gfgit Feb 9, 2024
d1c1ce8
Fix QWidget::enterEvent(QEnterEvent*) signature
gfgit Feb 9, 2024
190280c
QLayou::setContentsMargin() instead of setMargin()
gfgit Feb 9, 2024
b8b33c6
QuickLaunchButton: fix ambiguous list initializer
gfgit Feb 9, 2024
79c4a48
Port QRegExp with QRegularExpression TODO
gfgit Feb 9, 2024
cb2d7cb
QLocale territory() instead of country()
gfgit Feb 9, 2024
a955bb6
Qt6 always enables High-DPI Pixmaps
gfgit Feb 9, 2024
e37056f
PanelPluginsModel: Q_DECLARE_OPAQUE_POINTER()
gfgit Feb 9, 2024
b838c60
Use QColor::fromString()
gfgit Feb 9, 2024
0600444
FIXME: LXQtTaskButton deprecated constructor
gfgit Feb 9, 2024
741d2d7
Disable ColorPicker on Wayland
gfgit Feb 9, 2024
a0b3ce3
Fix KX11Extras, KWindowSystem includes
gfgit Feb 9, 2024
cbad679
Port QX11Info to QX11Application
gfgit Feb 9, 2024
1ef5229
LXQtTaskButton: port to KX11Extras
gfgit Feb 11, 2024
606a223
LXQtTaskButton: port away from QDesktopWidget
gfgit Feb 11, 2024
27c93d8
QString::arg(...) use mult-arg version
gfgit Feb 11, 2024
61a051d
LXQtCpuLoad: do not include <QtCore> directly
gfgit Feb 11, 2024
70d580c
Configuration: fix call to temporary object
gfgit Feb 11, 2024
d0dcf66
QEyesConfigDialog: avoid allocating temporary container
gfgit Feb 11, 2024
1f7a0fa
QEyesImageWidget: unneeded QString allocation
gfgit Feb 11, 2024
96b98e0
LXQtQuickLaunch: fix QSet warning and better readability
gfgit Feb 11, 2024
7d06f23
Port LXQtTrayPlugin to Qt6 TODO
gfgit Feb 11, 2024
e094680
LXQtTaskBar: fix include recursion
gfgit Feb 11, 2024
2328de7
Port LXQtKbIndicatorPlugin to Qt6
gfgit Feb 11, 2024
b682f1e
Replace QScopedPointer with std::unique_ptr
gfgit Feb 28, 2024
4343a79
Replace QVector with QList
gfgit Feb 28, 2024
633b8a1
SNIProxy: use QBitmap::fromImage TODO
gfgit Feb 11, 2024
f0835c4
README: update mentioned dependencies
gfgit Feb 28, 2024
4bdb243
TaskBar: forward declare
gfgit Jan 28, 2024
1d5f0f8
TaskBar: new ILXQtTaskbarAbstractBackend
gfgit Jan 27, 2024
3f913a2
ILXQtTaskbarAbstractBackend: add supportsAction() method
gfgit Jan 28, 2024
cd1f762
TaskBar: add X11 backend
gfgit Jan 27, 2024
740639e
TaskBar: new LXQtTaskBarProxyModel
gfgit Jan 27, 2024
47bba93
TaskBar: use backend in LXQtTaskBar
gfgit Jan 27, 2024
43761a9
TaskBar: initial use of backend in LXQtTaskButton
gfgit Feb 3, 2024
8dbc2e5
TaskBar: use backend for urgency hint
gfgit Feb 3, 2024
1ac62fb
TaskBar: use backend to set window layer
gfgit Feb 3, 2024
2411395
TaskBar: use backend to close and raise window
gfgit Feb 3, 2024
6b3b0dd
TaskBar: use backend to roll up (shade) windows
gfgit Feb 3, 2024
5462b2f
TaskBar: use backend to minimize window
gfgit Feb 3, 2024
e7c5a98
TaskBar: use backend to de-maximize window
gfgit Feb 3, 2024
8297648
TaskBar: use backend to get window state
gfgit Feb 3, 2024
8434907
TaskBar: use backend to set window state
gfgit Feb 3, 2024
05bb41b
TaskBar: port workspace usage to backend
gfgit Jan 28, 2024
161bf92
TaskBar: remove X11 specific includes in lxqttaskbutton.cpp
gfgit Feb 3, 2024
504e461
TaskBar: remove X11 code from LXQtTaskBar and LXQtTaskGroup
gfgit Jan 28, 2024
f0630c8
TaskBar: LXQtTaskButton remove X11 specific code
gfgit Jan 28, 2024
60f2b57
TaskBar: set context menu parent
gfgit Feb 17, 2024
1bd36e0
LXQtPanel: rework calculatePopupWindowPos()
gfgit Feb 17, 2024
068aa55
LXQtPanel: avoid QCursor::pos() usage
gfgit Feb 18, 2024
6928050
ILXQtTaskbarAbstractBackend: new Geometry window property
gfgit Feb 19, 2024
988dc73
Move ILXQtTaskbarAbstractBackend to panel directory
gfgit Feb 17, 2024
b87fe2d
ILXQtTaskbarAbstractBackend: new isAreaOverlapped() method
gfgit Feb 19, 2024
cc3fbe3
LXQtPanel: use less KX11Extras and more ILXQtTaskbarAbstractBackend
gfgit Feb 19, 2024
4b7cfd5
ILXQtTaskbarAbstractBackend: add dummy implementation
gfgit Feb 22, 2024
7730f59
LXQtMainMenu: indent header include
gfgit Feb 28, 2024
974e481
SNIProxy: use Qt Private headers to get Xcb timestamp
gfgit Feb 26, 2024
d9b58f3
ILXQtTaskbarAbstractBackend: new showDesktop() function
gfgit Feb 22, 2024
a3e93e2
ShowDesktop: use ILXQtTaskbarAbstractBackend
gfgit Feb 22, 2024
56aed45
DesktopSwitch: port to ILXQtTaskbarAbstractBackend
gfgit Feb 23, 2024
f0b0d1b
LXQtTaskbarConfiguration: port to ILXQtTaskBarAbstractBackend
gfgit Feb 23, 2024
c1b21d6
DesktopSwitchConfiguration: port to ILXQtTaskBarAbstractBackend TODO
gfgit Feb 23, 2024
ad3ee82
TaskBar: consider initial windows
gfgit Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(REQUIRED_QT_VERSION "5.15.0")
set(KF5_MINIMUM_VERSION "5.101.0")
set(LXQT_GLOBALKEYS_MINIMUM_VERSION "1.4.0")
set(LXQT_MINIMUM_VERSION "1.4.0")

find_package(Qt5DBus ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5LinguistTools ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Xml ${REQUIRED_QT_VERSION} REQUIRED)
find_package(KF5WindowSystem ${KF5_MINIMUM_VERSION} REQUIRED)
set(REQUIRED_QT_VERSION "6.6.0")
set(KF6_MINIMUM_VERSION "6.0.0")
set(LXQT_GLOBALKEYS_MINIMUM_VERSION "2.0.0")
set(LXQT_MINIMUM_VERSION "2.0.0")

find_package(Qt6DBus ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt6LinguistTools ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt6Widgets ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt6Xml ${REQUIRED_QT_VERSION} REQUIRED)
find_package(KF6WindowSystem ${KF6_MINIMUM_VERSION} REQUIRED)
find_package(lxqt ${LXQT_MINIMUM_VERSION} REQUIRED)
find_package(lxqt-globalkeys-ui ${LXQT_GLOBALKEYS_MINIMUM_VERSION} REQUIRED)
find_package(lxqt-menu-data ${LXQT_MINIMUM_VERSION} REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ As indicated by the name, a volume control. Technically Alsa, OSS and PulseAudio

### Compiling source code

The runtime dependencies are libxcomposite, libdbusmenu-qt5, KGuiAddons, KWindowSystem, Solid, menu-cache, [lxqt-menu-data](https://github.com/lxqt/lxqt-menu-data), [liblxqt](https://github.com/lxqt/liblxqt) and [lxqt-globalkeys](https://github.com/lxqt/lxqt-globalkeys).
The runtime dependencies are libxcomposite, libdbusmenu-lxqt, KGuiAddons, KWindowSystem, Solid, menu-cache, [lxqt-menu-data](https://github.com/lxqt/lxqt-menu-data), [liblxqt](https://github.com/lxqt/liblxqt) and [lxqt-globalkeys](https://github.com/lxqt/lxqt-globalkeys).
Several plugins or features thereof are optional and need additional runtime dependencies. Namely these are (plugin / feature in parenthesis) Alsa library (Alsa support in plugin-volume), PulseAudio client library (PulseAudio support in plugin-volume), lm-sensors (plugin-sensors), libstatgrab (plugin-cpuload, plugin-networkmonitor), [libsysstat](https://github.com/lxqt/libsysstat) (plugin-sysstat). All of them are enabled by default and have to be disabled by CMake variables as required, see below.
In addition CMake and [lxqt-build-tools](https://github.com/lxqt/lxqt-build-tools) are mandatory build dependencies. Git is optionally needed to pull latest VCS checkouts.

Expand Down
8 changes: 4 additions & 4 deletions cmake/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ MACRO (BUILD_LXQT_PLUGIN NAME)
set (PLUGIN_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROGRAM})
endif (NOT DEFINED PLUGIN_DIR)

set(QTX_LIBRARIES Qt5::Widgets)
set(QTX_LIBRARIES Qt6::Widgets)
if(QT_USE_QTXML)
set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt5::Xml)
set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt6::Xml)
endif()
if(QT_USE_QTDBUS)
set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt5::DBus)
set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt6::DBus)
endif()

list(FIND STATIC_PLUGINS ${NAME} IS_STATIC)
Expand All @@ -52,7 +52,7 @@ MACRO (BUILD_LXQT_PLUGIN NAME)
else() # static
add_library(${NAME} STATIC ${SRC}) # build statically linked lib
endif()
target_link_libraries(${NAME} ${QTX_LIBRARIES} lxqt ${LIBRARIES} KF5::WindowSystem)
target_link_libraries(${NAME} ${QTX_LIBRARIES} lxqt ${LIBRARIES} KF6::WindowSystem)

install(FILES ${CONFIG_FILES} DESTINATION ${PLUGIN_SHARE_DIR})
install(FILES ${DESKTOP_FILES} DESTINATION ${PROG_SHARE_DIR})
Expand Down
21 changes: 19 additions & 2 deletions panel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
set(PROJECT lxqt-panel)

# TODO
add_subdirectory(backends)

set(PRIV_HEADERS
panelpluginsmodel.h
windownotifier.h
Expand All @@ -18,6 +21,12 @@ set(PRIV_HEADERS
config/configstyling.h
config/configpluginswidget.h
config/addplugindialog.h

backends/ilxqttaskbarabstractbackend.h
backends/lxqttaskbartypes.h

backends/lxqttaskbardummybackend.h
backends/xcb/lxqttaskbarbackend_x11.h
)

# using LXQt namespace in the public headers.
Expand All @@ -26,6 +35,9 @@ set(PUB_HEADERS
pluginsettings.h
ilxqtpanelplugin.h
ilxqtpanel.h

backends/ilxqttaskbarabstractbackend.h
backends/lxqttaskbartypes.h
)

set(SOURCES
Expand All @@ -45,6 +57,11 @@ set(SOURCES
config/configstyling.cpp
config/configpluginswidget.cpp
config/addplugindialog.cpp

backends/ilxqttaskbarabstractbackend.cpp

backends/lxqttaskbardummybackend.cpp
backends/xcb/lxqttaskbarbackend_x11.cpp
)

set(UI
Expand Down Expand Up @@ -74,7 +91,7 @@ endif ()

project(${PROJECT})

set(QTX_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::DBus)
set(QTX_LIBRARIES Qt6::Widgets Qt6::Xml Qt6::DBus)

# Translations
lxqt_translate_ts(QM_FILES SOURCES
Expand Down Expand Up @@ -102,7 +119,7 @@ add_executable(${PROJECT}
target_link_libraries(${PROJECT}
${LIBRARIES}
${QTX_LIBRARIES}
KF5::WindowSystem
KF6::WindowSystem
${STATIC_PLUGINS}
)

Expand Down
1 change: 1 addition & 0 deletions panel/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(xcb)
25 changes: 25 additions & 0 deletions panel/backends/ilxqttaskbarabstractbackend.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "../panel/backends/ilxqttaskbarabstractbackend.h"


ILXQtTaskbarAbstractBackend::ILXQtTaskbarAbstractBackend(QObject *parent)
: QObject(parent)
{

}

void ILXQtTaskbarAbstractBackend::moveApplicationToPrevNextDesktop(WId windowId, bool next)
{
int count = getWorkspacesCount();
if (count <= 1)
return;

int targetWorkspace = getWindowWorkspace(windowId) + (next ? 1 : -1);

// Wrap around
if (targetWorkspace > count)
targetWorkspace = 1; //Ids are 1-based
else if (targetWorkspace < 1)
targetWorkspace = count;

setWindowOnWorkspace(windowId, targetWorkspace);
}
97 changes: 97 additions & 0 deletions panel/backends/ilxqttaskbarabstractbackend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#ifndef ILXQTTASKBARABSTRACTBACKEND_H
#define ILXQTTASKBARABSTRACTBACKEND_H

#include <QObject>

#include "lxqttaskbartypes.h"

class QIcon;
class QScreen;

class ILXQtTaskbarAbstractBackend : public QObject
{
Q_OBJECT

public:
explicit ILXQtTaskbarAbstractBackend(QObject *parent = nullptr);

// Backend
virtual bool supportsAction(WId windowId, LXQtTaskBarBackendAction action) const = 0;

// Windows
virtual bool reloadWindows() = 0;

virtual QVector<WId> getCurrentWindows() const = 0;

virtual QString getWindowTitle(WId windowId) const = 0;

virtual bool applicationDemandsAttention(WId windowId) const = 0;

virtual QIcon getApplicationIcon(WId windowId, int fallbackDevicePixels) const = 0;

virtual QString getWindowClass(WId windowId) const = 0;

virtual LXQtTaskBarWindowLayer getWindowLayer(WId windowId) const = 0;
virtual bool setWindowLayer(WId windowId, LXQtTaskBarWindowLayer layer) = 0;

virtual LXQtTaskBarWindowState getWindowState(WId windowId) const = 0;
virtual bool setWindowState(WId windowId, LXQtTaskBarWindowState state, bool set = true) = 0;

virtual bool isWindowActive(WId windowId) const = 0;
virtual bool raiseWindow(WId windowId, bool onCurrentWorkSpace) = 0;

virtual bool closeWindow(WId windowId) = 0;

virtual WId getActiveWindow() const = 0;

// Workspaces
// NOTE: indexes are 1-based, 0 means "Show on All desktops"
virtual int getWorkspacesCount() const = 0;
virtual QString getWorkspaceName(int idx) const = 0;

virtual int getCurrentWorkspace() const = 0;
virtual bool setCurrentWorkspace(int idx) = 0;

virtual int getWindowWorkspace(WId windowId) const = 0;
virtual bool setWindowOnWorkspace(WId windowId, int idx) = 0;

virtual void moveApplicationToPrevNextDesktop(WId windowId, bool next); // Default implementation
virtual void moveApplicationToPrevNextMonitor(WId windowId, bool next, bool raiseOnCurrentDesktop) = 0;

virtual bool isWindowOnScreen(QScreen *screen, WId windowId) const = 0;

// X11 Specific
virtual void moveApplication(WId windowId) = 0;
virtual void resizeApplication(WId windowId) = 0;

virtual void refreshIconGeometry(WId windowId, const QRect &geom) = 0;

// Panel internal
virtual bool isAreaOverlapped(const QRect& area) const = 0;

// Show Destop TODO: split in multiple interfeces, this is becoming big
// NOTE: KWindowSystem already has these functions
// However on Wayland they are only compatible with KWin
// because internally it uses org_kde_plasma_window_management protocol
// We make this virtual so it can be implemented also for other compositors
virtual bool isShowingDesktop() const = 0;
virtual bool showDesktop(bool value) = 0;

signals:
void reloaded();

// Windows
void windowAdded(WId windowId);
void windowRemoved(WId windowId);
void windowPropertyChanged(WId windowId, int prop);

// Workspaces
void workspacesCountChanged();
void workspaceNameChanged(int idx);
void currentWorkspaceChanged(int idx);

// TODO: needed?
void activeWindowChanged(WId windowId);
};

#endif // ILXQTTASKBARABSTRACTBACKEND_H
Loading
Loading