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

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

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

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

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

示例1: mech_surface_wayland_shm_push_update

static voidmech_surface_wayland_shm_push_update (MechSurface          *surface,                                      const cairo_region_t *region){  MechSurfaceWaylandSHM *shm_surface = (MechSurfaceWaylandSHM *) surface;  MechSurfaceWaylandSHMPriv *priv = shm_surface->_priv;  struct wl_surface *wl_surface;  cairo_rectangle_int_t rect;  BufferData *buffer;  gint i;  g_object_get (surface, "wl-surface", &wl_surface, NULL);  buffer = priv->buffers[priv->cur_buffer];  if (wl_surface)    {      for (i = 0; i < cairo_region_num_rectangles (region); i++)        {          cairo_region_get_rectangle (region, i, &rect);          wl_surface_damage (wl_surface, rect.x, rect.y,                             rect.width, rect.height);        }      wl_surface_attach (wl_surface, buffer->wl_buffer, priv->tx, priv->ty);      priv->tx = priv->ty = 0;      /* The current buffer is now acquired by the compositor */      buffer->released = FALSE;    }  MECH_SURFACE_CLASS (mech_surface_wayland_shm_parent_class)->push_update (surface, region);}
开发者ID:arthurfait,项目名称:mechane,代码行数:32,


示例2: wayland_swap_buffers

static voidwayland_swap_buffers (ClutterStageWayland *stage_wayland){  ClutterBackend *backend = clutter_get_default_backend ();  ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);  ClutterStageWaylandWaylandBuffer *buffer;  buffer = stage_wayland->front_buffer;  stage_wayland->front_buffer = stage_wayland->back_buffer;  stage_wayland->back_buffer = buffer;  wayland_damage_buffer(stage_wayland->front_buffer);  wl_surface_attach (stage_wayland->wayland_surface,                     stage_wayland->front_buffer->wayland_buffer,  /* 0,0 here is "relative to the old buffer," not absolute */                     0, 0);  wl_surface_map_toplevel (stage_wayland->wayland_surface);  stage_wayland->pending_swaps++;  wl_display_frame_callback (backend_wayland->wayland_display,			     wayland_frame_callback,			     stage_wayland);  _cogl_swap_buffers_notify ();}
开发者ID:nobled,项目名称:clutter,代码行数:26,


示例3: redraw

static voidredraw(void *data, struct wl_callback *callback, uint32_t time){	struct window *window = data;	struct buffer *buffer;	buffer = window_next_buffer(window);	if (!buffer) {		fprintf(stderr,			!callback ? "Failed to create the first buffer./n" :			"Both buffers busy at redraw(). Server bug?/n");		abort();	}	/* XXX: would be nice to draw something that changes here... */	wl_surface_attach(window->surface, buffer->buffer, 0, 0);	wl_surface_damage(window->surface, 0, 0, window->width, window->height);	if (callback)		wl_callback_destroy(callback);	window->callback = wl_surface_frame(window->surface);	wl_callback_add_listener(window->callback, &frame_listener, window);	wl_surface_commit(window->surface);	buffer->busy = 1;}
开发者ID:ChristophHaag,项目名称:weston,代码行数:27,


示例4: wl_surface_attach

void QWaylandWindow::attach(QWaylandBuffer *buffer){    mBuffer = buffer;    if (mSurface) {        wl_surface_attach(mSurface, buffer->buffer(),0,0);    }}
开发者ID:maxxant,项目名称:qt,代码行数:7,


示例5: pointer_handle_enter

static voidpointer_handle_enter(void *data, struct wl_pointer *pointer,		     uint32_t serial, struct wl_surface *surface,		     wl_fixed_t sx, wl_fixed_t sy){	struct display *display = data;	struct wl_buffer *buffer;	struct wl_cursor *cursor = display->default_cursor;	struct wl_cursor_image *image;	if (display->window->fullscreen)		wl_pointer_set_cursor(pointer, serial, NULL, 0, 0);	else if (cursor) {		image = display->default_cursor->images[0];		buffer = wl_cursor_image_get_buffer(image);		wl_pointer_set_cursor(pointer, serial,				      display->cursor_surface,				      image->hotspot_x,				      image->hotspot_y);		wl_surface_attach(display->cursor_surface, buffer, 0, 0);		wl_surface_damage(display->cursor_surface, 0, 0,				  image->width, image->height);		wl_surface_commit(display->cursor_surface);	}}
开发者ID:rzr,项目名称:weston,代码行数:25,


示例6: PVR2DPresentFlip

/* Swap the contents of a drawable to the screen */static WSEGLError wseglSwapDrawable    (WSEGLDrawableHandle _drawable, unsigned long data){    struct wl_egl_window *drawable = (struct wl_egl_window *) _drawable;    struct wl_callback *callback;    if (drawable->numFlipBuffers)    {        PVR2DPresentFlip(drawable->display->context, drawable->flipChain, drawable->backBuffers[drawable->currentBackBuffer], 0);    }    else if (drawable->display->display)    {         while (drawable->block_swap_buffers == 1)          wl_display_iterate(drawable->display->display,          WL_DISPLAY_READABLE);        drawable->block_swap_buffers = 1;        callback = wl_display_sync(drawable->display->display);        wl_callback_add_listener(callback, &sync_listener, drawable);        wl_buffer_damage(drawable->drmbuffers[drawable->currentBackBuffer], 0, 0,         drawable->width, drawable->height);        wl_surface_attach(drawable->surface,         drawable->drmbuffers[drawable->currentBackBuffer], 0, 0);        wl_surface_damage(drawable->surface, 0, 0, drawable->width,         drawable->height);    }    else    {       PVR2DBLTINFO blit;       memset(&blit, 0, sizeof(blit));           blit.CopyCode = PVR2DROPcopy;       blit.BlitFlags = PVR2D_BLIT_DISABLE_ALL;       blit.pSrcMemInfo = drawable->backBuffers[drawable->currentBackBuffer];       blit.SrcStride = drawable->strideBytes;       blit.SrcX = 0;       blit.SrcY = 0;       blit.SizeX = drawable->width;       blit.SizeY = drawable->height;       blit.SrcFormat = wsegl2pvr2dformat(drawable->format);       blit.pDstMemInfo = drawable->frontBufferPVRMEM;       blit.DstStride = drawable->strideBytes;        blit.DstX = 0;       blit.DstY = 0;       blit.DSizeX = drawable->width;       blit.DSizeY = drawable->height;       blit.DstFormat = wsegl2pvr2dformat(drawable->format);       PVR2DBlt(drawable->display->context, &blit);        PVR2DQueryBlitsComplete          (drawable->display->context, drawable->frontBufferPVRMEM, 1);                          }        drawable->currentBackBuffer         = (drawable->currentBackBuffer + 1) % WAYLANDWSEGL_MAX_BACK_BUFFERS;    return WSEGL_SUCCESS;}
开发者ID:ddompe,项目名称:wayland-wsegl,代码行数:61,


示例7: render_last_buffer

/* must be called with the render lock */static voidrender_last_buffer (GstWaylandSink * sink){  GstWlMeta *meta;  struct wl_surface *surface;  struct wl_callback *callback;  meta = gst_buffer_get_wl_meta (sink->last_buffer);  surface = gst_wl_window_get_wl_surface (sink->window);  g_atomic_int_set (&sink->redraw_pending, TRUE);  callback = wl_surface_frame (surface);  wl_callback_add_listener (callback, &frame_callback_listener, sink);  /* Here we essentially add a reference to the buffer. This represents   * the fact that the compositor is using the buffer and it should   * not return back to the pool and be reused until the compositor   * releases it. The release is handled internally in the pool */  gst_wayland_compositor_acquire_buffer (meta->pool, sink->last_buffer);  wl_surface_attach (surface, meta->wbuffer, 0, 0);  wl_surface_damage (surface, 0, 0, sink->window->surface_width,      sink->window->surface_height);  wl_surface_commit (surface);  wl_display_flush (sink->display->display);}
开发者ID:Lachann,项目名称:gst-plugins-bad,代码行数:28,


示例8: wl_surface_attach_buffer

WL_EXPORT voidwl_surface_attach_buffer(struct wl_surface *surface,                         struct wl_buffer *buffer){    return wl_surface_attach(surface, buffer->name,                             buffer->width, buffer->height, buffer->stride);}
开发者ID:qiuTED,项目名称:wayland,代码行数:7,


示例9: 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,


示例10: setCursor

static void setCursor(const char* name){    struct wl_buffer* buffer;    struct wl_cursor* cursor;    struct wl_cursor_image* image;    struct wl_surface* surface = _glfw.wl.cursorSurface;    cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,                                        name);    if (!cursor)    {        _glfwInputError(GLFW_PLATFORM_ERROR,                        "Wayland: Standard cursor not found");        return;    }    image = cursor->images[0];    if (!image)        return;    buffer = wl_cursor_image_get_buffer(image);    if (!buffer)        return;    wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial,                          surface,                          image->hotspot_x,                          image->hotspot_y);    wl_surface_attach(surface, buffer, 0, 0);    wl_surface_damage(surface, 0, 0,                      image->width, image->height);    wl_surface_commit(surface);}
开发者ID:christopherp,项目名称:glfw,代码行数:32,


示例11: redraw

static voidredraw(void *data, struct wl_callback *callback, uint32_t time){	struct window *window = data;	struct buffer *buffer;	buffer = window_next_buffer(window);	if (!buffer) {		fprintf(stderr,			!callback ? "Failed to create the first buffer./n" :			"Both buffers busy at redraw(). Server bug?/n");		abort();	}	paint_pixels(buffer->shm_data, 20, window->width, window->height, time);	wl_surface_attach(window->surface, buffer->buffer, 0, 0);	wl_surface_damage(window->surface,			  20, 20, window->width - 40, window->height - 40);	if (callback)		wl_callback_destroy(callback);	window->callback = wl_surface_frame(window->surface);	wl_callback_add_listener(window->callback, &frame_listener, window);	wl_surface_commit(window->surface);	buffer->busy = 1;}
开发者ID:ErwanDouaille,项目名称:westonHack,代码行数:28,


示例12: gst_wl_window_render

voidgst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,    const GstVideoInfo * info){  if (G_UNLIKELY (info)) {    window->video_width =        gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d);    window->video_height = info->height;    wl_subsurface_set_sync (window->video_subsurface);    gst_wl_window_resize_video_surface (window, FALSE);    gst_wl_window_set_opaque (window, info);  }  if (G_LIKELY (buffer))    gst_wl_buffer_attach (buffer, window->video_surface_wrapper);  else    wl_surface_attach (window->video_surface_wrapper, NULL, 0, 0);  wl_surface_damage (window->video_surface_wrapper, 0, 0,      window->video_rectangle.w, window->video_rectangle.h);  wl_surface_commit (window->video_surface_wrapper);  if (G_UNLIKELY (info)) {    /* commit also the parent (area_surface) in order to change     * the position of the video_subsurface */    wl_surface_damage (window->area_surface_wrapper, 0, 0,        window->render_rectangle.w, window->render_rectangle.h);    wl_surface_commit (window->area_surface_wrapper);    wl_subsurface_set_desync (window->video_subsurface);  }  wl_display_flush (window->display->display);}
开发者ID:MaZderMind,项目名称:gst-plugins-bad,代码行数:34,


示例13: wl_callback_done

static void wl_callback_done(void* data, struct wl_callback* callback, uint32_t time){	wlfWindow* window = data;	wlfBuffer* buffer;	struct wl_shm_pool* shm_pool;	void* shm_data;	void* free_data;	int fd;	int fdt;	if (!window->buffers[0].busy)		buffer = &window->buffers[0];	else if (!window->buffers[1].busy)		buffer = &window->buffers[1];	else		return;	if (!buffer->buffer) {		fd = shm_open("/wlfreerdp_shm", O_CREAT | O_RDWR, 0666);		fdt = ftruncate(fd, window->width * window->height * 4);		if (fdt != 0)		{			WLog_ERR(TAG, "window_redraw: could not allocate memory");			close(fd);			return;		}		shm_data = mmap(NULL, window->width * window->height * 4, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);		if (shm_data == MAP_FAILED)		{			WLog_ERR(TAG, "window_redraw: failed to memory map buffer");			close(fd);			return;		}		shm_pool = wl_shm_create_pool(window->display->shm, fd, window->width * window->height * 4);		buffer->buffer = wl_shm_pool_create_buffer(shm_pool, 0, window->width, window->height, window->width* 4, WL_SHM_FORMAT_XRGB8888);		wl_buffer_add_listener(buffer->buffer, &wl_buffer_listener, buffer);		wl_shm_pool_destroy(shm_pool);		shm_unlink("/wlfreerdp_shm");		close(fd);		free_data = buffer->shm_data;		buffer->shm_data = shm_data;		munmap(free_data, window->width * window->height * 4);	}	 /* this is the real surface data */	memcpy(buffer->shm_data, (void*) window->data, window->width * window->height * 4);	wl_surface_attach(window->surface, buffer->buffer, 0, 0);	wl_surface_damage(window->surface, 0, 0, window->width, window->height);	if (callback) wl_callback_destroy(callback);	window->callback = wl_surface_frame(window->surface);	wl_callback_add_listener(window->callback, &wl_callback_listener, window);	wl_surface_commit(window->surface);	buffer->busy = TRUE;}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:59,


示例14: wl_surface_attach

void QWaylandWindow::attach(QWaylandBuffer *buffer){    mBuffer = buffer;    if (window()->isVisible()) {        wl_surface_attach(mSurface, mBuffer->buffer(),0,0);    }}
开发者ID:Distrotech,项目名称:qtwayland,代码行数:8,


示例15: setup

	void setup()	{		wl_surface_attach(surface_, buffer_, 0, 0);		wl_surface_damage(surface_, 0, 0, buffer_.width(), buffer_.height());		surface_.commit();		queueStep(boost::bind(&SurfacePointerTest::test, boost::ref(*this)));	}
开发者ID:smspillaz,项目名称:wayland-fits,代码行数:8,


示例16: lock

void WaylandNativeWindow::finishSwap(){    int ret = 0;    lock();    WaylandNativeWindowBuffer *wnb = queue.front();    if (!wnb) {        wnb = m_lastBuffer;    } else {        queue.pop_front();    }    assert(wnb);    m_lastBuffer = wnb;    wnb->busy = 1;    ret = readQueue(false);    if (this->frame_callback) {        do {            ret = readQueue(true);        } while (this->frame_callback && ret != -1);    }    if (ret < 0) {        HYBRIS_TRACE_END("wayland-platform", "queueBuffer_wait_for_frame_callback", "-%p", wnb);        return;    }    if (wnb->wlbuffer == NULL)    {        wnb->wlbuffer_from_native_handle(m_android_wlegl, m_display, wl_queue);        TRACE("%p add listener with %p inside", wnb, wnb->wlbuffer);        wl_buffer_add_listener(wnb->wlbuffer, &wl_buffer_listener, this);        wl_proxy_set_queue((struct wl_proxy *) wnb->wlbuffer, this->wl_queue);    }    if (m_swap_interval > 0) {        this->frame_callback = wl_surface_frame(m_window->surface);        wl_callback_add_listener(this->frame_callback, &frame_listener, this);        wl_proxy_set_queue((struct wl_proxy *) this->frame_callback, this->wl_queue);    }    wl_surface_attach(m_window->surface, wnb->wlbuffer, 0, 0);    wl_surface_damage(m_window->surface, 0, 0, wnb->width, wnb->height);    wl_surface_commit(m_window->surface);    // Some compositors, namely Weston, queue buffer release events instead    // of sending them immediately.  If a frame event is used, this should    // not be a problem.  Without a frame event, we need to send a sync    // request to ensure that they get flushed.    wl_callback_destroy(wl_display_sync(m_display));    wl_display_flush(m_display);    fronted.push_back(wnb);    m_window->attached_width = wnb->width;    m_window->attached_height = wnb->height;    m_damage_rects = NULL;    m_damage_n_rects = 0;    unlock();}
开发者ID:aosp-hybris,项目名称:libhybris,代码行数:58,


示例17: create_window

static voidcreate_window() {    buffer = create_buffer();    wl_surface_attach(surface, buffer, 0, 0);    //wl_surface_damage(surface, 0, 0, WIDTH, HEIGHT);    wl_surface_commit(surface);}
开发者ID:darkenk,项目名称:wayland-test,代码行数:9,


示例18: hello_bind_buffer

void hello_bind_buffer(struct wl_buffer *buffer,    struct wl_shell_surface *shell_surface){    struct wl_surface *surface;    surface = wl_shell_surface_get_user_data(shell_surface);    wl_surface_attach(surface, buffer, 0, 0);    wl_surface_commit(surface);}
开发者ID:fooishbar,项目名称:hello_wayland,代码行数:9,


示例19: Prepare

static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,                    vlc_tick_t date){    VLC_UNUSED(date);    vout_display_sys_t *sys = vd->sys;    struct wl_display *display = sys->embed->display.wl;    struct wl_surface *surface = sys->embed->handle.wl;    struct picture_buffer_t *picbuf = pic->p_sys;    if (picbuf->fd == -1)        return;    struct buffer_data *d = malloc(sizeof (*d));    if (unlikely(d == NULL))        return;    d->picture = pic;    d->counter = &sys->active_buffers;    off_t offset = picbuf->offset;    const size_t stride = pic->p->i_pitch;    const size_t size = pic->p->i_lines * stride;    struct wl_shm_pool *pool;    struct wl_buffer *buf;    pool = wl_shm_create_pool(sys->shm, picbuf->fd, offset + size);    if (pool == NULL)    {        free(d);        return;    }    if (sys->viewport == NULL) /* Poor man's crop */        offset += 4 * vd->fmt.i_x_offset                  + pic->p->i_pitch * vd->fmt.i_y_offset;    buf = wl_shm_pool_create_buffer(pool, offset, vd->fmt.i_visible_width,                                    vd->fmt.i_visible_height, stride,                                    WL_SHM_FORMAT_XRGB8888);    wl_shm_pool_destroy(pool);    if (buf == NULL)    {        free(d);        return;    }    picture_Hold(pic);    wl_buffer_add_listener(buf, &buffer_cbs, d);    wl_surface_attach(surface, buf, 0, 0);    wl_surface_damage(surface, 0, 0, sys->display_width, sys->display_height);    wl_display_flush(display);    sys->active_buffers++;    (void) subpic;}
开发者ID:videolan,项目名称:vlc,代码行数:57,


示例20: TRACE

int WaylandNativeWindow::postBuffer(ANativeWindowBuffer* buffer){    TRACE("");    WaylandNativeWindowBuffer *wnb = NULL;    lock();    std::list<WaylandNativeWindowBuffer *>::iterator it = post_registered.begin();    for (; it != post_registered.end(); it++)    {        if ((*it)->other == buffer)        {            wnb = (*it);            break;        }    }    unlock();    if (!wnb)    {        wnb = new WaylandNativeWindowBuffer(buffer);        wnb->common.incRef(&wnb->common);        buffer->common.incRef(&buffer->common);    }    int ret = 0;    lock();    wnb->busy = 1;    ret = readQueue(false);    unlock();    if (ret < 0) {        return ret;    }    lock();    if (wnb->wlbuffer == NULL)    {        wnb->wlbuffer_from_native_handle(m_android_wlegl, m_display, wl_queue);        TRACE("%p add listener with %p inside", wnb, wnb->wlbuffer);        wl_buffer_add_listener(wnb->wlbuffer, &wl_buffer_listener, this);        wl_proxy_set_queue((struct wl_proxy *) wnb->wlbuffer, this->wl_queue);        post_registered.push_back(wnb);    }    TRACE("%p DAMAGE AREA: %dx%d", wnb, wnb->width, wnb->height);    wl_surface_attach(m_window->surface, wnb->wlbuffer, 0, 0);    wl_surface_damage(m_window->surface, 0, 0, wnb->width, wnb->height);    wl_surface_commit(m_window->surface);    wl_display_flush(m_display);    posted.push_back(wnb);    unlock();    return NO_ERROR;}
开发者ID:aosp-hybris,项目名称:libhybris,代码行数:56,


示例21: window_render

int window_render(struct window *window) {	window->frame_cb = wl_surface_frame(window->surface);	wl_callback_add_listener(window->frame_cb, &listener, window);	wl_surface_damage(window->surface, 0, 0, window->buffer->width, window->buffer->height);	wl_surface_attach(window->surface, window->buffer->buffer, 0, 0);	wl_surface_commit(window->surface);	return 1;}
开发者ID:hooplaaa,项目名称:sway,代码行数:10,


示例22: lock

int WaylandNativeWindow::queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd){    WaylandNativeWindowBuffer *backbuf = (WaylandNativeWindowBuffer *) buffer;    int ret = 0;    lock();    backbuf->busy = 2;    unlock();    while (this->frame_callback && ret != -1)     	ret = wl_display_dispatch_queue(m_display, this->wl_queue);        if (ret < 0)	return ret;    lock();    this->frame_callback = wl_surface_frame(m_window->surface);    wl_callback_add_listener(this->frame_callback, &frame_listener, this);    wl_proxy_set_queue((struct wl_proxy *) this->frame_callback, this->wl_queue);    if (backbuf->wlbuffer == NULL)	    {	    struct wl_array ints;	    int *ints_data;	    struct android_wlegl_handle *wlegl_handle;	    buffer_handle_t handle;			    handle = backbuf->handle;	    wl_array_init(&ints);	    ints_data = (int*) wl_array_add(&ints, handle->numInts*sizeof(int));	    memcpy(ints_data, handle->data + handle->numFds, handle->numInts*sizeof(int));	    wlegl_handle = android_wlegl_create_handle(m_android_wlegl, handle->numFds, &ints);	    wl_array_release(&ints);	    for (int i = 0; i < handle->numFds; i++) {		android_wlegl_handle_add_fd(wlegl_handle, handle->data[i]);	    }	    backbuf->wlbuffer = android_wlegl_create_buffer(m_android_wlegl,			backbuf->width, backbuf->height, backbuf->stride,			backbuf->format, backbuf->usage, wlegl_handle);	    android_wlegl_handle_destroy(wlegl_handle);	    backbuf->common.incRef(&backbuf->common);	    TRACE("Add listener for %p with %p inside", backbuf, backbuf->wlbuffer);	    wl_buffer_add_listener(backbuf->wlbuffer, &wl_buffer_listener, this);	    wl_proxy_set_queue((struct wl_proxy *) backbuf->wlbuffer,				this->wl_queue);    }    wl_surface_attach(m_window->surface, backbuf->wlbuffer, 0, 0);     wl_surface_damage(m_window->surface, 0, 0, backbuf->width, backbuf->height);    wl_surface_commit(m_window->surface);    fronted.push_back(backbuf);        unlock();    return NO_ERROR;}
开发者ID:kgunn,项目名称:libhybris,代码行数:55,


示例23: clutter_wayland_handle_pointer_enter

static voidclutter_wayland_handle_pointer_enter (void *data,                                      struct wl_pointer *pointer,                                      uint32_t serial,                                      struct wl_surface *surface,                                      wl_fixed_t x, wl_fixed_t y){  ClutterInputDeviceWayland *device = data;  ClutterStageCogl          *stage_cogl;  ClutterEvent              *event;  ClutterBackend            *backend;  ClutterBackendWayland     *backend_wayland;  stage_cogl = wl_surface_get_user_data (surface);  device->pointer_focus = stage_cogl;  _clutter_input_device_set_stage (CLUTTER_INPUT_DEVICE (device),       stage_cogl->wrapper);  event = clutter_event_new (CLUTTER_ENTER);  event->crossing.stage = stage_cogl->wrapper;  event->crossing.time = 0; /* ?! */  event->crossing.x = wl_fixed_to_double(x);  event->crossing.y = wl_fixed_to_double(y);  event->crossing.source = CLUTTER_ACTOR (stage_cogl->wrapper);  event->crossing.device = CLUTTER_INPUT_DEVICE (device);  device->x = event->crossing.x;  device->y = event->crossing.y;  _clutter_event_push (event, FALSE);  /* Set the cursor to the cursor loaded at backend initialisation */  backend = clutter_get_default_backend ();  backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);  wl_pointer_set_cursor (pointer,                         serial,                         backend_wayland->cursor_surface,                         backend_wayland->cursor_x,                         backend_wayland->cursor_y);  wl_surface_attach (backend_wayland->cursor_surface,                     backend_wayland->cursor_buffer,                     0,                     0);  wl_surface_damage (backend_wayland->cursor_surface,                     0,                     0,                     32, /* XXX: FFS */                     32);  wl_surface_commit (backend_wayland->cursor_surface);}
开发者ID:ChrisCummins,项目名称:clutter,代码行数:53,


示例24: QWaylandShmBuffer

void QWaylandCursor::ensureSurface(const QSize &size){    if (!mBuffer || mBuffer->size() != size) {        delete mBuffer;        mBuffer = new QWaylandShmBuffer(mDisplay, size,                                        QImage::Format_ARGB32);    }    if (!mSurface)        mSurface = mDisplay->createSurface(0);    wl_surface_attach(mSurface, mBuffer->buffer(), 0, 0);}
开发者ID:Distrotech,项目名称:qtwayland,代码行数:13,


示例25: draw_initial_frame

static voiddraw_initial_frame(struct wayland_output *output){	struct wayland_compositor *c =		(struct wayland_compositor *) output->base.compositor;	struct wl_shm *shm = c->parent.shm;	struct wl_surface *surface = output->parent.surface;	struct wl_shm_pool *pool;	struct wl_buffer *buffer;	int width, height, stride;	int size;	int fd;	void *data;	width = output->mode.width + c->border.left + c->border.right;	height = output->mode.height + c->border.top + c->border.bottom;	stride = width * 4;	size = height * stride;	fd = os_create_anonymous_file(size);	if (fd < 0) {		perror("os_create_anonymous_file");		return;	}	data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);	if (data == MAP_FAILED) {		perror("mmap");		close(fd);		return;	}	pool = wl_shm_create_pool(shm, fd, size);	buffer = wl_shm_pool_create_buffer(pool, 0,					   width, height,					   stride,					   WL_SHM_FORMAT_ARGB8888);	wl_buffer_add_listener(buffer, &buffer_listener, buffer);	wl_shm_pool_destroy(pool);	close(fd);	memset(data, 0, size);	wl_surface_attach(surface, buffer, 0, 0);	/* We only need to damage some part, as its only transparant	 * pixels anyway. */	wl_surface_damage(surface, 0, 0, 1, 1);}
开发者ID:anderco,项目名称:weston,代码行数:51,


示例26: render_frame

void render_frame(struct swaynag *swaynag) {	if (!swaynag->run_display) {		return;	}	cairo_surface_t *recorder = cairo_recording_surface_create(			CAIRO_CONTENT_COLOR_ALPHA, NULL);	cairo_t *cairo = cairo_create(recorder);	cairo_save(cairo);	cairo_set_operator(cairo, CAIRO_OPERATOR_CLEAR);	cairo_paint(cairo);	cairo_restore(cairo);	uint32_t height = render_to_cairo(cairo, swaynag);	if (height != swaynag->height) {		zwlr_layer_surface_v1_set_size(swaynag->layer_surface, 0, height);		zwlr_layer_surface_v1_set_exclusive_zone(swaynag->layer_surface,				height);		wl_surface_commit(swaynag->surface);		wl_display_roundtrip(swaynag->display);	} else {		swaynag->current_buffer = get_next_buffer(swaynag->shm,				swaynag->buffers,				swaynag->width * swaynag->scale,				swaynag->height * swaynag->scale);		if (!swaynag->current_buffer) {			sway_log(SWAY_DEBUG, "Failed to get buffer. Skipping frame.");			goto cleanup;		}		cairo_t *shm = swaynag->current_buffer->cairo;		cairo_save(shm);		cairo_set_operator(shm, CAIRO_OPERATOR_CLEAR);		cairo_paint(shm);		cairo_restore(shm);		cairo_set_source_surface(shm, recorder, 0.0, 0.0);		cairo_paint(shm);		wl_surface_set_buffer_scale(swaynag->surface, swaynag->scale);		wl_surface_attach(swaynag->surface,				swaynag->current_buffer->buffer, 0, 0);		wl_surface_damage(swaynag->surface, 0, 0,				swaynag->width, swaynag->height);		wl_surface_commit(swaynag->surface);		wl_display_roundtrip(swaynag->display);	}cleanup:	cairo_surface_destroy(recorder);	cairo_destroy(cairo);}
开发者ID:bakunowski,项目名称:sway,代码行数:50,



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


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