コード例 #1
0
ファイル: main.cpp プロジェクト: kendling/orbital
int main(int argc, char **argv)
{
    Helper helper;

    helper.display = wl_display_connect(nullptr);

    helper.registry = wl_display_get_registry(helper.display);
    static const wl_registry_listener registryListener = {
        wrapInterface(&Helper::global),
        wrapInterface(&Helper::globalRemove)
    };
    wl_registry_add_listener(helper.registry, &registryListener, &helper);

    wl_display_roundtrip(helper.display);
    if (!helper.helper) {
        qWarning("No orbital_authorizer_helper interface.");
        exit(1);
    }

    int ret = 0;
    while (ret != -1)
        ret = wl_display_dispatch(helper.display);

    return 0;
}
コード例 #2
0
ファイル: gammacontrol.cpp プロジェクト: giucam/orbital
void GammaControlManager::bind(wl_client *client, uint32_t version, uint32_t id)
{
    static const struct gamma_control_manager_interface implementation = {
        wrapInterface(destroy),
        wrapInterface(getGammaControl)
    };

    wl_resource *resource = wl_resource_create(client, &gamma_control_manager_interface, version, id);
    wl_resource_set_implementation(resource, &implementation, this, nullptr);
}
コード例 #3
0
ファイル: screenshooter.cpp プロジェクト: giucam/orbital
void Screenshooter::bind(wl_client *client, uint32_t version, uint32_t id)
{
    wl_resource *resource = wl_resource_create(client, &orbital_screenshooter_interface, version, id);

    static const struct orbital_screenshooter_interface implementation = {
        wrapInterface(shoot),
        wrapInterface(shootSurface),
    };

    wl_resource_set_implementation(resource, &implementation, this, nullptr);
}
コード例 #4
0
ファイル: screenshooter.cpp プロジェクト: giucam/orbital
 SurfaceScreenshot(Compositor *c, wl_resource *res)
     : m_compositor(c)
     , m_resource(res)
     , m_surface(nullptr)
 {
     static const struct orbital_surface_screenshot_interface implementation = {
         wrapInterface(shoot),
     };
     wl_resource_set_implementation(m_resource, &implementation, this, nullptr);
 }
コード例 #5
0
ファイル: main.cpp プロジェクト: kendling/orbital
    void global(wl_registry *registry, uint32_t id, const char *interface, uint32_t version)
    {
#define registry_bind(type, v) static_cast<type *>(wl_registry_bind(registry, id, &type ## _interface, qMin(version, v)))
        if (strcmp(interface, "orbital_authorizer_helper") == 0) {
            helper = registry_bind(orbital_authorizer_helper, 1u);
            static const orbital_authorizer_helper_listener listener = {
                wrapInterface(&Helper::authorizationRequested)
            };
            orbital_authorizer_helper_add_listener(helper, &listener, this);
        }
    }
コード例 #6
0
ファイル: Interface.c プロジェクト: KedneckInc/libusb4java
jobjectArray wrapInterfaces(JNIEnv *env, int count,
    const struct libusb_interface *interfaces)
{
    jobjectArray array = (jobjectArray) (*env)->NewObjectArray(env,
        count, (*env)->FindClass(env, CLASS_PATH("Interface")),
        NULL);
    for (int i = 0; i < count; i++)
        (*env)->SetObjectArrayElement(env, array, i,
            wrapInterface(env, &interfaces[i]));

    return array;
}
コード例 #7
0
void DesktopShellSettings::bind(wl_client *client, uint32_t version, uint32_t id)
{
    wl_resource *resource = wl_resource_create(client, &orbital_settings_interface, version, id);

// FIXME
//     // We trust only client we started ourself
//     pid_t pid;
//     wl_client_get_credentials(client, &pid, nullptr, nullptr);
//     if (pid != getpid()) {
//         wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "permission to bind orbital_settings denied");
//         wl_resource_destroy(resource);
//         return;
//     }

    static const struct orbital_settings_interface implementation = {
        wrapInterface(destroy),
        wrapInterface(setKeymap),
    };

    wl_resource_set_implementation(resource, &implementation, this, nullptr);
}
コード例 #8
0
ファイル: clipboard.cpp プロジェクト: giucam/orbital
void ClipboardManager::bind(wl_client *client, uint32_t version, uint32_t id)
{
    static const struct orbital_clipboard_manager_interface implementation = {
        wrapInterface(destroy)
    };

    wl_resource *resource = wl_resource_create(client, &orbital_clipboard_manager_interface, version, id);
    wl_resource_set_implementation(resource, &implementation, this, [](wl_resource *r) {
        auto *_this = static_cast<ClipboardManager *>(wl_resource_get_user_data(r));
        auto it = std::find(_this->m_resources.begin(), _this->m_resources.end(), r);
        if (it != _this->m_resources.end()) {
            _this->m_resources.erase(it);
        }
    });
    m_resources.push_back(resource);
}
コード例 #9
0
    return true;
}

void CompositorSettings::stringOption(nuclear_settings *settings, const char *path, const char *name)
{
    m_options.insert(QString(path) + "." + name, Option(Option::Type::String));
}

void CompositorSettings::intOption(nuclear_settings *settings, const char *path, const char *name)
{
    m_options.insert(QString(path) + "." + name, Option(Option::Type::Int));
}

void CompositorSettings::bindingOption(nuclear_settings *settings, const char *path, const char *name, int types)
{
    m_options.insert(QString(path) + "." + name, Option(Option::Type::Binding, types));
}

const nuclear_settings_listener CompositorSettings::s_listener = {
    wrapInterface(&CompositorSettings::stringOption),
    wrapInterface(&CompositorSettings::intOption),
    wrapInterface(&CompositorSettings::bindingOption)
};

CompositorSettings::Option::Option(Type t, int b)
                          : type(t)
                          , bindingType(b)
                          , used(false)
{
}
コード例 #10
0
ファイル: window.cpp プロジェクト: ortogonal/orbital
}

void Window::handleState(desktop_shell_window *window, int32_t state)
{
    m_state = wlState2State(state);
    emit stateChanged();
}

void Window::handleRemoved(desktop_shell_window *window)
{
    emit destroyed(this);
    deleteLater();
}

const desktop_shell_window_listener Window::m_window_listener = {
    wrapInterface(&Window::handleTitle),
    wrapInterface(&Window::handleIcon),
    wrapInterface(&Window::handleState),
    wrapInterface(&Window::handleRemoved)
};

Window::Window(desktop_shell_window *window, pid_t pid, QObject *p)
      : QObject(p)
      , m_window(window)
      , m_pid(pid)
      , m_state(Window::Inactive)
{
    desktop_shell_window_add_listener(window, &m_window_listener, this);
}

Window::~Window()
コード例 #11
0
ファイル: panel.cpp プロジェクト: giucam/orbital
    desktop_shell_panel_destroy(m_panel);
}

void Panel::move()
{
    desktop_shell_panel_move(m_panel);
}

void Panel::setLocation(Element::Location loc)
{
    if (loc == m_element->location()) {
        return;
    }

    m_element->setLocation(loc);
    setWidth(m_element->width());
    setHeight(m_element->height());
    Client::client()->setInputRegion(this, m_element->inputRegion());
    desktop_shell_panel_set_position(m_panel, (uint32_t)loc);
}

void Panel::locationChanged(desktop_shell_panel *panel, uint32_t loc)
{
    setLocation((Element::Location)loc);
}

const desktop_shell_panel_listener Panel::s_listener = {
    wrapInterface(&Panel::locationChanged)
};

コード例 #12
0
ファイル: grab.cpp プロジェクト: ortogonal/orbital
{
    desktop_shell_grab_end(m_grab);
}

void Grab::handleEnded(desktop_shell_grab *grab)
{
    emit ended();
}

void Grab::handleFocus(desktop_shell_grab *grab, wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
{
    emit focus(surface, wl_fixed_to_int(x), wl_fixed_to_int(y));
}

void Grab::handleMotion(desktop_shell_grab *grab, uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
    emit motion(time, wl_fixed_to_int(x), wl_fixed_to_int(y));
}

void Grab::handleButton(desktop_shell_grab *grab, uint32_t time , uint32_t btn, uint32_t state)
{
    emit button(time, btn, state);
}

const struct desktop_shell_grab_listener Grab::s_desktop_shell_grab_listener = {
    wrapInterface(&Grab::handleEnded),
    wrapInterface(&Grab::handleFocus),
    wrapInterface(&Grab::handleMotion),
    wrapInterface(&Grab::handleButton)
};
コード例 #13
0
ファイル: wlshell.cpp プロジェクト: qwertynb/orbital
namespace Orbital {

WlShell::WlShell(Shell *shell, Compositor *c)
       : Interface(shell)
       , Global(c, &wl_shell_interface, 1)
       , m_shell(shell)
{
//     weston_seat *seat;
//     wl_list_for_each(seat, &Shell::compositor()->seat_list, link) {
//         ShellSeat *shseat = ShellSeat::shellSeat(seat);
//         shseat->pointerFocusSignal.connect(this, &WlShell::pointerFocus);
//     }
}

void WlShell::bind(wl_client *client, uint32_t version, uint32_t id)
{
    wl_resource *resource = wl_resource_create(client, &wl_shell_interface, version, id);
    if (resource)
        wl_resource_set_implementation(resource, &shell_implementation, this, nullptr);
}

ShellSurface *WlShell::getShellSurface(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface_resource)
{
    weston_surface *surface = static_cast<weston_surface *>(wl_resource_get_user_data(surface_resource));

    if (surface->configure) {
        wl_resource_post_error(surface_resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "The surface has a role already");
        return nullptr;
    }

    ShellSurface *shsurf = m_shell->createShellSurface(surface);
    WlShellSurface *wlss = new WlShellSurface(this, shsurf, client, id);
    shsurf->addInterface(wlss);

//     wlss->responsivenessChangedSignal.connect(this, &WlShell::surfaceResponsiveness);
//
    return shsurf;
}
//
// void WlShell::pointerFocus(ShellSeat *, weston_pointer *pointer)
// {
//     weston_view *view = pointer->focus;
//
//     if (!view)
//         return;
//
//     ShellSurface *shsurf = Shell::getShellSurface(view->surface);
//     if (!shsurf)
//         return;
//
//     WlShellSurface *wlss = shsurf->findInterface<WlShellSurface>();
//     if (!wlss) {
//         return;
//     }
//
//     if (!wlss->isResponsive()) {
//         surfaceResponsivenessChangedSignal(shsurf, false);
//     } else {
//         uint32_t serial = wl_display_next_serial(Shell::compositor()->wl_display);
//         wlss->ping(serial);
//     }
// }
//
// void WlShell::surfaceResponsiveness(WlShellSurface *wlsurf)
// {
//     ShellSurface *shsurf = wlsurf->shsurf();
//     surfaceResponsivenessChangedSignal(shsurf, wlsurf->isResponsive());
// }
//
// const weston_shell_client WlShell::shell_client = {
//     WlShell::sendConfigure
// };
//
const struct wl_shell_interface WlShell::shell_implementation = {
    wrapInterface(&WlShell::getShellSurface)
};

}
コード例 #14
0
ファイル: xdgsurface.cpp プロジェクト: amon-ra/nuclear
    shsurf()->setMaximized(output);
}

void XdgSurface::unsetMaximized(wl_client *client, wl_resource *resource)
{
    shsurf()->unsetMaximized();
}

void XdgSurface::setMinimized(wl_client *client, wl_resource *resource)
{
    shsurf()->setMinimized(true);
}

const struct xdg_surface_interface XdgSurface::s_implementation = {
    wrapInterface(&XdgSurface::destroy),
    wrapInterface(&XdgSurface::setTransientFor),
    wrapInterface(&XdgSurface::setTitle),
    wrapInterface(&XdgSurface::setAppId),
    wrapInterface(&XdgSurface::pong),
    wrapInterface(&XdgSurface::move),
    wrapInterface(&XdgSurface::resize),
    wrapInterface(&XdgSurface::setOutput),
    wrapInterface(&XdgSurface::setFullscreen),
    wrapInterface(&XdgSurface::unsetFullscreen),
    wrapInterface(&XdgSurface::setMaximized),
    wrapInterface(&XdgSurface::unsetMaximized),
    wrapInterface(&XdgSurface::setMinimized)
};