wayland helloworld (二) 之Wayland鼠标消息
来源:互联网 发布:人工智能利大于弊 编辑:程序博客网 时间:2024/05/01 08:50
Wayland鼠标消息
Wayland只提供了wl_pointer_listener,要想获取鼠标相关的消息需要首先设置监听器。
wl_pointer的消息有:
enter 进入窗口范围
leave 离开窗口范围
motion 鼠标移动
button 鼠标点击,鼠标按键id定义位于文件<linux/input.h>中,例如BTN_LEFT表示鼠标左键。
初始化wl_pointer_listener对象:
void pointer_enter(void *data, HPOINTER wl_pointer, uint32_t serial, HSURFACE surface, wl_fixed_t surface_x, wl_fixed_t surface_y){wlGetRegistry()->s_pointer_surface = surface;}void pointer_leave(void *data, HPOINTER wl_pointer, uint32_t serial, HSURFACE surface){wlGetRegistry()->s_pointer_surface = NULL;}void pointer_motion(void *data, HPOINTER wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y){}void pointer_button(void *data, HPOINTER wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state){if (wlGetRegistry()->s_pointer_surface == NULL)return;if (BTN_LEFT == button && state == WL_POINTER_BUTTON_STATE_PRESSED){HSHELLSURFACE shell_surface = _wlGetSurfacePrivate(wlGetRegistry()->s_pointer_surface)->shell_surface;wl_shell_surface_move(shell_surface, wlGetRegistry()->s_seat, serial);return;}}void pointer_axis(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value){}struct wl_pointer_listener pointer_listener = {.enter = pointer_enter,.leave = pointer_leave,.motion = pointer_motion,.button = pointer_button,.axis = pointer_axis};
0 0
- wayland helloworld (二) 之Wayland鼠标消息
- Wayland helloworld (三)之Wayland键盘消息
- Wayland helloworld (四)之窗口显示
- wayland helloworld (一)
- Wayland消息队列
- Wayland(2):Wayland应运而生
- 揭开Wayland的面纱(二):Wayland应运而生
- 揭开Wayland的面纱(二):Wayland应运而生
- 关于Wayland
- Wayland Install
- Wayland是什么
- wayland 编译
- 什么是Wayland
- Wayland 简介
- Wayland 架构
- 关于Wayland
- wayland 介绍
- wayland&weston
- 2014百度之星第二题Disk Schedule(双调欧几里得旅行商问题+DP)
- http://acm.hdu.edu.cn/showproblem.php?pid=3336
- 简单的JTML+JS验证用户名、电话号码格式_JS自定义function_正则表达式
- 命令与文件的搜寻
- 喝白玉堂冬瓜荷叶茶找回苗条漂亮的自己
- wayland helloworld (二) 之Wayland鼠标消息
- jquery datatable 参数
- 【TED演讲】邦克·罗伊:从赤脚运动中学习
- 屏幕输出VS文件输出
- Block(1)
- C语言的细节问题
- 弥补空缺!HappyFox面向iOS开发者发布开源移动HelpDesk SDK
- Android小游戏应用---撕破美女衣服游戏
- 我2014年的任务