zzxyb / wsm Goto Github PK
View Code? Open in Web Editor NEWlychee wayland surface manager for pc and mobile devices
License: MIT License
lychee wayland surface manager for pc and mobile devices
License: MIT License
The following two issues need to be fixed:
Supports multiple animation curves、custom post-processing on the animation line,wlr_scene_node or display nodes based on it.
ref:https://github.com/zzxyb/wsm/blob/master/effects/wsm_effect.h
Use LINUX Signals instead of dbus to notify another process that wsm is ready,maybe SIGUSR1
the return is as follows:
poll demo:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <poll.h>
#include <errno.h>
#include <string.h>
#define SOCKET_PATH "/run/user/1000/wayland-0"
#define TIMEOUT 5000 // 超时时间,单位为毫秒
int main() {
int sockfd;
struct sockaddr_un addr;
struct pollfd pfd;
int ret;
// 创建 Unix 域套接字
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd == -1) {
perror("socket");
exit(EXIT_FAILURE);
}
// 配置套接字地址
memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SOCKET_PATH, sizeof(addr.sun_path) - 1);
// 非阻塞模式
int flags = fcntl(sockfd, F_GETFL, 0);
fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
// 尝试连接 Wayland 套接字
ret = connect(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un));
if (ret == -1 && errno != EINPROGRESS) {
perror("connect");
close(sockfd);
exit(EXIT_FAILURE);
}
// 设置 poll 结构体
pfd.fd = sockfd;
pfd.events = POLLOUT;
// 轮询 Wayland 套接字
ret = poll(&pfd, 1, TIMEOUT);
if (ret == -1) {
perror("poll");
close(sockfd);
exit(EXIT_FAILURE);
} else if (ret == 0) {
printf("Timeout occurred! Wayland socket is not ready.\n");
close(sockfd);
exit(EXIT_FAILURE);
} else {
if (pfd.revents & POLLOUT) {
printf("Wayland socket is ready for connection.\n");
} else {
printf("Wayland socket is not ready, unexpected event: %d\n", pfd.revents);
}
}
// 关闭套接字
close(sockfd);
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.