如何通过Xlib观察连接的监视器中的变化? [英] How to observe changes in connected monitors via Xlib?

查看:101
本文介绍了如何通过Xlib观察连接的监视器中的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个程序,该程序将检测插入的外部监视器,并通过Xlib自动启用和配置它们.我知道有XRandr扩展名允许这样做.我的问题是,如何启用向应用程序接收XRandr事件?我应该使用哪个事件掩码?我知道xev应用程序可以做到这一点.

I'm trying to write a program that would detect external monitors being plugged in and automatically enable and configure them through Xlib. I know that there is XRandr extension that allows this. My question is, how do I enable receiving XRandr events to my application? What event mask should I use? I know that xev app is able to do this.

推荐答案

Xev的源代码:

或者:

  • git clone git://anongit.freedesktop.org/xorg/app/xev

这篇关于如何通过Xlib观察连接的监视器中的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆