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

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

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

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

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

示例1: handle_view_state_request

static void handle_view_state_request(wlc_handle view, enum wlc_view_state_bit state, bool toggle) {	swayc_t *c = get_swayc_for_handle(view, &root_container);	switch (state) {	case WLC_BIT_FULLSCREEN:		// i3 just lets it become fullscreen		wlc_view_set_state(view, state, toggle);		if (c) {			sway_log(L_DEBUG, "setting view %ld %s, fullscreen %d", view, c->name, toggle);			arrange_windows(c->parent, -1, -1);			// Set it as focused window for that workspace if its going fullscreen			if (toggle) {				swayc_t *ws = swayc_parent_by_type(c, C_WORKSPACE);				// Set ws focus to c				set_focused_container_for(ws, c);			}		}		break;	case WLC_BIT_MAXIMIZED:	case WLC_BIT_RESIZING:	case WLC_BIT_MOVING:		break;	case WLC_BIT_ACTIVATED:		sway_log(L_DEBUG, "View %p requested to be activated", c);		break;	}	return;}
开发者ID:illblew,项目名称:sway,代码行数:27,


示例2: strtol

struct cmd_results *cmd_floating_maximum_size(int argc, char **argv) {	struct cmd_results *error = NULL;	int32_t width;	int32_t height;	char *ptr;	if ((error = checkarg(argc, "floating_maximum_size", EXPECTED_EQUAL_TO, 3))) {		return error;	}	width = strtol(argv[0], &ptr, 10);	height = strtol(argv[2], &ptr, 10);	if (width < -1) {		sway_log(L_DEBUG, "floating_maximum_size invalid width value: '%s'", argv[0]);	} else {		config->floating_maximum_width = width;	}	if (height < -1) {		sway_log(L_DEBUG, "floating_maximum_size invalid height value: '%s'", argv[2]);	}	else {		config->floating_maximum_height = height;	}	sway_log(L_DEBUG, "New floating_maximum_size: '%d' x '%d'", config->floating_maximum_width,		config->floating_maximum_height);	return cmd_results_new(CMD_SUCCESS, NULL, NULL);}
开发者ID:Hummer12007,项目名称:sway,代码行数:33,


示例3: handle_xdg_shell_v6_surface

void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {	struct wlr_xdg_surface_v6 *xdg_surface = data;	if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {		sway_log(SWAY_DEBUG, "New xdg_shell_v6 popup");		return;	}	sway_log(SWAY_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'",		xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);	wlr_xdg_surface_v6_ping(xdg_surface);	struct sway_xdg_shell_v6_view *xdg_shell_v6_view =		calloc(1, sizeof(struct sway_xdg_shell_v6_view));	if (!sway_assert(xdg_shell_v6_view, "Failed to allocate view")) {		return;	}	view_init(&xdg_shell_v6_view->view, SWAY_VIEW_XDG_SHELL_V6, &view_impl);	xdg_shell_v6_view->view.wlr_xdg_surface_v6 = xdg_surface;	xdg_shell_v6_view->map.notify = handle_map;	wl_signal_add(&xdg_surface->events.map, &xdg_shell_v6_view->map);	xdg_shell_v6_view->unmap.notify = handle_unmap;	wl_signal_add(&xdg_surface->events.unmap, &xdg_shell_v6_view->unmap);	xdg_shell_v6_view->destroy.notify = handle_destroy;	wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_v6_view->destroy);	xdg_surface->data = xdg_shell_v6_view;}
开发者ID:thejan2009,项目名称:sway,代码行数:32,


示例4: load_config

bool load_config(const char *file) {	input_init();	char *path;	if (file != NULL) {		path = strdup(file);	} else {		path = get_config_path();	}	sway_log(L_INFO, "Loading config from %s", path);	if (path == NULL) {		sway_log(L_ERROR, "Unable to find a config file!");		return false;	}	FILE *f = fopen(path, "r");	if (!f) {		fprintf(stderr, "Unable to open %s for reading", path);		free(path);		return false;	}	free(path);	bool config_load_success;	if (config) {		config_load_success = read_config(f, true);	} else {		config_load_success = read_config(f, false);	}	fclose(f);	return config_load_success;}
开发者ID:solarce,项目名称:sway,代码行数:35,


示例5: swaynag_log

void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,		const char *fmt, ...) {	if (!swaynag_command) {		return;	}	if (!swaynag->detailed) {		sway_log(SWAY_ERROR, "Attempting to write to non-detailed swaynag inst");		return;	}	if (swaynag->pid <= 0 && !swaynag_spawn(swaynag_command, swaynag)) {		return;	}	va_list args;	va_start(args, fmt);	size_t length = vsnprintf(NULL, 0, fmt, args) + 1;	va_end(args);	char *temp = malloc(length + 1);	if (!temp) {		sway_log(SWAY_ERROR, "Failed to allocate buffer for swaynag log entry.");		return;	}	va_start(args, fmt);	vsnprintf(temp, length, fmt, args);	va_end(args);	write(swaynag->fd[1], temp, length);	free(temp);}
开发者ID:thejan2009,项目名称:sway,代码行数:34,


示例6: libinput_device_get_id_vendor

char *libinput_dev_unique_id(struct libinput_device *device) {	int vendor = libinput_device_get_id_vendor(device);	int product = libinput_device_get_id_product(device);	char *name = strdup(libinput_device_get_name(device));	char *p = name;	for (; *p; ++p) {		if (*p == ' ') {			*p = '_';		}	}	sway_log(L_DEBUG, "rewritten name %s", name);	int len = strlen(name) + sizeof(char) * 6;	char *identifier = malloc(len);	if (!identifier) {		sway_log(L_ERROR, "Unable to allocate unique input device name");		return NULL;	}	const char *fmt = "%d:%d:%s";	snprintf(identifier, len, fmt, vendor, product, name);	free(name);	return identifier;}
开发者ID:Hummer12007,项目名称:sway,代码行数:26,


示例7: calloc

struct input_config *new_input_config(const char* identifier) {	struct input_config *input = calloc(1, sizeof(struct input_config));	if (!input) {		sway_log(L_DEBUG, "Unable to allocate input config");		return NULL;	}	sway_log(L_DEBUG, "new_input_config(%s)", identifier);	if (!(input->identifier = strdup(identifier))) {		free(input);		sway_log(L_DEBUG, "Unable to allocate input config");		return NULL;	}	input->tap = INT_MIN;	input->drag_lock = INT_MIN;	input->dwt = INT_MIN;	input->send_events = INT_MIN;	input->click_method = INT_MIN;	input->middle_emulation = INT_MIN;	input->natural_scroll = INT_MIN;	input->accel_profile = INT_MIN;	input->pointer_accel = FLT_MIN;	input->scroll_method = INT_MIN;	input->left_handed = INT_MIN;	return input;}
开发者ID:Hummer12007,项目名称:sway,代码行数:27,


示例8: load_config

static bool load_config(const char *path, struct sway_config *config) {	sway_log(L_INFO, "Loading config from %s", path);	current_config_path = path;	struct stat sb;	if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {		return false;	}	if (path == NULL) {		sway_log(L_ERROR, "Unable to find a config file!");		return false;	}	FILE *f = fopen(path, "r");	if (!f) {		sway_log(L_ERROR, "Unable to open %s for reading", path);		return false;	}	bool config_load_success = read_config(f, config);	fclose(f);	if (!config_load_success) {		sway_log(L_ERROR, "Error(s) loading config!");	}	current_config_path = NULL;	return true;}
开发者ID:sleep-walker,项目名称:sway,代码行数:30,


示例9: read_config

bool read_config(FILE *file, bool is_active) {	struct sway_config *temp_config = malloc(sizeof(struct sway_config));	config_defaults(temp_config);	if (is_active) {		sway_log(L_DEBUG, "Performing configuration file reload");		temp_config->reloading = true;		temp_config->active = true;	}	bool success = true;	int temp_depth = 0; // Temporary: skip all config sections with depth	while (!feof(file)) {		int _;		char *line = read_line(file);		line = strip_whitespace(line, &_);		line = strip_comments(line);		if (!line[0]) {			goto _continue;		}		if (temp_depth && line[0] == '}') {			temp_depth--;			goto _continue;		}		// Any command which would require wlc to be initialized		// should be queued for later execution		list_t *args = split_string(line, " ");		if (!is_active && (			strcmp("exec", args->items[0]) == 0 ||			strcmp("exec_always", args->items[0]) == 0 )) {			sway_log(L_DEBUG, "Deferring command %s", line);			char *cmd = malloc(strlen(line) + 1);			strcpy(cmd, line);			list_add(temp_config->cmd_queue, cmd);		} else if (!temp_depth && !handle_command(temp_config, line)) {			sway_log(L_DEBUG, "Config load failed for line %s", line);			success = false;			temp_config->failed = true;		}		list_free(args);_continue:		if (line && line[strlen(line) - 1] == '{') {			temp_depth++;		}		free(line);	}	if (is_active) {		temp_config->reloading = false;		container_map(&root_container, reset_gaps, NULL);		arrange_windows(&root_container, -1, -1);	}	config = temp_config;	return success;}
开发者ID:ffa7a7,项目名称:sway,代码行数:60,


示例10: handle_pointer_button

static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers,		uint32_t button, enum wlc_button_state state) {	swayc_t *focused = get_focused_container(&root_container);	if (state == WLC_BUTTON_STATE_PRESSED) {		sway_log(L_DEBUG, "Mouse button %u pressed", button);		if (button == 272) {			m1_held = true;		}		if (button == 273) {			m2_held = true;		}		swayc_t *pointer = container_under_pointer();		set_focused_container(pointer);		return (pointer && pointer != focused);	} else {		sway_log(L_DEBUG, "Mouse button %u released", button);		if (button == 272) {			m1_held = false;		}		if (button == 273) {			m2_held = false;		}	}	return false;}
开发者ID:shaunstanislaus,项目名称:sway,代码行数:25,


示例11: ipc_client_handle_readable

int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {	struct ipc_client *client = data;	if (mask & WLC_EVENT_ERROR) {		sway_log(L_INFO, "IPC Client socket error, removing client");		client->fd = -1;		ipc_client_disconnect(client);		return 0;	}	if (mask & WLC_EVENT_HANGUP) {		client->fd = -1;		ipc_client_disconnect(client);		return 0;	}	int read_available;	if (ioctl(client_fd, FIONREAD, &read_available) == -1) {		sway_log_errno(L_INFO, "Unable to read IPC socket buffer size");		ipc_client_disconnect(client);		return 0;	}	// Wait for the rest of the command payload in case the header has already been read	if (client->payload_length > 0) {		if ((uint32_t)read_available >= client->payload_length) {			ipc_client_handle_command(client);		}		return 0;	}	if (read_available < ipc_header_size) {		return 0;	}	uint8_t buf[ipc_header_size];	uint32_t *buf32 = (uint32_t*)(buf + sizeof(ipc_magic));	ssize_t received = recv(client_fd, buf, ipc_header_size, 0);	if (received == -1) {		sway_log_errno(L_INFO, "Unable to receive header from IPC client");		ipc_client_disconnect(client);		return 0;	}	if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) {		sway_log(L_DEBUG, "IPC header check failed");		ipc_client_disconnect(client);		return 0;	}	client->payload_length = buf32[0];	client->current_command = (enum ipc_command_type)buf32[1];	if (read_available - received >= (long)client->payload_length) {		ipc_client_handle_command(client);	}	return 0;}
开发者ID:SirCmpwn,项目名称:sway,代码行数:59,


示例12: sway_log

char *workspace_next_name(void) {	sway_log(L_DEBUG, "Workspace: Generating new name");	int i;	int l = 1;	// Scan all workspace bindings to find the next available workspace name,	// if none are found/available then default to a number	struct sway_mode *mode = config->current_mode;	for (i = 0; i < mode->bindings->length; ++i) {		struct sway_binding *binding = mode->bindings->items[i];		const char* command = binding->command;		list_t *args = split_string(command, " ");		if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) {			sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", (char *)args->items[1]);			char* target = malloc(strlen(args->items[1]) + 1);			strcpy(target, args->items[1]);			while (*target == ' ' || *target == '/t')				target++;			// Make sure that the command references an actual workspace			// not a command about workspaces			if (strcmp(target, "next") == 0 ||				strcmp(target, "prev") == 0 ||				strcmp(target, "next_on_output") == 0 ||				strcmp(target, "prev_on_output") == 0 ||				strcmp(target, "number") == 0 ||				strcmp(target, "back_and_forth") == 0 ||				strcmp(target, "current") == 0)			{				free_flat_list(args);				continue;			}			// Make sure that the workspace doesn't already exist			if (workspace_by_name(target)) {				free_flat_list(args);				continue;			}			free_flat_list(args);			sway_log(L_DEBUG, "Workspace: Found free name %s", target);			return target;		}		free_flat_list(args);	}	// As a fall back, get the current number of active workspaces	// and return that + 1 for the next workspace's name	int ws_num = root_container.children->length;	if (ws_num >= 10) {		l = 2;	} else if (ws_num >= 100) {		l = 3;	}	char *name = malloc(l + 1);	sprintf(name, "%d", ws_num++);	return name;}
开发者ID:Luminarys,项目名称:sway,代码行数:59,


示例13: wlc_log_handler

static void wlc_log_handler(enum wlc_log_type type, const char *str) {	if (type == WLC_LOG_ERROR) {		sway_log(L_ERROR, "[wlc] %s", str);	} else if (type == WLC_LOG_WARN) {		sway_log(L_INFO, "[wlc] %s", str);	} else {		sway_log(L_DEBUG, "[wlc] %s", str);	}}
开发者ID:Luminarys,项目名称:sway,代码行数:9,


示例14: bar_run

void bar_run(struct bar *bar) {	int pfds = bar->outputs->length + 2;	struct pollfd *pfd = malloc(pfds * sizeof(struct pollfd));	bool dirty = true;	pfd[0].fd = bar->ipc_event_socketfd;	pfd[0].events = POLLIN;	pfd[1].fd = bar->status_read_fd;	pfd[1].events = POLLIN;	int i;	for (i = 0; i < bar->outputs->length; ++i) {		struct output *output = bar->outputs->items[i];		pfd[i+2].fd = wl_display_get_fd(output->registry->display);		pfd[i+2].events = POLLIN;	}	while (1) {		if (dirty) {			int i;			for (i = 0; i < bar->outputs->length; ++i) {				struct output *output = bar->outputs->items[i];				if (window_prerender(output->window) && output->window->cairo) {					render(output, bar->config, bar->status);					window_render(output->window);					wl_display_flush(output->registry->display);				}			}		}		dirty = false;		poll(pfd, pfds, -1);		if (pfd[0].revents & POLLIN) {			sway_log(L_DEBUG, "Got IPC event.");			dirty = handle_ipc_event(bar);		}		if (bar->config->status_command && pfd[1].revents & POLLIN) {			sway_log(L_DEBUG, "Got update from status command.");			dirty = handle_status_line(bar);		}		// dispatch wl_display events		for (i = 0; i < bar->outputs->length; ++i) {			struct output *output = bar->outputs->items[i];			if (pfd[i+2].revents & POLLIN) {				if (wl_display_dispatch(output->registry->display) == -1) {					sway_log(L_ERROR, "failed to dispatch wl: %d", errno);				}			} else {				wl_display_dispatch_pending(output->registry->display);			}		}	}}
开发者ID:dardevelin,项目名称:sway,代码行数:57,


示例15: arrange_workspace

void arrange_workspace(struct sway_workspace *workspace) {	if (config->reloading) {		return;	}	if (!workspace->output) {		// Happens when there are no outputs connected		return;	}	struct sway_output *output = workspace->output;	struct wlr_box *area = &output->usable_area;	sway_log(SWAY_DEBUG, "Usable area for ws: %dx%[email
C++ sweepwholelist函数代码示例
C++ swaps函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。