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

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

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

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

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

示例1: arrange

/* This is a basic grid arrange function that tries to give each window an * equal space. */static voidarrange(struct screen *screen){	struct window *window = NULL;	unsigned num_columns, num_rows, column_index, row_index;	struct swc_rectangle geometry;	struct swc_rectangle *screen_geometry = &screen->swc->usable_geometry;	if (screen->num_windows == 0)		return;	num_columns = ceil(sqrt(screen->num_windows));	num_rows = screen->num_windows / num_columns + 1;	window = wl_container_of(screen->windows.next, window, link);	for (column_index = 0; &window->link != &screen->windows; ++column_index) {		geometry.x = screen_geometry->x + border_width		             + screen_geometry->width * column_index / num_columns;		geometry.width = screen_geometry->width / num_columns		                 - 2 * border_width;		if (column_index == screen->num_windows % num_columns)			--num_rows;		for (row_index = 0; row_index < num_rows; ++row_index) {			geometry.y = screen_geometry->y + border_width			             + screen_geometry->height * row_index / num_rows;			geometry.height = screen_geometry->height / num_rows			                  - 2 * border_width;			swc_window_set_geometry(window->swc, &geometry);			window = wl_container_of(window->link.next, window, link);		}	}}
开发者ID:DmitryHetman,项目名称:swc,代码行数:37,


示例2: pointer_handle_focus_surface_destroy

static voidpointer_handle_focus_surface_destroy (struct wl_listener *listener, void *data){  MetaWaylandPointer *pointer = wl_container_of (listener, pointer, focus_surface_listener);  meta_wayland_pointer_set_focus (pointer, NULL);}
开发者ID:mchalupa,项目名称:mutter,代码行数:7,


示例3: handle_buffer_destroy

static void handle_buffer_destroy(struct wld_destructor * destructor){    struct pool_reference * reference        = wl_container_of(destructor, reference, destructor);    unref_pool(reference->pool);}
开发者ID:Kinokoio,项目名称:swc,代码行数:7,


示例4: handle_set_title

static void handle_set_title(struct wl_listener *listener, void *data) {	struct sway_xdg_shell_v6_view *xdg_shell_v6_view =		wl_container_of(listener, xdg_shell_v6_view, set_title);	struct sway_view *view = &xdg_shell_v6_view->view;	view_update_title(view, false);	view_execute_criteria(view);}
开发者ID:thejan2009,项目名称:sway,代码行数:7,


示例5: handle_resize

static void handle_resize(struct view_handler * handler,                          uint32_t old_width, uint32_t old_height){    struct panel * panel = wl_container_of(handler, panel, view_handler);    update_position(panel);}
开发者ID:Kinokoio,项目名称:swc,代码行数:7,


示例6: attach

static int attach(struct view * view, struct wld_buffer * buffer){    struct cursor_plane * plane = wl_container_of(view, plane, view);    if (buffer)    {        union wld_object object;        if (!wld_export(buffer, WLD_DRM_OBJECT_HANDLE, &object))        {            ERROR("Could not get export buffer to DRM handle/n");            /* XXX: Not the best error code, but we don't know better until wld             * returns an actual error code. */            return -EINVAL;        }        if (swc.active && drmModeSetCursor(swc.drm->fd, plane->crtc, object.u32,                                           buffer->width, buffer->height) < 0)        {            ERROR("Could not set cursor: %s/n", strerror(errno));            return -errno;        }    }    else if (swc.active && drmModeSetCursor(swc.drm->fd, plane->crtc,                                            0, 0, 0) < 0)    {        ERROR("Could not unset cursor: %s/n", strerror(errno));        return -errno;    }    view_set_size_from_buffer(view, buffer);    return 0;}
开发者ID:ibab,项目名称:swc,代码行数:33,


示例7: destroy_drag_focus

static voiddestroy_drag_focus (struct wl_listener *listener, void *data){  MetaWaylandDragGrab *grab = wl_container_of (listener, grab, drag_focus_listener);  grab->drag_focus_data_device = NULL;}
开发者ID:mvollmer,项目名称:mutter,代码行数:7,


示例8: cogland_buffer_from_resource

static CoglandBuffer *cogland_buffer_from_resource (struct wl_resource *resource){  CoglandBuffer *buffer;  struct wl_listener *listener;  listener = wl_resource_get_destroy_listener (resource,                                               cogland_buffer_destroy_handler);  if (listener)    {      buffer = wl_container_of (listener, buffer, destroy_listener);    }  else    {      buffer = g_slice_new0 (CoglandBuffer);      buffer->resource = resource;      wl_signal_init (&buffer->destroy_signal);      buffer->destroy_listener.notify = cogland_buffer_destroy_handler;      wl_resource_add_destroy_listener (resource, &buffer->destroy_listener);    }  return buffer;}
开发者ID:3v1n0,项目名称:cogl,代码行数:25,


示例9: meta_wayland_buffer_from_resource

MetaWaylandBuffer *meta_wayland_buffer_from_resource (struct wl_resource *resource){  MetaWaylandBuffer *buffer;  struct wl_listener *listener;  listener =    wl_resource_get_destroy_listener (resource,                                      meta_wayland_buffer_destroy_handler);  if (listener)    {      buffer = wl_container_of (listener, buffer, destroy_listener);    }  else    {      buffer = g_object_new (META_TYPE_WAYLAND_BUFFER, NULL);      buffer->resource = resource;      buffer->destroy_listener.notify = meta_wayland_buffer_destroy_handler;      wl_resource_add_destroy_listener (resource, &buffer->destroy_listener);    }  return buffer;}
开发者ID:endlessm,项目名称:mutter,代码行数:25,


示例10: wl_client_get_destroy_listener

QWaylandClient *QWaylandClient::fromWlClient(wl_client *wlClient){    if (!wlClient)        return 0;    QWaylandClient *client = Q_NULLPTR;    wl_listener *l = wl_client_get_destroy_listener(wlClient,        QWaylandClientPrivate::client_destroy_callback);    if (l)        client = reinterpret_cast<QWaylandClientPrivate::Listener *>(            wl_container_of(l, (QWaylandClientPrivate::Listener *)0, listener))->parent;    if (!client) {        // The original idea was to create QWaylandClient instances when        // a client bound wl_compositor, but it's legal for a client to        // bind several times resulting in multiple QWaylandClient        // instances for the same wl_client therefore we create it from        // here on demand        client = new QWaylandClient(wlClient);        QtWayland::Compositor::instance()->m_clients.append(client);    }    return client;}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:25,


示例11: launcher_logind_activate_vt

static intlauncher_logind_activate_vt(struct weston_launcher *launcher, int vt){	struct launcher_logind *wl = wl_container_of(launcher, wl, base);	DBusMessage *m;	bool b;	int r;	m = dbus_message_new_method_call("org.freedesktop.login1",					 "/org/freedesktop/login1/seat/self",					 "org.freedesktop.login1.Seat",					 "SwitchTo");	if (!m)		return -ENOMEM;	b = dbus_message_append_args(m,				     DBUS_TYPE_UINT32, &vt,				     DBUS_TYPE_INVALID);	if (!b) {		r = -ENOMEM;		goto err_unref;	}	dbus_connection_send(wl->dbus, m, NULL);	r = 0; err_unref:	dbus_message_unref(m);	return r;}
开发者ID:ChristophHaag,项目名称:weston,代码行数:30,


示例12: launcher_direct_open

static intlauncher_direct_open(struct weston_launcher *launcher_base, const char *path, int flags){	struct launcher_direct *launcher = wl_container_of(launcher_base, launcher, base);	struct stat s;	int fd;	fd = open(path, flags | O_CLOEXEC);	if (fd == -1)		return -1;	if (fstat(fd, &s) == -1) {		close(fd);		return -1;	}	if (major(s.st_rdev) == DRM_MAJOR) {		launcher->drm_fd = fd;		if (!is_drm_master(fd)) {			weston_log("drm fd not master/n");			close(fd);			return -1;		}	}	return fd;}
开发者ID:ybakos,项目名称:weston,代码行数:27,


示例13: weston_desktop_seat_from_seat

struct weston_desktop_seat *weston_desktop_seat_from_seat(struct weston_seat *wseat){	struct wl_listener *listener;	struct weston_desktop_seat *seat;	listener = wl_signal_get(&wseat->destroy_signal,				 weston_desktop_seat_destroy);	if (listener != NULL)		return wl_container_of(listener, seat, seat_destroy_listener);	seat = zalloc(sizeof(struct weston_desktop_seat));	if (seat == NULL)		return NULL;	seat->seat = wseat;	seat->seat_destroy_listener.notify = weston_desktop_seat_destroy;	wl_signal_add(&wseat->destroy_signal, &seat->seat_destroy_listener);	seat->popup_grab.keyboard.interface =		&weston_desktop_seat_keyboard_popup_grab_interface;	seat->popup_grab.pointer.interface =		&weston_desktop_seat_pointer_popup_grab_interface;	seat->popup_grab.touch.interface =		&weston_desktop_seat_touch_popup_grab_interface;	wl_list_init(&seat->popup_grab.surfaces);	return seat;}
开发者ID:dtoartist,项目名称:weston,代码行数:30,


示例14: handle_commit

static void handle_commit(struct wl_listener *listener, void *data) {	struct sway_xdg_shell_v6_view *xdg_shell_v6_view =		wl_container_of(listener, xdg_shell_v6_view, commit);	struct sway_view *view = &xdg_shell_v6_view->view;	struct wlr_xdg_surface_v6 *xdg_surface_v6 = view->wlr_xdg_surface_v6;	if (view->container->node.instruction) {		wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry);		transaction_notify_view_ready_by_serial(view,				xdg_surface_v6->configure_serial);	} else {		struct wlr_box new_geo;		wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo);		struct sway_container *con = view->container;		if ((new_geo.width != con->surface_width ||					new_geo.height != con->surface_height)) {			// The view has unexpectedly sent a new size			desktop_damage_view(view);			view_update_size(view, new_geo.width, new_geo.height);			memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));			desktop_damage_view(view);			transaction_commit_dirty();		} else {			memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));		}	}	view_damage_from(view);}
开发者ID:thejan2009,项目名称:sway,代码行数:30,


示例15: tall_next_col

/* Tall layout */static voidtall_next_col(struct col *col){	struct tall_layout *layout = wl_container_of(col, layout, grid.col);	grid(&layout->grid, &layout->grid_area, layout->grid.num_windows,	     MIN(layout->grid.num_windows, layout->num_columns));}
开发者ID:N8Fear,项目名称:velox,代码行数:9,


示例16: toggle

static void toggle(struct config_node * node){    struct tag * tag = wl_container_of(node, tag, config.toggle);    struct screen * screen = velox.active_screen;    screen_set_tags(velox.active_screen, screen->mask ^ tag->mask);    update();}
开发者ID:Kinokoio,项目名称:velox,代码行数:8,


示例17: pointer_handle_cursor_surface_destroy

static voidpointer_handle_cursor_surface_destroy (struct wl_listener *listener, void *data){  MetaWaylandPointer *pointer = wl_container_of (listener, pointer, cursor_surface_destroy_listener);  set_cursor_surface (pointer, NULL);  meta_wayland_pointer_update_cursor_surface (pointer);}
开发者ID:mchalupa,项目名称:mutter,代码行数:8,


示例18: weston_desktop_seat_destroy

static voidweston_desktop_seat_destroy(struct wl_listener *listener, void *data){	struct weston_desktop_seat *seat =		wl_container_of(listener, seat, seat_destroy_listener);	free(seat);}
开发者ID:dtoartist,项目名称:weston,代码行数:8,


示例19: weston_desktop_seat_popup_grab_keyboard_cancel

static voidweston_desktop_seat_popup_grab_keyboard_cancel(struct weston_keyboard_grab *grab){	struct weston_desktop_seat *seat =		wl_container_of(grab, seat, popup_grab.keyboard);	weston_desktop_seat_popup_grab_end(seat);}
开发者ID:dtoartist,项目名称:weston,代码行数:8,


示例20: weston_desktop_seat_popup_grab_pointer_cancel

static voidweston_desktop_seat_popup_grab_pointer_cancel(struct weston_pointer_grab *grab){	struct weston_desktop_seat *seat =		wl_container_of(grab, seat, popup_grab.pointer);	weston_desktop_seat_popup_grab_end(seat);}
开发者ID:dtoartist,项目名称:weston,代码行数:8,


示例21: keyboard_surface_destroyed

static voidkeyboard_surface_destroyed(struct wl_listener *listener, void *data){	struct wlb_keyboard *keyboard =		wl_container_of(listener, keyboard, surface_destroy_listener);	wlb_keyboard_set_focus(keyboard, NULL);}
开发者ID:jekstrand,项目名称:libwlb,代码行数:8,


示例22: weston_desktop_seat_popup_grab_touch_cancel

static voidweston_desktop_seat_popup_grab_touch_cancel(struct weston_touch_grab *grab){	struct weston_desktop_seat *seat =		wl_container_of(grab, seat, popup_grab.touch);	weston_desktop_seat_popup_grab_end(seat);}
开发者ID:dtoartist,项目名称:weston,代码行数:8,


示例23: pointer_handle_sprite_destroy

static voidpointer_handle_sprite_destroy (struct wl_listener *listener, void *data){  ClaylandSeat *seat =    wl_container_of (listener, seat, sprite_destroy_listener);  seat->sprite = NULL;}
开发者ID:clutter-project,项目名称:clayland,代码行数:8,


示例24: cogland_buffer_destroy_handler

static voidcogland_buffer_destroy_handler (struct wl_listener *listener,                                void *data){  CoglandBuffer *buffer = wl_container_of (listener, buffer, destroy_listener);  wl_signal_emit (&buffer->destroy_signal, buffer);  g_slice_free (CoglandBuffer, buffer);}
开发者ID:3v1n0,项目名称:cogl,代码行数:9,


示例25: apply

static void apply(struct config_node * node){    struct tag * tag = wl_container_of(node, tag, config.apply);    struct window * window = velox.active_screen->focus;    if (window)        window_set_tag(window, tag);    update();}
开发者ID:Kinokoio,项目名称:velox,代码行数:9,


示例26: destroy_data_device_source

static voiddestroy_data_device_source (struct wl_listener *listener, void *data){  MetaWaylandDragGrab *drag_grab =    wl_container_of (listener, drag_grab, drag_data_source_listener);  drag_grab->drag_data_source = NULL;  data_device_end_drag_grab (drag_grab);}
开发者ID:mvollmer,项目名称:mutter,代码行数:9,


示例27: destroy_selection_data_source

static voiddestroy_selection_data_source (struct wl_listener *listener, void *data){  MetaWaylandDataDevice *data_device = wl_container_of (listener, data_device, selection_data_source_listener);  MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);  struct wl_resource *data_device_resource;  struct wl_client *focus_client = NULL;  data_device->selection_data_source = NULL;  focus_client = meta_wayland_keyboard_get_focus_client (&seat->keyboard);  if (focus_client)    {      data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client);      if (data_device_resource)        wl_data_device_send_selection (data_device_resource, NULL);    }}
开发者ID:mvollmer,项目名称:mutter,代码行数:18,


示例28: destroy_offer_data_source

static voiddestroy_offer_data_source (struct wl_listener *listener, void *data){  MetaWaylandDataOffer *offer;  offer = wl_container_of (listener, offer, source_destroy_listener);  offer->source = NULL;}
开发者ID:mvollmer,项目名称:mutter,代码行数:9,


示例29: surface_handle_pending_buffer_destroy

static voidsurface_handle_pending_buffer_destroy (struct wl_listener *listener,                                       void *data){  CoglandSurface *surface =    wl_container_of (listener, surface, pending.buffer_destroy_listener);  surface->pending.buffer = NULL;}
开发者ID:3v1n0,项目名称:cogl,代码行数:9,


示例30: activate

static void activate(struct config_node * node){    struct tag * tag = wl_container_of(node, tag, config.activate);    struct screen * screen = velox.active_screen;    screen->last_mask = screen->mask;    screen_set_tags(screen, tag->mask);    update();}
开发者ID:Kinokoio,项目名称:velox,代码行数:9,



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


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