예제 #1
0
파일: chromakey.c 프로젝트: Airtau/genivi
static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
{
    WLContextStruct* p_wlCtx = (WLContextStruct*)data;
    int ans_strcmp = 0;

    do
    {
        ans_strcmp = strcmp(interface, "wl_compositor");
        if (0 == ans_strcmp)
        {
            p_wlCtx->wlCompositor = (struct wl_compositor*)wl_registry_bind(registry, name, &wl_compositor_interface, 1);
            break;
        }

        ans_strcmp = strcmp(interface, "wl_shm");
        if (0 == ans_strcmp)
        {
            p_wlCtx->wlShm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
            wl_shm_add_listener(p_wlCtx->wlShm, &shm_listenter, p_wlCtx);
            break;
        }

        ans_strcmp = strcmp(interface, "serverinfo");
        if (0 == ans_strcmp)
        {
            p_wlCtx->wlExtServerinfo = (struct serverinfo*)wl_registry_bind(registry, name, &serverinfo_interface, 1);
            serverinfo_add_listener(p_wlCtx->wlExtServerinfo, &serverinfo_listener_list, data);
            serverinfo_get_connection_id(p_wlCtx->wlExtServerinfo);
        }
    } while(0);
}
예제 #2
0
void
WLContext::RegistryHandleGlobal(void* data,
                                struct wl_registry* registry,
                                uint32_t name,
                                const char* interface,
                                uint32_t version)
{
    WL_UNUSED(version);

    WLContext* surface = static_cast<WLContext*>(data);
    assert(surface);

    do {
        if (!strcmp(interface, "wl_compositor")){
            surface->SetWLCompositor(
                (wl_compositor*)wl_registry_bind(registry,
                                                name,
                                                &wl_compositor_interface,
                                                1));
            break;
        }

        if (!strcmp(interface, "serverinfo")){
            struct serverinfo* wlServerInfo = (struct serverinfo*)wl_registry_bind(
                registry, name, &serverinfo_interface, 1);
            serverinfo_add_listener(wlServerInfo, &serverInfoListenerList, data);
            serverinfo_get_connection_id(wlServerInfo);
            surface->SetWLServerInfo(wlServerInfo);
            break;
        }

        if (!strcmp(interface, "wl_seat")){
            struct WLContext::seat_data *seat_data = (struct WLContext::seat_data *)calloc(1, sizeof *seat_data);
            seat_data->ctx = surface;
            seat_data->wlSeat = (wl_seat*)wl_registry_bind(
                                 registry, name, &wl_seat_interface, 1);
            wl_seat_add_listener(seat_data->wlSeat, &seatListener,
                                 (void *)seat_data);
        }
    } while (0);
}