Skip to content

Commit 7ae9a24

Browse files
committed
fix: xwindow stack error
1 parent d25fa01 commit 7ae9a24

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

examples/tinywl/helper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,10 @@ void Helper::setActivatedSurface(SurfaceWrapper *newActivateSurface)
643643

644644
if (newActivateSurface) {
645645
newActivateSurface->stackToLast();
646+
if (newActivateSurface->type() == SurfaceWrapper::Type::XWayland) {
647+
auto xwaylandSurface = qobject_cast<WXWaylandSurface *>(newActivateSurface->shellSurface());
648+
xwaylandSurface->restack(nullptr, WXWaylandSurface::XCB_STACK_MODE_ABOVE);
649+
}
646650
}
647651

648652
if (m_activatedSurface)

src/server/protocols/wxwaylandsurface.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,12 @@ void WXWaylandSurface::close()
565565

566566
void WXWaylandSurface::restack(WXWaylandSurface *sibling, StackMode mode)
567567
{
568-
handle()->restack(*sibling->handle(), static_cast<xcb_stack_mode_t>(mode));
568+
if (sibling) {
569+
handle()->restack(*sibling->handle(), static_cast<xcb_stack_mode_t>(mode));
570+
return;
571+
}
572+
573+
handle()->restack(nullptr, static_cast<xcb_stack_mode_t>(mode));
569574
}
570575

571576
WAYLIB_SERVER_END_NAMESPACE

0 commit comments

Comments
 (0)