void QWaylandShellSurface::updateTransientParent(QWindow *parent)
{
    QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
    if (!parent_wayland_window || !parent_wayland_window->shellSurface())
        return;

    // set_transient expects a position relative to the parent
    QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
    QWindow *parentWin = m_window->window()->transientParent();
    transientPos -= parentWin->geometry().topLeft();
    if (parent_wayland_window->decoration()) {
        transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
        transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
    }

    uint32_t flags = 0;
    Qt::WindowFlags wf = m_window->window()->flags();
    if (wf.testFlag(Qt::ToolTip)
            || wf.testFlag(Qt::WindowTransparentForInput))
        flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;

    set_transient(parent_wayland_window->wl_surface(),
                  transientPos.x(),
                  transientPos.y(),
                  flags);
}
Beispiel #2
0
s8 wl_shell_surface_req(struct client *c,s32 shell_surface_slot,struct msg *m)
{
  s8 r;
  switch(m->req_op){
  case WL_SHELL_SURFACE_PONG:
    r=pong(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_MOVE:
    r=move(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_RESIZE:
    r=resize(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_SET_TOP_LEVEL:
    LOG_WIRE("client(%d):shell_surface::set_top_level shell_surface_id=%u\n",
                                                               c->so,m->req[0]);
    r=shell_surface_set_top_level(c,shell_surface_slot);
    break;
  case WL_SHELL_SURFACE_SET_TRANSIENT:
    r=set_transient(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_SET_FULLSCREEN:
    r=set_fullscreen(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_SET_POPUP:
    r=set_popup(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_SET_MAXIMISED:
    r=set_maximised(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_SET_TITLE:
    r=set_title(c,shell_surface_slot,m);
    break;
  case WL_SHELL_SURFACE_SET_CLASS:
    r=set_class(c,shell_surface_slot,m);
    break;
  default:
    PERR("client(%d):fatal:shell surface unknown opcode %u\n",c->so,m->req_op);
    r=LWL_ERR;
  };
  return r;
}