Skip to content

Commit e378149

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

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

examples/tinywl/surfacewrapper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ void SurfaceWrapper::setParent(QQuickItem *item)
154154
void SurfaceWrapper::setActivate(bool activate)
155155
{
156156
m_shellSurface->setActivate(activate);
157+
if (type() == SurfaceWrapper::Type::XWayland) {
158+
auto xwaylandSurface = qobject_cast<WXWaylandSurface *>(m_shellSurface);
159+
if (activate)
160+
xwaylandSurface->restack(nullptr, WXWaylandSurface::XCB_STACK_MODE_ABOVE);
161+
162+
return;
163+
}
164+
157165
auto parent = parentSurface();
158166
while (parent) {
159167
parent->setActivate(activate);

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)