// SPDX-FileCopyrightText: 2025 KylinSoft Co., Ltd.
//
// SPDX-License-Identifier: GPL-1.0-or-later

#pragma once

#include "ukuishell.h"

namespace QtWaylandClient
{

class QWaylandInputDevice;
class UkuiShellSurface;
class UkuiShellSurfaceV1;
class XdgDecorationManagerV1;
class XdgDialogV1;

class Popup : public QtWayland::xdg_popup
{
public:
    Popup(UkuiShellSurface *ukuiShellSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner);
    Popup(UkuiShellSurfaceV1 *ukuiShellSurfaceV1, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner);
    ~Popup() override;

    UkuiShellSurface *ukuiShellSurface();
    UkuiShellSurfaceV1 *ukuiShellSurfaceV1();

    void grab(QWaylandInputDevice *seat, uint serial);
    void xdg_popup_popup_done() override;

private:
    UkuiShellSurface *m_ukuiShellSurface = nullptr;
    UkuiShellSurface *m_parentUkuiShellSurface = nullptr;
    UkuiShellSurfaceV1 *m_ukuiShellSurfaceV1 = nullptr;
    UkuiShellSurfaceV1 *m_parentUkuiShellSurfaceV1 = nullptr;
    QWaylandWindow *m_parent = nullptr;
    bool m_grabbing = false;
};

} // namespace QtWaylandClient
