// Generated with hyprwayland-scanner 0.4.6. Made with vaxry's keyboard and ❤️.
// hyprland_input_capture_v1

/*
 This protocol's authors' copyright notice is:


    Copyright © 2025 Fl0w

    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

    3. Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
*/

#define private public
#define HYPRWAYLAND_SCANNER_NO_INTERFACES
#include "hyprland-input-capture-v1.hpp"
#undef private
#define F std::function

static const wl_interface* hyprlandInputCaptureV1_dummyTypes[] = { nullptr };

// Reference all other interfaces.
// The reason why this is in snake is to
// be able to cooperate with existing
// wayland_scanner interfaces (they are interop)
extern const wl_interface hyprland_input_capture_manager_v1_interface;
extern const wl_interface hyprland_input_capture_v1_interface;

static const void* _CCHyprlandInputCaptureManagerV1VTable[] = {
    nullptr,
};

wl_proxy* CCHyprlandInputCaptureManagerV1::sendCreateSession(const char* handle) {
    if (!pResource)
        return nullptr;

    auto proxy = wl_proxy_marshal_flags(pResource, 0, &hyprland_input_capture_v1_interface, wl_proxy_get_version(pResource), 0, nullptr, handle);

    return proxy;
}
static const wl_interface* _CHyprlandInputCaptureManagerV1CreateSessionTypes[] = {
    &hyprland_input_capture_v1_interface,
    nullptr,
};

static const wl_message _CHyprlandInputCaptureManagerV1Requests[] = {
    { .name = "create_session", .signature = "ns", .types = _CHyprlandInputCaptureManagerV1CreateSessionTypes + 0},
};

const wl_interface hyprland_input_capture_manager_v1_interface = {
    .name = "hyprland_input_capture_manager_v1", .version = 1,
    .method_count = 1, .methods = _CHyprlandInputCaptureManagerV1Requests,
    .event_count = 0, .events = nullptr,
};

CCHyprlandInputCaptureManagerV1::CCHyprlandInputCaptureManagerV1(wl_proxy* resource) : pResource(resource) {

    if (!pResource)
        return;

    wl_proxy_add_listener(pResource, (void (**)(void))&_CCHyprlandInputCaptureManagerV1VTable, this);
}

CCHyprlandInputCaptureManagerV1::~CCHyprlandInputCaptureManagerV1() {
    if (!destroyed)
        wl_proxy_destroy(pResource);
}

static void _CHyprlandInputCaptureV1EisFd(void* data, void* resource, int32_t fd) {
    const auto PO = (CCHyprlandInputCaptureV1*)data;
    if (PO && PO->requests.eisFd)
        PO->requests.eisFd(PO, fd);
}

static void _CHyprlandInputCaptureV1Disabled(void* data, void* resource) {
    const auto PO = (CCHyprlandInputCaptureV1*)data;
    if (PO && PO->requests.disabled)
        PO->requests.disabled(PO);
}

static void _CHyprlandInputCaptureV1Activated(void* data, void* resource, uint32_t activation_id, wl_fixed_t x, wl_fixed_t y, uint32_t barrier_id) {
    const auto PO = (CCHyprlandInputCaptureV1*)data;
    if (PO && PO->requests.activated)
        PO->requests.activated(PO, activation_id, x, y, barrier_id);
}

static void _CHyprlandInputCaptureV1Deactivated(void* data, void* resource, uint32_t activation_id) {
    const auto PO = (CCHyprlandInputCaptureV1*)data;
    if (PO && PO->requests.deactivated)
        PO->requests.deactivated(PO, activation_id);
}

static const void* _CCHyprlandInputCaptureV1VTable[] = {
    (void*)_CHyprlandInputCaptureV1EisFd,
    (void*)_CHyprlandInputCaptureV1Disabled,
    (void*)_CHyprlandInputCaptureV1Activated,
    (void*)_CHyprlandInputCaptureV1Deactivated,
};

void CCHyprlandInputCaptureV1::sendClearBarriers() {
    if (!pResource)
        return;

    auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0);
    proxy;
}

void CCHyprlandInputCaptureV1::sendAddBarrier(uint32_t zone_set, uint32_t id, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) {
    if (!pResource)
        return;

    auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, zone_set, id, x1, y1, x2, y2);
    proxy;
}

void CCHyprlandInputCaptureV1::sendEnable() {
    if (!pResource)
        return;

    auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0);
    proxy;
}

void CCHyprlandInputCaptureV1::sendDisable() {
    if (!pResource)
        return;

    auto proxy = wl_proxy_marshal_flags(pResource, 3, nullptr, wl_proxy_get_version(pResource), 0);
    proxy;
}

void CCHyprlandInputCaptureV1::sendRelease(uint32_t activation_id, wl_fixed_t x, wl_fixed_t y) {
    if (!pResource)
        return;

    auto proxy = wl_proxy_marshal_flags(pResource, 4, nullptr, wl_proxy_get_version(pResource), 0, activation_id, x, y);
    proxy;
}
static const wl_interface* _CHyprlandInputCaptureV1AddBarrierTypes[] = {
    nullptr,
    nullptr,
    nullptr,
    nullptr,
    nullptr,
    nullptr,
};
static const wl_interface* _CHyprlandInputCaptureV1ReleaseTypes[] = {
    nullptr,
    nullptr,
    nullptr,
};
static const wl_interface* _CHyprlandInputCaptureV1EisFdTypes[] = {
    nullptr,
};
static const wl_interface* _CHyprlandInputCaptureV1ActivatedTypes[] = {
    nullptr,
    nullptr,
    nullptr,
    nullptr,
};
static const wl_interface* _CHyprlandInputCaptureV1DeactivatedTypes[] = {
    nullptr,
};

static const wl_message _CHyprlandInputCaptureV1Requests[] = {
    { .name = "clear_barriers", .signature = "", .types = hyprlandInputCaptureV1_dummyTypes + 0},
    { .name = "add_barrier", .signature = "uuuuuu", .types = _CHyprlandInputCaptureV1AddBarrierTypes + 0},
    { .name = "enable", .signature = "", .types = hyprlandInputCaptureV1_dummyTypes + 0},
    { .name = "disable", .signature = "", .types = hyprlandInputCaptureV1_dummyTypes + 0},
    { .name = "release", .signature = "uff", .types = _CHyprlandInputCaptureV1ReleaseTypes + 0},
};

static const wl_message _CHyprlandInputCaptureV1Events[] = {
    { .name = "eis_fd", .signature = "h", .types = _CHyprlandInputCaptureV1EisFdTypes + 0},
    { .name = "disabled", .signature = "", .types = hyprlandInputCaptureV1_dummyTypes + 0},
    { .name = "activated", .signature = "uffu", .types = _CHyprlandInputCaptureV1ActivatedTypes + 0},
    { .name = "deactivated", .signature = "u", .types = _CHyprlandInputCaptureV1DeactivatedTypes + 0},
};

const wl_interface hyprland_input_capture_v1_interface = {
    .name = "hyprland_input_capture_v1", .version = 1,
    .method_count = 5, .methods = _CHyprlandInputCaptureV1Requests,
    .event_count = 4, .events = _CHyprlandInputCaptureV1Events,
};

CCHyprlandInputCaptureV1::CCHyprlandInputCaptureV1(wl_proxy* resource) : pResource(resource) {

    if (!pResource)
        return;

    wl_proxy_add_listener(pResource, (void (**)(void))&_CCHyprlandInputCaptureV1VTable, this);
}

CCHyprlandInputCaptureV1::~CCHyprlandInputCaptureV1() {
    if (!destroyed)
        wl_proxy_destroy(pResource);
}

void CCHyprlandInputCaptureV1::setEisFd(F<void(CCHyprlandInputCaptureV1*, int32_t)> &&handler) {
    requests.eisFd = std::move(handler);
}

void CCHyprlandInputCaptureV1::setDisabled(F<void(CCHyprlandInputCaptureV1*)> &&handler) {
    requests.disabled = std::move(handler);
}

void CCHyprlandInputCaptureV1::setActivated(F<void(CCHyprlandInputCaptureV1*, uint32_t, wl_fixed_t, wl_fixed_t, uint32_t)> &&handler) {
    requests.activated = std::move(handler);
}

void CCHyprlandInputCaptureV1::setDeactivated(F<void(CCHyprlandInputCaptureV1*, uint32_t)> &&handler) {
    requests.deactivated = std::move(handler);
}

#undef F
