Wayland入门11:shell unstable协议
上一篇介绍的是stable版的协议,本文介绍unstable版的协议。
窗口部分是一样的。
我们使用新协议的对象
struct zxdg_shell_v6 *xdg_shell;
struct zxdg_surface_v6 *shell_surface;
struct zxdg_toplevel_v6 *toplevel;
创建新对象
shell_surface = zxdg_shell_v6_get_xdg_surface(xdg_shell, surface);
if (shell_surface == NULL)
{fprintf(stderr, "Can't create shell surface\n");exit(1);
}
else
{fprintf(stderr, "Created shell surface\n");
}
toplevel = zxdg_surface_v6_get_toplevel(shell_surface);
zxdg_surface_v6_add_listener(shell_surface,&surface_listener,NULL);
需要监听新的注册事件
static void
global_registry_handler(void *data, struct wl_registry *registry,uint32_t id, const char *interface, uint32_t version)
{if (strcmp(interface, "wl_compositor") == 0){BIND_WL_REG(registry, compositor, id, &wl_compositor_interface, 1);}else if (strcmp(interface, zxdg_shell_v6_interface.name) == 0){BIND_WL_REG(registry, xdg_shell, id, &zxdg_shell_v6_interface, 1);}else if (strcmp(interface, "wl_shm") == 0){BIND_WL_REG(registry, shm, id, &wl_shm_interface, 1);wl_shm_add_listener(shm, &shm_listener, NULL);}
}
窗口监听和处理
static void handle_configure(void *data, struct zxdg_surface_v6 *surface, uint32_t serial) {zxdg_surface_v6_ack_configure(surface, serial);
}static const struct zxdg_surface_v6_listener surface_listener = {.configure = handle_configure
};
编译
协议以xml格式提供,我们在使用时要把它生成为代码。
WAYLAND_FLAGS = $(shell pkg-config wayland-client --cflags --libs)
WAYLAND_PROTOCOLS_DIR = $(shell pkg-config wayland-protocols --variable=pkgdatadir)
WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner)XDG_SHELL_PROTOCOL = $(WAYLAND_PROTOCOLS_DIR)/unstable/xdg-shell/xdg-shell-unstable-v6.xmlHEADERS=xdg-shell-unstable-v6-protocol.h
SOURCES=xdg-shell-unstable-v6-protocol.call: $(HEADERS) $(SOURCES)gcc -o shell_unstable shell_unstable.c $(SOURCES) -I. -lwayland-client -lwayland-egl -lEGL -lGLxdg-shell-unstable-v6-protocol.h:$(WAYLAND_SCANNER) client-header $(XDG_SHELL_PROTOCOL) xdg-shell-unstable-v6-protocol.hxdg-shell-unstable-v6-protocol.c:$(WAYLAND_SCANNER) private-code $(XDG_SHELL_PROTOCOL) xdg-shell-unstable-v6-protocol.cclean:rm -rf shell_stable $(HEADERS) $(SOURCES)
理论上显示效果和之前的窗口一样。但是我编译成功了,没有运行成功。
EGL版本只是替换了窗口显示部分,其他的代码一样。
完整代码在Wayland_Frashman中的11.shell_unstable、11.shell_unstable_EGL下。
本文首发于:Wayland入门11:shell unstable协议
Wayland入门11:shell unstable协议相关推荐
- 脑残式网络编程入门(三):HTTP协议必知必会的一些知识
为什么80%的码农都做不了架构师?>>> 本文原作者:"竹千代",原文由"玉刚说"写作平台提供写作赞助,原文版权归"玉刚说&q ...
- GPS 入门 4 —— GPS NMEA-0183协议 [转]
GPS 入门 4 -- GPS NMEA-0183协议 [转] (2008-10-11 18:42:39) <script> var $tag='gps,nmea-0183协议,超级终端, ...
- Objective-C 入门(七)协议 protocol(JAVA中的接口)
Objective-C 入门(七)协议 protocol(JAVA中的接口) 接口的作用想必大家都比较了解 OV中的 protocol 相比接口作用相似 语法稍有不同 1.先来看声明一个协议 在创建文 ...
- Cesium入门11 - Interactivity - 交互性
Cesium入门11 - Interactivity - 交互性 Cesium中文网:http://cesiumcn.org/ | 国内快速访问:http://cesium.coinidea.com/ ...
- IEEE 802.11 RTS/CTS 协议
IEEE 802.11 RTS/CTS即RTS/CTS协议(Request To Send/Clear To Send)即请求发送/清除发送协议是被802.11无线网络协议采用的一种用来减少由隐藏节点 ...
- 11种物联网协议简介,如WiFi、蓝牙、ZigBee、蜂窝等
一.背景 1.电子工程师和物联网(IoT)的产品和系统的应用程序开发人员都有一个几乎令人迷惑的连接选项.那就是自己的项目选用什么协议. 2.许多通信技术是众所周知的,如WiFi,蓝牙,ZigBee和2 ...
- Wayland入门15:键盘输入
上一篇介绍了鼠标的相关操作,本文介绍键盘的相关操作. 使用的是标准的键盘库xkb,官网为:https://www.xkbcommon.org/. 先把上一篇的鼠标操作的部分复制过来. 注册并绑定键盘相 ...
- Wayland入门12:输入设备管理器
在 Wayland入门8:获取全局对象 中我们介绍了Wayland全局对象: wl_display:表示与服务器的连接. wl_registry:全局对象注册表,全局对象需要通过它获取. wl_com ...
- 一天学会shell语言,shell教程,shell简单入门,shell中文文档
shell语言是一门linux系统下的工具语言,主要用于写一些linux系统下的操作命令,实际上Shell是一个命令解释器,它解释由用户输入的命令并且把它们送到内核.或者直接理解为shell命 ...
最新文章
- salt 基本组建之 grains,pillars(整理中)
- tf2.0环境下“module ‘tensorflow‘ has no attribute ‘log‘”的解决办法
- 配置 linux-bridge mechanism driver - 每天5分钟玩转 OpenStack(77)
- 超图空间数据模型概要1
- c++可视化开发_页面可视化配置搭建工具技术要点
- 我们计划招收300名学员,免费攻读人工智能专业!
- 通过ADB命令获取Android手机的分辨率(升级版)
- matlab画半球面,Matlab 绘制3D半球
- js cookie操作
- python3.8.0安装详细步骤_win10下python3.8的PIL库安装过程
- BP神经网络模型与学习算法
- 新手淘客你必须知道的秘密
- spring boot 邮箱验证总结
- AttributeError:partially initialized module ''has no attribute''(most likely dueto a circular import
- 阴阳师服务器维护3月25日,阴阳师3月25日更新内容-阴阳师3月25日更新内容介绍_牛游戏网...
- C语言:str函数(一)
- 【洛谷1337】[JSOI2004] 吊打XXX(模拟退火经典题)
- png图片怎么压缩大小又不损失画质?
- WordPress 自动为文章添加标签内链、文章自动添加标签
- Javafx+MySQL 学生成绩管理系统
热门文章
- Python3 colorama模块使用说明(使用colorama模块改变终端打印颜色)
- 中国计算机学会青年精英大会,中国计算机学会YOCSEF二十周年庆典暨2018 CCF青年精英大会召开...
- http://ec.iresearch.cn/reservation/20150327/248051.shtml#6634817-qzone-1-22915-3e7edfcacfa3df75b7a4b
- 爱飞行上线 机票预订市场的价格战触底
- 德国IT行业的工作机会首次大幅减少
- 低耦合,高内聚的详解
- 【设计模式自习室】透彻理解单例模式
- 基于JAVA校园面包超市系统计算机毕业设计源码+系统+数据库+lw文档+部署
- JavaScript基础--改变this指向的方法
- 诗经 - 小雅 - 湛露