当前位置: 首页>>代码示例>>Java>>正文


Java Pointer类代码示例

本文整理汇总了Java中org.freedesktop.jaccall.Pointer的典型用法代码示例。如果您正苦于以下问题:Java Pointer类的具体用法?Java Pointer怎么用?Java Pointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Pointer类属于org.freedesktop.jaccall包,在下文中一共展示了Pointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCredentials

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
/**
 * Return Unix credentials for the client
 * <p/>
 * This function returns the process ID, the user ID and the group ID
 * for the given client.  The credentials come from getsockopt() with
 * SO_PEERCRED, on the client socket fd.
 * <p/>
 * Be aware that for clients that a compositor forks and execs and
 * then connects using socketpair(), this function will return the
 * credentials for the compositor.  The credentials for the socketpair
 * are set at creation time in the compositor.
 */
public ClientCredentials getCredentials() {
    final Pointer<Integer> pid = nref(0);
    final Pointer<Integer> uid = nref(0);
    final Pointer<Integer> gid = nref(0);

    WaylandServerCore.INSTANCE()
                     .wl_client_get_credentials(this.pointer,
                                                pid.address,
                                                uid.address,
                                                gid.address);

    return new ClientCredentials(pid.get(),
                                 uid.get(),
                                 gid.get());
}
 
开发者ID:udevbe,项目名称:wayland-java-bindings,代码行数:28,代码来源:Client.java

示例2: Global

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
protected Global(final Display display,
                 final Class<R> resourceClass,
                 final int version) {
    if (version <= 0) {
        throw new IllegalArgumentException("Version must be bigger than 0");
    }

    this.jObjectPointer = Pointer.from(this);

    this.pointer = WaylandServerCore.INSTANCE()
                                    .wl_global_create(display.pointer,
                                                      InterfaceMeta.get(resourceClass)
                                                                   .getNative().address,
                                                      version,
                                                      this.jObjectPointer.address,
                                                      FUNC_T_POINTER.address);
    ObjectCache.store(this.pointer,
                      this);
}
 
开发者ID:udevbe,项目名称:wayland-java-bindings,代码行数:20,代码来源:Global.java

示例3: Resource

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
protected Resource(final Client client,
                   final int version,
                   final int id,
                   final I implementation) {
    this.implementation = implementation;
    final long resourcePointer = WaylandServerCore.INSTANCE()
                                                  .wl_resource_create(client.pointer,
                                                                      InterfaceMeta.get(getClass())
                                                                                   .getNative().address,
                                                                      version,
                                                                      id);
    this.pointer = resourcePointer;
    ObjectCache.store(this.pointer,
                      this);

    this.jObjectPointer = Pointer.from(this);

    WaylandServerCore.INSTANCE()
                     .wl_resource_set_dispatcher(resourcePointer,
                                                 Dispatcher.INSTANCE.address,
                                                 this.jObjectPointer.address,
                                                 0L,
                                                 RESOURCE_DESTROY_FUNC.address);
}
 
开发者ID:udevbe,项目名称:wayland-java-bindings,代码行数:25,代码来源:Resource.java

示例4: Proxy

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
/**
 * @param pointer
 * @param implementation The listener to be added to proxy
 * @param version
 */
protected Proxy(final Long pointer,
                final I implementation,
                final int version) {
    this.pointer = pointer;
    this.implementation = implementation;
    this.version = version;
    ObjectCache.store(this.pointer,
                      this);
    this.jObjectPointer = Pointer.from(this);

    //Special casing implementation. For some proxies the underlying native library provides its own implementation.
    //We pass in a null implementation in those cases. (Eg Display proxy).
    if (implementation != null) {
        WaylandClientCore.INSTANCE()
                         .wl_proxy_add_dispatcher(this.pointer,
                                                  Dispatcher.INSTANCE.address,
                                                  jObjectPointer.address,
                                                  0L);
    }
}
 
开发者ID:udevbe,项目名称:wayland-java-bindings,代码行数:26,代码来源:Proxy.java

示例5: createTmpFileNative

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
private static int createTmpFileNative() {
    final String template = "/wayland-jfx-shm-XXXXXX";
    final String path     = System.getenv("XDG_RUNTIME_DIR");
    if (path == null) {
        throw new IllegalStateException("Cannot create temporary file: XDG_RUNTIME_DIR not set");
    }

    final Pointer<String> name = Pointer.nref(path + template);
    final int             fd   = Libc.mkstemp(name.address);

    final int F_GETFD = 1;
    int flags = Libc.fcntl(fd,
                           F_GETFD,
                           0);
    if (-1 == flags) {
        Libc.close(fd);
        throw new RuntimeException("error");
    }

    final int FD_CLOEXEC = 1;
    flags |= FD_CLOEXEC;
    final int F_SETFD = 2;
    final int ret = Libc.fcntl(fd,
                               F_SETFD,
                               flags);
    if (-1 == ret) {
        Libc.close(fd);
        throw new RuntimeException("error");
    }

    return fd;
}
 
开发者ID:udevbe,项目名称:wayland-javafx,代码行数:33,代码来源:WaylandShmBuffer.java

示例6: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<UnsignedLongLongFunc> nref(@Nonnull final UnsignedLongLongFunc function) {
    if (function instanceof PointerUnsignedLongLongFunc) {
        return (PointerUnsignedLongLongFunc) function;
    }
    return new UnsignedLongLongFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerUnsignedLongLongFunc.java

示例7: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<UnionFunc> nref(@Nonnull final UnionFunc function) {
    if (function instanceof PointerUnionFunc) {
        return (PointerUnionFunc) function;
    }
    return new UnionFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerUnionFunc.java

示例8: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<CharFunc> nref(@Nonnull final CharFunc function) {
    if (function instanceof PointerCharFunc) {
        return (PointerCharFunc) function;
    }
    return new CharFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerCharFunc.java

示例9: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<UnsignedCharFunc> nref(@Nonnull final UnsignedCharFunc function) {
    if (function instanceof PointerUnsignedCharFunc) {
        return (PointerUnsignedCharFunc) function;
    }
    return new UnsignedCharFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerUnsignedCharFunc.java

示例10: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<UnsignedIntFunc> nref(@Nonnull final UnsignedIntFunc function) {
    if (function instanceof PointerUnsignedIntFunc) {
        return (PointerUnsignedIntFunc) function;
    }
    return new UnsignedIntFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerUnsignedIntFunc.java

示例11: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<ReadGlobalVarFunc> nref(@Nonnull ReadGlobalVarFunc func) {
    if (func instanceof PointerReadGlobalVarFunc) {
        return (PointerReadGlobalVarFunc) func;
    }

    return new ReadGlobalVarFunc_Jaccall_J(func);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:9,代码来源:PointerReadGlobalVarFunc.java

示例12: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<WriteGlobalVarFunc> nref(@Nonnull final WriteGlobalVarFunc func) {
    if (func instanceof PointerWriteGlobalVarFunc) {
        return (PointerWriteGlobalVarFunc) func;
    }

    return new WriteGlobalVarFunc_Jaccall_J(func);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:9,代码来源:PointerWriteGlobalVarFunc.java

示例13: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<StructFunc2> nref(@Nonnull final StructFunc2 function) {
    if (function instanceof PointerStructFunc2) {
        return (PointerStructFunc2) function;
    }
    return new StructFunc2_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerStructFunc2.java

示例14: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<StructFunc> nref(@Nonnull final StructFunc function) {
    if (function instanceof PointerStructFunc) {
        return (PointerStructFunc) function;
    }
    return new StructFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerStructFunc.java

示例15: nref

import org.freedesktop.jaccall.Pointer; //导入依赖的package包/类
@Nonnull
public static Pointer<IntFunc> nref(@Nonnull final IntFunc function) {
    if (function instanceof PointerIntFunc) {
        return (PointerIntFunc) function;
    }
    return new IntFunc_Jaccall_J(function);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:8,代码来源:PointerIntFunc.java


注:本文中的org.freedesktop.jaccall.Pointer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。