Skip to content

Commit

Permalink
fix: can not click popup menu
Browse files Browse the repository at this point in the history
also remove useless code in popup
sync: vioken/waylib#265
  • Loading branch information
wineee authored and zccrs committed Jan 16, 2024
1 parent 649f617 commit eba72f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
7 changes: 1 addition & 6 deletions src/treeland/quick/qml/StackWorkspace.qml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Item {
}
padding: 0
background: null
closePolicy: Popup.CloseOnPressOutside
closePolicy: Popup.NoAutoClose

XdgSurface {
id: popupSurfaceItem
Expand All @@ -237,11 +237,6 @@ Item {
}
}
}

onClosed: {
if (waylandSurface)
waylandSurface.surface.unmap()
}
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/treeland/quick/qml/TiledWorkspace.qml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Item {
}
padding: 0
background: null
closePolicy: Popup.CloseOnPressOutside
closePolicy: Popup.NoAutoClose

XdgSurface {
id: popupSurfaceItem
Expand All @@ -200,11 +200,6 @@ Item {
}
}
}

onClosed: {
if (waylandSurface)
waylandSurface.surface.unmap()
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/treeland/quick/utils/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <WServer>
#include <WOutput>
#include <WSurfaceItem>
#include <wxdgsurface.h>

#include <qwbackend.h>
#include <qwdisplay.h>
Expand Down Expand Up @@ -383,10 +384,16 @@ bool Helper::afterHandleEvent(WSeat *seat, WSurface *watched, QObject *surfaceIt

if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::TouchBegin) {
// surfaceItem is qml type: XdgSurfaceItem or LayerSurfaceItem
auto toplevelSurface = qvariant_cast<WToplevelSurface*>(surfaceItem->property("surface"));
auto *toplevelSurface = qvariant_cast<WToplevelSurface*>(surfaceItem->property("surface"));
if (!toplevelSurface)
return false;
Q_ASSERT(toplevelSurface->surface() == watched);
if (auto *xdgSurface = qvariant_cast<WXdgSurface*>(surfaceItem->property("surface"))) {
// TODO(waylib): popupSurface should not inherit WToplevelSurface
if (xdgSurface->isPopup()) {
return false;
}
}
setActivateSurface(toplevelSurface);
}

Expand Down

0 comments on commit eba72f7

Please sign in to comment.