|
6 | 6 | #include <QScreen>
|
7 | 7 | #include <algorithm>
|
8 | 8 |
|
| 9 | +#include <private/qwaylandscreen_p.h> |
| 10 | + |
9 | 11 | // Function to erase a window from the vector
|
10 | 12 | void eraseWindow(std::vector<WId>& windows, WId tgt) {
|
11 | 13 | // Use std::vector::iterator to find the window
|
@@ -270,10 +272,19 @@ void LXQtTaskbarWlrootsBackend::moveApplicationToPrevNextMonitor(WId, bool, bool
|
270 | 272 | {
|
271 | 273 | }
|
272 | 274 |
|
273 |
| -bool LXQtTaskbarWlrootsBackend::isWindowOnScreen(QScreen *, WId) const |
| 275 | +bool LXQtTaskbarWlrootsBackend::isWindowOnScreen(QScreen *screen, WId windowId) const |
274 | 276 | {
|
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; |
277 | 288 | }
|
278 | 289 |
|
279 | 290 | bool LXQtTaskbarWlrootsBackend::setDesktopLayout(Qt::Orientation, int, int, bool) {
|
@@ -449,6 +460,7 @@ void LXQtTaskbarWlrootsBackend::addToWindows(WId winId)
|
449 | 460 | connect(window, &LXQtTaskbarWlrootsWindow::fullscreenChanged, this, &LXQtTaskbarWlrootsBackend::onStateChanged);
|
450 | 461 | connect(window, &LXQtTaskbarWlrootsWindow::maximizedChanged, this, &LXQtTaskbarWlrootsBackend::onStateChanged);
|
451 | 462 | connect(window, &LXQtTaskbarWlrootsWindow::minimizedChanged, this, &LXQtTaskbarWlrootsBackend::onStateChanged);
|
| 463 | + connect(window, &LXQtTaskbarWlrootsWindow::outputsChanged, this, &LXQtTaskbarWlrootsBackend::onOutputsChanged); |
452 | 464 |
|
453 | 465 | emit windowAdded( winId );
|
454 | 466 | emit windowPropertyChanged(winId, int(LXQtTaskBarWindowProperty::WindowClass));
|
@@ -615,6 +627,12 @@ void LXQtTaskbarWlrootsBackend::onStateChanged()
|
615 | 627 | emit windowPropertyChanged(window->getWindowId(), int(LXQtTaskBarWindowProperty::State));
|
616 | 628 | }
|
617 | 629 |
|
| 630 | +void LXQtTaskbarWlrootsBackend::onOutputsChanged() |
| 631 | +{ |
| 632 | + if (auto window = qobject_cast<LXQtTaskbarWlrootsWindow *>(QObject::sender())) |
| 633 | + emit windowPropertyChanged(window->getWindowId(), int(LXQtTaskBarWindowProperty::Workspace)); |
| 634 | +} |
| 635 | + |
618 | 636 | bool LXQtTaskbarWlrootsBackend::acceptWindow(WId window) const
|
619 | 637 | {
|
620 | 638 | if(transients.contains(window))
|
|
0 commit comments