您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wl_compositor_create_surface函数代码示例

51自学网 2021-06-03 10:00:15
  C++
这篇教程C++ wl_compositor_create_surface函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wl_compositor_create_surface函数的典型用法代码示例。如果您正苦于以下问题:C++ wl_compositor_create_surface函数的具体用法?C++ wl_compositor_create_surface怎么用?C++ wl_compositor_create_surface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了wl_compositor_create_surface函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: malloc

struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height, bool shell_surface) {	struct window *window = malloc(sizeof(struct window));	memset(window, 0, sizeof(struct window));	window->width = width;	window->height = height;	window->registry = registry;	window->surface = wl_compositor_create_surface(registry->compositor);	if (shell_surface) {		window->shell_surface = wl_shell_get_shell_surface(registry->shell, window->surface);		wl_shell_surface_add_listener(window->shell_surface, &surface_listener, window);		wl_shell_surface_set_toplevel(window->shell_surface);	}	if (registry->pointer) {		wl_pointer_add_listener(registry->pointer, &pointer_listener, window);	}	window->cursor.cursor_theme = wl_cursor_theme_load("default", 32, registry->shm); // TODO: let you customize this	window->cursor.cursor = wl_cursor_theme_get_cursor(window->cursor.cursor_theme, "left_ptr");	window->cursor.surface = wl_compositor_create_surface(registry->compositor);	struct wl_cursor_image *image = window->cursor.cursor->images[0];	struct wl_buffer *cursor_buf = wl_cursor_image_get_buffer(image);	wl_surface_attach(window->cursor.surface, cursor_buf, 0, 0);	wl_surface_damage(window->cursor.surface, 0, 0, image->width, image->height);	wl_surface_commit(window->cursor.surface);	return window;}
开发者ID:hooplaaa,项目名称:sway,代码行数:29,


示例2: clutter_backend_wayland_load_cursor

static voidclutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland){  struct wl_cursor *cursor;  backend_wayland->cursor_theme =    wl_cursor_theme_load (NULL, /* default */                          32,                          backend_wayland->wayland_shm);  cursor = wl_cursor_theme_get_cursor (backend_wayland->cursor_theme,                                       "left_ptr");  backend_wayland->cursor_buffer =    wl_cursor_image_get_buffer (cursor->images[0]);  if (backend_wayland->cursor_buffer)    {      backend_wayland->cursor_x = cursor->images[0]->hotspot_x;      backend_wayland->cursor_y = cursor->images[0]->hotspot_y;    }  backend_wayland->cursor_surface =    wl_compositor_create_surface (backend_wayland->wayland_compositor);}
开发者ID:mattdangerw,项目名称:clutter,代码行数:25,


示例3: wl_compositor_create_surface

void WaylandWindow::init(){//     mClient = WaylandClient::getInstance();//     mSurface = AndroidRuntime::getWaylandClient()->surface();//wl_compositor_create_surface(mClient->getCompositor());    mSurface = wl_compositor_create_surface(WaylandClient::getInstance().getCompositor());//     mShellSurface = AndroidRuntime::getWaylandClient()->shellSurface();// wl_shell_get_shell_surface(mClient->getShell(), mSurface);    mShellSurface = wl_shell_get_shell_surface(WaylandClient::getInstance().getShell(), mSurface);    if (mShellSurface) {        wl_shell_surface_add_listener(mShellSurface, &mShellSurfaceListener, this);        wl_shell_surface_set_toplevel(mShellSurface);    } else {       ALOGW("wl_shell_get_shell_surface FAILED /n");       return;    }    wl_surface_set_user_data(mSurface, this);    wl_shell_surface_set_title(mShellSurface, "android");    wl_surface_commit(mSurface);    mNative = wl_egl_window_create(mSurface, mWidth, mHeight);    if (mNative == NULL) {        ALOGW("wl_egl_window_create FAILED /n");        return;    } else {        ALOGW("wl_egl_window_create succeded, resulting in %p /n", mNative);    }}
开发者ID:CSRedRat,项目名称:shashlik,代码行数:27,


示例4: main

int main(int argc, char **argv){    get_server_references();    surface = wl_compositor_create_surface(compositor);    if (surface == NULL) {        fprintf(stderr, "Can't create surface/n");        exit(1);    } else {        fprintf(stderr, "Created surface/n");    }    shell_surface = wl_shell_get_shell_surface(shell, surface);    wl_shell_surface_set_toplevel(shell_surface);//    create_opaque_region();    init_egl();    create_window();    init_gl();    while (1) {        draw();        if (eglSwapBuffers(egl_display, egl_surface)) {            fprintf(stderr, "Swapped buffers/n");       } else {        fprintf(stderr, "Swapped buffers failed/n");    }    }    wl_display_disconnect(display);    printf("disconnected from display/n");    exit(0);}
开发者ID:techhhuang,项目名称:bookmark,代码行数:35,


示例5: create_surface

    void create_surface(struct display *display)    {      EGLBoolean ret;      display->surface = wl_compositor_create_surface(display->compositor);      display->shell_surface = wl_shell_get_shell_surface(display->shell,                     display->surface);      wl_shell_surface_add_listener(display->shell_surface,                  &shell_surface_listener, display);      display->native = wl_egl_window_create(display->surface, 1, 1);      display->egl_surface =        eglCreateWindowSurface((EGLDisplay) display->egl.dpy, display->egl.conf, (EGLNativeWindowType) display->native, NULL);      wl_shell_surface_set_title(display->shell_surface, "projection");      ret = eglMakeCurrent(display->egl.dpy, display->egl_surface,               display->egl_surface, display->egl.ctx);      assert(ret == EGL_TRUE);      struct wl_callback *callback;      display->configured = 0;      wl_shell_surface_set_fullscreen(display->shell_surface,        WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL);      callback = wl_display_sync(display->display);      wl_callback_add_listener(callback, &configure_callback_listener, display);    }
开发者ID:projectionist,项目名称:snow,代码行数:32,


示例6: gtk_widget_get_window

bool WaylandEGLContext::attach (GtkWidget *widget){    GdkWindow *window = gtk_widget_get_window (widget);    if (!GDK_IS_WAYLAND_WINDOW (window))        return false;    gdk_window = window;    gdk_window_get_geometry (gdk_window, &x, &y, &width, &height);    display  = gdk_wayland_display_get_wl_display (gdk_window_get_display (gdk_window));    parent   = gdk_wayland_window_get_wl_surface (gdk_window);    registry = wl_display_get_registry (display);    wl_registry_add_listener (registry, &wl_registry_listener, this);    wl_display_roundtrip (display);    if (!compositor || !subcompositor)        return false;    child = wl_compositor_create_surface (compositor);    region = wl_compositor_create_region (compositor);    subsurface = wl_subcompositor_get_subsurface (subcompositor, child, parent);    wl_surface_set_input_region (child, region);    wl_subsurface_set_desync (subsurface);    wl_subsurface_set_position (subsurface, x, y);    return true;}
开发者ID:ehmry,项目名称:snes9x,代码行数:30,


示例7: printf

bool cWaylandInterface::Initialize(void *config){	if (!GLWin.wl_display) {		printf("Error: couldn't open wayland display/n");		return false;	}	GLWin.pointer.wl_pointer = nullptr;	GLWin.keyboard.wl_keyboard = nullptr;	GLWin.keyboard.xkb.context = xkb_context_new((xkb_context_flags) 0);	if (GLWin.keyboard.xkb.context == nullptr) {		fprintf(stderr, "Failed to create XKB context/n");		return nullptr;	}	GLWin.wl_registry = wl_display_get_registry(GLWin.wl_display);	wl_registry_add_listener(GLWin.wl_registry,				 &registry_listener, nullptr);	while (!GLWin.wl_compositor)		wl_display_dispatch(GLWin.wl_display);	GLWin.wl_cursor_surface =		wl_compositor_create_surface(GLWin.wl_compositor);	return true;}
开发者ID:Chiri23,项目名称:dolphin,代码行数:28,


示例8: createSurface

static GLFWbool createSurface(_GLFWwindow* window,                              const _GLFWwndconfig* wndconfig){    window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);    if (!window->wl.surface)        return GLFW_FALSE;    wl_surface_set_user_data(window->wl.surface, window);    window->wl.native = wl_egl_window_create(window->wl.surface,                                             wndconfig->width,                                             wndconfig->height);    if (!window->wl.native)        return GLFW_FALSE;    window->wl.shell_surface = wl_shell_get_shell_surface(_glfw.wl.shell,                                                          window->wl.surface);    if (!window->wl.shell_surface)        return GLFW_FALSE;    wl_shell_surface_add_listener(window->wl.shell_surface,                                  &shellSurfaceListener,                                  window);    window->wl.width = wndconfig->width;    window->wl.height = wndconfig->height;    return GLFW_TRUE;}
开发者ID:jku,项目名称:glfw,代码行数:29,


示例9: wlDisplay

TestBase::TestBase(): wlDisplay(NULL), wlRegistry(NULL){    wlDisplay = wl_display_connect(NULL);    if (!wlDisplay)    {        throw std::runtime_error("could not connect to wayland display");    }    wlRegistry = wl_display_get_registry(wlDisplay);    static const struct wl_registry_listener registry_listener = {        registry_listener_callback,        NULL    };    wl_registry_add_listener(wlRegistry, &registry_listener, &wlCompositor);    if (wl_display_roundtrip(wlDisplay) == -1 || wl_display_roundtrip(wlDisplay) == -1)    {        throw std::runtime_error("wl_display error");    }    wlSurfaces.reserve(10);    for (int i = 0; i < wlSurfaces.capacity(); ++i)    {        wlSurfaces.push_back(wl_compositor_create_surface(wlCompositor));    }}
开发者ID:ntanibata,项目名称:wayland-ivi-extension,代码行数:29,


示例10: wlf_CreateDesktopWindow

wlfWindow* wlf_CreateDesktopWindow(wlfContext* wlfc, char* name, int width, int height, BOOL decorations){	wlfWindow* window;	window = (wlfWindow*) calloc(1, sizeof(wlfWindow));	if (window)	{		window->width = width;		window->height = height;		window->fullscreen = FALSE;		window->buffers[0].busy = FALSE;		window->buffers[1].busy = FALSE;		window->callback = NULL;		window->display = wlfc->display;		window->surface = wl_compositor_create_surface(window->display->compositor);		window->shell_surface = wl_shell_get_shell_surface(window->display->shell, window->surface);		wl_shell_surface_add_listener(window->shell_surface, &wl_shell_surface_listener, window);		wl_shell_surface_set_toplevel(window->shell_surface);		wlf_ResizeDesktopWindow(wlfc, window, width, height);		wl_surface_damage(window->surface, 0, 0, window->width, window->height);	}	wlf_SetWindowText(wlfc, window, name);	return window;}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:30,


示例11: create_window

static struct window *create_window(struct display *display, int width, int height){	struct window *window;		window = malloc(sizeof *window);	window->buffer = create_shm_buffer(display,					   width, height,					   WL_SHM_FORMAT_XRGB8888,					   &window->shm_data);	if (!window->buffer) {		free(window);		return NULL;	}	window->callback = NULL;	window->display = display;	window->width = width;	window->height = height;	window->surface = wl_compositor_create_surface(display->compositor);	window->shell_surface = wl_shell_get_shell_surface(display->shell,							   window->surface);	if (window->shell_surface)		wl_shell_surface_add_listener(window->shell_surface,					      &shell_surface_listener, window);	wl_shell_surface_set_toplevel(window->shell_surface);	return window;}
开发者ID:Blei,项目名称:weston,代码行数:33,


示例12: create_surface

static gbooleancreate_surface (GstGLWindowWaylandEGL * window_egl){  window_egl->window.surface =      wl_compositor_create_surface (window_egl->display.compositor);  window_egl->window.shell_surface =      wl_shell_get_shell_surface (window_egl->display.shell,      window_egl->window.surface);  wl_shell_surface_add_listener (window_egl->window.shell_surface,      &shell_surface_listener, window_egl);  if (window_egl->window.window_width <= 0)    window_egl->window.window_width = 320;  if (window_egl->window.window_height <= 0)    window_egl->window.window_height = 240;  window_egl->window.native =      wl_egl_window_create (window_egl->window.surface,      window_egl->window.window_width, window_egl->window.window_height);  wl_shell_surface_set_title (window_egl->window.shell_surface,      "OpenGL Renderer");  wl_shell_surface_set_toplevel (window_egl->window.shell_surface);  return TRUE;}
开发者ID:ego5710,项目名称:gst-plugins-bad,代码行数:28,


示例13: createWLContext

static int createWLContext(){    t_ilm_bool result = ILM_TRUE;    g_wlContextStruct.wlDisplay = wl_display_connect(NULL);    if (NULL == g_wlContextStruct.wlDisplay)    {        printf("Error: wl_display_connect() failed./n");    }    g_wlContextStruct.wlRegistry = wl_display_get_registry(g_wlContextStruct.wlDisplay);    wl_registry_add_listener(g_wlContextStruct.wlRegistry, &registry_listener, &g_wlContextStruct);    wl_display_dispatch(g_wlContextStruct.wlDisplay);    wl_display_roundtrip(g_wlContextStruct.wlDisplay);    g_wlContextStruct.wlSurface = wl_compositor_create_surface(g_wlContextStruct.wlCompositor);    if (NULL == g_wlContextStruct.wlSurface)    {        printf("Error: wl_compositor_create_surface failed./n");        destroyWLContext();    }    createShmBuffer();    return result;}
开发者ID:Airtau,项目名称:genivi,代码行数:26,


示例14: create_surface

static voidcreate_surface(struct window *window){	struct display *display = window->display;	EGLBoolean ret;		window->surface = wl_compositor_create_surface(display->compositor);	window->shell_surface = wl_shell_get_shell_surface(display->shell,							   window->surface);	wl_shell_surface_add_listener(window->shell_surface,				      &shell_surface_listener, window);	window->native =		wl_egl_window_create(window->surface,				     window->window_size.width,				     window->window_size.height);	window->egl_surface =		eglCreateWindowSurface(display->egl.dpy,				       display->egl.conf,				       window->native, NULL);	wl_shell_surface_set_title(window->shell_surface, "simple-egl");	ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface,			     window->egl_surface, window->display->egl.ctx);	assert(ret == EGL_TRUE);	toggle_fullscreen(window, window->fullscreen);}
开发者ID:anarsoul,项目名称:weston,代码行数:30,


示例15: wl_compositor_create_surface

std::unique_ptr<WaylandSurface> PlatformDisplayWayland::createSurface(const IntSize& size){    struct wl_surface* wlSurface = wl_compositor_create_surface(m_compositor);    // We keep the minimum size at 1x1px since Mesa returns null values in wl_egl_window_create() for zero width or height.    EGLNativeWindowType nativeWindow = wl_egl_window_create(wlSurface, std::max(1, size.width()), std::max(1, size.height()));    return std::make_unique<WaylandSurface>(wlSurface, nativeWindow);}
开发者ID:robvogelaar,项目名称:WebKitForWayland,代码行数:7,


示例16: wl_compositor_create_surface

void WaylandCore::createWindow( int width, int height, const char* title ){  if( mDisplay == NULL || mCompositor == NULL ) {    return;  }  mWidth = width;  mHeight = height;  static wl_shell_surface_listener shell_surf_listeners = {    shell_surface_handler_ping,    shell_surface_handler_configure,    shell_surface_handler_popup_done,  };  wl_surface* surface = wl_compositor_create_surface( mCompositor );  wl_shell_surface* shell_surface = wl_shell_get_shell_surface( mShell, surface );  wl_shell_surface_set_toplevel( shell_surface );  wl_shell_surface_set_title( shell_surface, title );  wl_shell_surface_add_listener( shell_surface, &shell_surf_listeners, this );  mShellSurface = shell_surface;  mSurface.surface = surface;    mEglWindow = wl_egl_window_create( surface, mWidth, mHeight );  mSurface.eglSurface = eglCreateWindowSurface( mEglDisplay, mEglConfig, mEglWindow, NULL );    if( !eglMakeCurrent( mEglDisplay, mSurface.eglSurface, mSurface.eglSurface, mEglContext ) ) {    fprintf( stderr, "MakeCurrent failed./n" );  }}
开发者ID:techlabxe,项目名称:SimpleWindowWayland,代码行数:31,


示例17: window_create

struct window *window_create(struct display *display, const char *title,	      int32_t width, int32_t height){	struct window *window;	window = malloc(sizeof *window);	if (window == NULL)		return NULL;	memset(window, 0, sizeof *window);	window->display = display;	window->title = strdup(title);	window->surface = wl_compositor_create_surface(display->compositor);	window->allocation.x = 0;	window->allocation.y = 0;	window->allocation.width = width;	window->allocation.height = height;	window->saved_allocation = window->allocation;	window->margin = 16;	window->decoration = 1;	if (display->drm)		window->buffer_type = WINDOW_BUFFER_TYPE_DRM;	else		window->buffer_type = WINDOW_BUFFER_TYPE_SHM;	wl_surface_set_user_data(window->surface, window);	wl_list_insert(display->window_list.prev, &window->link);	return window;}
开发者ID:CLowcay,项目名称:wayland-terminal,代码行数:32,


示例18: create_window

static struct window *create_window(struct display *display, int width, int height){	struct window *window;	window = calloc(1, sizeof *window);	if (!window)		return NULL;	window->callback = NULL;	window->display = display;	window->width = width;	window->height = height;	window->surface = wl_compositor_create_surface(display->compositor);	window->shell_surface = wl_shell_get_shell_surface(display->shell,							   window->surface);	if (window->shell_surface)		wl_shell_surface_add_listener(window->shell_surface,					      &shell_surface_listener, window);	wl_shell_surface_set_title(window->shell_surface, "simple-shm");	wl_shell_surface_set_toplevel(window->shell_surface);	return window;}
开发者ID:whot,项目名称:weston,代码行数:27,


示例19: hello_set_cursor_from_pool

void hello_set_cursor_from_pool(struct wl_shm_pool *pool,    unsigned width, unsigned height,    int32_t hot_spot_x, int32_t hot_spot_y){    struct pointer_data *data;    data = malloc(sizeof(struct pointer_data));    if (data == NULL)        goto error;    data->hot_spot_x = hot_spot_x;    data->hot_spot_y = hot_spot_y;    data->surface = wl_compositor_create_surface(compositor);    if (data->surface == NULL)        goto cleanup_alloc;    data->buffer = hello_create_buffer(pool, width, height);    if (data->buffer == NULL)        goto cleanup_surface;    wl_pointer_set_user_data(pointer, data);    return;cleanup_surface:    wl_surface_destroy(data->surface);cleanup_alloc:    free(data);error:    perror("Unable to allocate cursor");}
开发者ID:fooishbar,项目名称:hello_wayland,代码行数:34,


示例20: create_window

static voidcreate_window (GstWaylandSink * sink, struct display *display, int width,    int height){  struct window *window;  if (sink->window)    return;  g_mutex_lock (&sink->wayland_lock);  window = malloc (sizeof *window);  window->display = display;  window->width = width;  window->height = height;  window->redraw_pending = FALSE;  window->surface = wl_compositor_create_surface (display->compositor);  window->shell_surface = wl_shell_get_shell_surface (display->shell,      window->surface);  g_return_if_fail (window->shell_surface);  wl_shell_surface_add_listener (window->shell_surface,      &shell_surface_listener, window);  wl_shell_surface_set_toplevel (window->shell_surface);  wl_shell_surface_set_fullscreen (window->shell_surface,      WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, 0, NULL);  sink->window = window;  g_mutex_unlock (&sink->wayland_lock);}
开发者ID:collects,项目名称:gst-plugins-bad,代码行数:35,


示例21: gst_wl_window_new_toplevel

GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, GstVideoInfo * video_info){  GstWlWindow *window;  window = gst_wl_window_new_internal (display,      wl_compositor_create_surface (display->compositor));  gst_wl_window_set_video_info (window, video_info);  gst_wl_window_set_render_rectangle (window, 0, 0, window->video_width,      window->video_height);  window->shell_surface = wl_shell_get_shell_surface (display->shell,      window->surface);  if (window->shell_surface) {    wl_shell_surface_add_listener (window->shell_surface,        &shell_surface_listener, window);    wl_shell_surface_set_toplevel (window->shell_surface);  } else {    GST_ERROR ("Unable to get wl_shell_surface");    g_object_unref (window);    return NULL;  }  return window;}
开发者ID:Lachann,项目名称:gst-plugins-bad,代码行数:28,


示例22: wl_compositor_create_surface

struct wl_shell_surface *hello_create_surface(void){    struct wl_surface *surface;    struct wl_shell_surface *shell_surface;    surface = wl_compositor_create_surface(compositor);    if (surface == NULL)        return NULL;    shell_surface = wl_shell_get_shell_surface(shell, surface);    if (shell_surface == NULL) {        wl_surface_destroy(surface);        return NULL;    }    wl_shell_surface_add_listener(shell_surface,        &shell_surface_listener, 0);    wl_shell_surface_set_toplevel(shell_surface);    wl_shell_surface_set_user_data(shell_surface, surface);    wl_surface_set_user_data(surface, NULL);    return shell_surface;}
开发者ID:fooishbar,项目名称:hello_wayland,代码行数:25,


示例23: createSurface

static GLFWbool createSurface(_GLFWwindow* window,                              const _GLFWwndconfig* wndconfig){    window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);    if (!window->wl.surface)        return GLFW_FALSE;    wl_surface_add_listener(window->wl.surface,                            &surfaceListener,                            window);    wl_surface_set_user_data(window->wl.surface, window);    window->wl.native = wl_egl_window_create(window->wl.surface,                                             wndconfig->width,                                             wndconfig->height);    if (!window->wl.native)        return GLFW_FALSE;    window->wl.width = wndconfig->width;    window->wl.height = wndconfig->height;    window->wl.scale = 1;    if (!window->wl.transparent)        setOpaqueRegion(window);    return GLFW_TRUE;}
开发者ID:mcleary,项目名称:glfw,代码行数:28,


示例24: create_surface

static voidcreate_surface(struct window *window){	struct display *display = window->display;	EGLBoolean ret;		window->surface = wl_compositor_create_surface(display->compositor);	window->xdg_surface = xdg_shell_get_xdg_surface(display->shell,							window->surface);	xdg_surface_add_listener(window->xdg_surface,				 &xdg_surface_listener, window);	window->native =		wl_egl_window_create(window->surface,				     window->window_size.width,				     window->window_size.height);	window->egl_surface =		eglCreateWindowSurface(display->egl.dpy,				       display->egl.conf,				       window->native, NULL);	xdg_surface_set_title(window->xdg_surface, "simple-egl");	ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface,			     window->egl_surface, window->display->egl.ctx);	assert(ret == EGL_TRUE);	if (!window->frame_sync)		eglSwapInterval(display->egl.dpy, 0);	xdg_surface_request_change_state(window->xdg_surface,					 XDG_SURFACE_STATE_FULLSCREEN,					 window->fullscreen, 0);}
开发者ID:rzr,项目名称:weston,代码行数:35,


示例25: malloc

struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height,		int32_t scale, bool shell_surface) {	struct window *window = malloc(sizeof(struct window));	memset(window, 0, sizeof(struct window));	window->width = width;	window->height = height;	window->scale = scale;	window->registry = registry;	window->font = "monospace 10";	window->surface = wl_compositor_create_surface(registry->compositor);	if (shell_surface) {		window_make_shell(window);	}	if (registry->pointer) {		wl_pointer_add_listener(registry->pointer, &pointer_listener, window);	}	get_next_buffer(window);	if (registry->pointer) {		char *cursor_theme = getenv("SWAY_CURSOR_THEME");		if (!cursor_theme) {			cursor_theme = "default";		}		char *cursor_size = getenv("SWAY_CURSOR_SIZE");		if (!cursor_size) {			cursor_size = "16";		}		sway_log(L_DEBUG, "Cursor scale: %d", scale);		window->cursor.cursor_theme = wl_cursor_theme_load(cursor_theme,				atoi(cursor_size) * scale, registry->shm);		window->cursor.cursor = wl_cursor_theme_get_cursor(window->cursor.cursor_theme, "left_ptr");		window->cursor.surface = wl_compositor_create_surface(registry->compositor);		struct wl_cursor_image *image = window->cursor.cursor->images[0];		struct wl_buffer *cursor_buf = wl_cursor_image_get_buffer(image);		wl_surface_attach(window->cursor.surface, cursor_buf, 0, 0);		wl_surface_set_buffer_scale(window->cursor.surface, scale);		wl_surface_damage(window->cursor.surface, 0, 0,				image->width, image->height);		wl_surface_commit(window->cursor.surface);	}	return window;}
开发者ID:Hummer12007,项目名称:sway,代码行数:47,


示例26: _cogl_winsys_egl_onscreen_init

static CoglBool_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,                                EGLConfig egl_config,                                CoglError **error){  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;  CoglOnscreenWayland *wayland_onscreen;  CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);  CoglContext *context = framebuffer->context;  CoglRenderer *renderer = context->display->renderer;  CoglRendererEGL *egl_renderer = renderer->winsys;  CoglRendererWayland *wayland_renderer = egl_renderer->platform;  wayland_onscreen = g_slice_new0 (CoglOnscreenWayland);  egl_onscreen->platform = wayland_onscreen;  _cogl_list_init (&wayland_onscreen->frame_callbacks);  if (onscreen->foreign_surface)    wayland_onscreen->wayland_surface = onscreen->foreign_surface;  else    wayland_onscreen->wayland_surface =      wl_compositor_create_surface (wayland_renderer->wayland_compositor);  if (!wayland_onscreen->wayland_surface)    {      _cogl_set_error (error, COGL_WINSYS_ERROR,                   COGL_WINSYS_ERROR_CREATE_ONSCREEN,                   "Error while creating wayland surface for CoglOnscreen");      return FALSE;    }  wayland_onscreen->wayland_egl_native_window =    wl_egl_window_create (wayland_onscreen->wayland_surface,                          cogl_framebuffer_get_width (framebuffer),                          cogl_framebuffer_get_height (framebuffer));  if (!wayland_onscreen->wayland_egl_native_window)    {      _cogl_set_error (error, COGL_WINSYS_ERROR,                   COGL_WINSYS_ERROR_CREATE_ONSCREEN,                   "Error while creating wayland egl native window "                   "for CoglOnscreen");      return FALSE;    }  egl_onscreen->egl_surface =    eglCreateWindowSurface (egl_renderer->edpy,                            egl_config,                            (EGLNativeWindowType)                            wayland_onscreen->wayland_egl_native_window,                            NULL);  if (!onscreen->foreign_surface)    wayland_onscreen->wayland_shell_surface =      wl_shell_get_shell_surface (wayland_renderer->wayland_shell,                                  wayland_onscreen->wayland_surface);  return TRUE;}
开发者ID:Distrotech,项目名称:cogl,代码行数:59,


示例27: _glfwPlatformInit

int _glfwPlatformInit(void){    _glfw.wl.display = wl_display_connect(NULL);    if (!_glfw.wl.display)    {        _glfwInputError(GLFW_PLATFORM_ERROR,                        "Wayland: Failed to connect to display");        return GLFW_FALSE;    }    _glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);    wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL);    _glfw.wl.monitors = calloc(4, sizeof(_GLFWmonitor*));    _glfw.wl.monitorsSize = 4;    _glfw.wl.xkb.context = xkb_context_new(0);    if (!_glfw.wl.xkb.context)    {        _glfwInputError(GLFW_PLATFORM_ERROR,                        "Wayland: Failed to initialize xkb context");        return GLFW_FALSE;    }    // Sync so we got all registry objects    wl_display_roundtrip(_glfw.wl.display);    // Sync so we got all initial output events    wl_display_roundtrip(_glfw.wl.display);    if (!_glfwInitContextAPI())        return GLFW_FALSE;    _glfwInitTimer();    _glfwInitJoysticks();    if (_glfw.wl.pointer && _glfw.wl.shm)    {        _glfw.wl.cursorTheme = wl_cursor_theme_load(NULL, 32, _glfw.wl.shm);        if (!_glfw.wl.cursorTheme)        {            _glfwInputError(GLFW_PLATFORM_ERROR,                            "Wayland: Unable to load default cursor theme/n");            return GLFW_FALSE;        }        _glfw.wl.defaultCursor =            wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr");        if (!_glfw.wl.defaultCursor)        {            _glfwInputError(GLFW_PLATFORM_ERROR,                            "Wayland: Unable to load default left pointer/n");            return GLFW_FALSE;        }        _glfw.wl.cursorSurface =            wl_compositor_create_surface(_glfw.wl.compositor);    }    return GLFW_TRUE;}
开发者ID:Piotrek1910,项目名称:Painter,代码行数:59,


示例28: gst_wl_window_new_internal

static GstWlWindow *gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock){  GstWlWindow *window;  struct wl_region *region;  window = g_object_new (GST_TYPE_WL_WINDOW, NULL);  window->display = g_object_ref (display);  window->render_lock = render_lock;  window->area_surface = wl_compositor_create_surface (display->compositor);  window->video_surface = wl_compositor_create_surface (display->compositor);  window->area_surface_wrapper = wl_proxy_create_wrapper (window->area_surface);  window->video_surface_wrapper =      wl_proxy_create_wrapper (window->video_surface);  wl_proxy_set_queue ((struct wl_proxy *) window->area_surface_wrapper,      display->queue);  wl_proxy_set_queue ((struct wl_proxy *) window->video_surface_wrapper,      display->queue);  /* embed video_surface in area_surface */  window->video_subsurface =      wl_subcompositor_get_subsurface (display->subcompositor,      window->video_surface, window->area_surface);  wl_subsurface_set_desync (window->video_subsurface);  if (display->viewporter) {    window->area_viewport = wp_viewporter_get_viewport (display->viewporter,        window->area_surface);    window->video_viewport = wp_viewporter_get_viewport (display->viewporter,        window->video_surface);  }  /* do not accept input */  region = wl_compositor_create_region (display->compositor);  wl_surface_set_input_region (window->area_surface, region);  wl_region_destroy (region);  region = wl_compositor_create_region (display->compositor);  wl_surface_set_input_region (window->video_surface, region);  wl_region_destroy (region);  return window;}
开发者ID:MaZderMind,项目名称:gst-plugins-bad,代码行数:46,


示例29: _cogl_winsys_egl_context_created

static gboolean_cogl_winsys_egl_context_created (CoglDisplay *display,                                  GError **error){  CoglRenderer *renderer = display->renderer;  CoglRendererEGL *egl_renderer = renderer->winsys;  CoglRendererWayland *wayland_renderer = egl_renderer->platform;  CoglDisplayEGL *egl_display = display->winsys;  CoglDisplayWayland *wayland_display = egl_display->platform;  const char *error_message;  wayland_display->wayland_surface =    wl_compositor_create_surface (wayland_renderer->wayland_compositor);  if (!wayland_display->wayland_surface)    {      error_message= "Failed to create a dummy wayland surface";      goto fail;    }  wayland_display->wayland_egl_native_window =    wl_egl_window_create (wayland_display->wayland_surface,                          1,                          1);  if (!wayland_display->wayland_egl_native_window)    {      error_message= "Failed to create a dummy wayland native egl surface";      goto fail;    }  egl_display->dummy_surface =    eglCreateWindowSurface (egl_renderer->edpy,                            egl_display->egl_config,                            (EGLNativeWindowType)                            wayland_display->wayland_egl_native_window,                            NULL);  if (egl_display->dummy_surface == EGL_NO_SURFACE)    {      error_message= "Unable to eglMakeCurrent with dummy surface";      goto fail;    }  if (!eglMakeCurrent (egl_renderer->edpy,                       egl_display->dummy_surface,                       egl_display->dummy_surface,                       egl_display->egl_context))    {      error_message = "Unable to eglMakeCurrent with dummy surface";      goto fail;    }  return TRUE; fail:  g_set_error (error, COGL_WINSYS_ERROR,               COGL_WINSYS_ERROR_CREATE_CONTEXT,               "%s", error_message);  return FALSE;}
开发者ID:collects,项目名称:cogl,代码行数:58,



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


C++ wl_container_of函数代码示例
C++ wl_callback_destroy函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。