Skip to content

Commit c62f043

Browse files
Fix for 2091 (#2290)
1 parent 3860fd4 commit c62f043

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

panel/backends/wayland/wlroots/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (NOT DEFINED PLUGIN_DIR)
1717
set (PLUGIN_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROGRAM})
1818
endif (NOT DEFINED PLUGIN_DIR)
1919

20-
set(QTX_LIBRARIES Qt6::Gui Qt6::GuiPrivate)
20+
set(QTX_LIBRARIES Qt6::Gui Qt6::GuiPrivate Qt6::WaylandClient Qt6::WaylandClientPrivate)
2121

2222
set(
2323
SRC
@@ -28,7 +28,7 @@ set(
2828
add_library(${NAME} MODULE ${SRC}) # build dynamically loadable modules
2929
install(TARGETS ${NAME} DESTINATION ${PLUGIN_DIR}/${BACKEND}) # install the *.so file
3030

31-
target_link_libraries(${NAME} ${QTX_LIBRARIES} Qt6::Concurrent Qt6::WaylandClient Qt6Xdg)
31+
target_link_libraries(${NAME} ${QTX_LIBRARIES} Qt6::Concurrent Qt6Xdg)
3232

3333
qt6_generate_wayland_protocol_client_sources(${NAME} FILES
3434
${CMAKE_CURRENT_SOURCE_DIR}/wlr-foreign-toplevel-management-unstable-v1.xml

panel/backends/wayland/wlroots/lxqtwmbackend_wlr.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <QScreen>
77
#include <algorithm>
88

9+
#include <private/qwaylandscreen_p.h>
10+
911
// Function to erase a window from the vector
1012
void eraseWindow(std::vector<WId>& windows, WId tgt) {
1113
// Use std::vector::iterator to find the window
@@ -270,10 +272,19 @@ void LXQtTaskbarWlrootsBackend::moveApplicationToPrevNextMonitor(WId, bool, bool
270272
{
271273
}
272274

273-
bool LXQtTaskbarWlrootsBackend::isWindowOnScreen(QScreen *, WId) const
275+
bool LXQtTaskbarWlrootsBackend::isWindowOnScreen(QScreen *screen, WId windowId) const
274276
{
275-
// TODO: Manage based on output-enter/output-leave
276-
return true;
277+
LXQtTaskbarWlrootsWindow *window = getWindow(windowId);
278+
if(window)
279+
{
280+
QtWaylandClient::QWaylandScreen *waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen*>(screen->handle());
281+
if (waylandScreen) {
282+
wl_output *output = waylandScreen->output();
283+
return window->windowState.outputs.contains( output );
284+
}
285+
}
286+
287+
return false;
277288
}
278289

279290
bool LXQtTaskbarWlrootsBackend::setDesktopLayout(Qt::Orientation, int, int, bool) {
@@ -449,6 +460,7 @@ void LXQtTaskbarWlrootsBackend::addToWindows(WId winId)
449460
connect(window, &LXQtTaskbarWlrootsWindow::fullscreenChanged, this, &LXQtTaskbarWlrootsBackend::onStateChanged);
450461
connect(window, &LXQtTaskbarWlrootsWindow::maximizedChanged, this, &LXQtTaskbarWlrootsBackend::onStateChanged);
451462
connect(window, &LXQtTaskbarWlrootsWindow::minimizedChanged, this, &LXQtTaskbarWlrootsBackend::onStateChanged);
463+
connect(window, &LXQtTaskbarWlrootsWindow::outputsChanged, this, &LXQtTaskbarWlrootsBackend::onOutputsChanged);
452464

453465
emit windowAdded( winId );
454466
emit windowPropertyChanged(winId, int(LXQtTaskBarWindowProperty::WindowClass));
@@ -615,6 +627,12 @@ void LXQtTaskbarWlrootsBackend::onStateChanged()
615627
emit windowPropertyChanged(window->getWindowId(), int(LXQtTaskBarWindowProperty::State));
616628
}
617629

630+
void LXQtTaskbarWlrootsBackend::onOutputsChanged()
631+
{
632+
if (auto window = qobject_cast<LXQtTaskbarWlrootsWindow *>(QObject::sender()))
633+
emit windowPropertyChanged(window->getWindowId(), int(LXQtTaskBarWindowProperty::Workspace));
634+
}
635+
618636
bool LXQtTaskbarWlrootsBackend::acceptWindow(WId window) const
619637
{
620638
if(transients.contains(window))

panel/backends/wayland/wlroots/lxqtwmbackend_wlr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ private slots:
8181
void onTitleChanged();
8282
void onAppIdChanged();
8383
void onStateChanged();
84+
void onOutputsChanged();
8485

8586
private:
8687
void addToWindows(WId winId);

0 commit comments

Comments
 (0)