[linux][c++]linux c++ 通过xcb库获取屏幕大小
linux c++ 通过xcb库获取屏幕大小
#include <stdio.h>
#include <xcb/xcb.h>
/**
clang++ main.cpp -o main `pkg-config --cflags --libs xcb` -lxcb-randr landv@win7-pc:~/Desktop$ ./main Informations of screen 416:
width.........: 1920
height........: 1080
white pixel...: 16777215
black pixel...: 0 */
int main (){
/* Open the connection to the X server. Use the DISPLAY environment variable */ int i, screenNum;
xcb_connection_t *connection = xcb_connect (NULL, &screenNum); /* Get the screen whose number is screenNum */
const xcb_setup_t *setup = xcb_get_setup (connection);
xcb_screen_iterator_t iter = xcb_setup_roots_iterator (setup); // we want the screen at index screenNum of the iterator
for (i = ; i < screenNum; ++i) {
xcb_screen_next (&iter);
} xcb_screen_t *screen = iter.data; /* report */
printf ("\n");
printf ("Informations of screen %u:\n", screen->root);
printf (" width.........: %d\n", screen->width_in_pixels);
printf (" height........: %d\n", screen->height_in_pixels);
printf (" white pixel...: %u\n", screen->white_pixel);
printf (" black pixel...: %u\n", screen->black_pixel);
printf ("\n"); return ;
}
[linux][c++]linux c++ 通过xcb库获取屏幕大小的更多相关文章
- js获取屏幕大小
1.js获取屏幕大小 <html> <script> function a(){ document.write( "屏幕分辨率为:"+screen.widt ...
- 转:VC++获取屏幕大小第一篇 像素大小GetSystemMetrics
VC++获取屏幕大小第一篇 像素大小 GetSystemMetrics>和<VC++获取屏幕大小第二篇物理大小GetDeviceCaps 上>和<VC++获取屏幕大小第三篇物理 ...
- wift - 使用UIScreen类获取屏幕大小尺寸
UISreen类代表了屏幕,开发中一般用来获取屏幕相关的属性,例如获取屏幕的大小. 1 2 3 4 5 6 7 //获取屏幕大小 var screenBounds:CGRect = UIScreen. ...
- Android 获取屏幕大小和密度
Android 获取屏幕大小和密度 DisplayMetrics metric = new DisplayMetrics(); getWindowManager().getDefaultDisplay ...
- cocos2d-x JS 获取屏幕大小或中点
以一张背景图为例: var HelloWorldLayer = cc.Layer.extend({ ctor:function () { this._super(); var bg = new cc. ...
- Android获取屏幕大小和设置无标题栏
android获取屏幕大小非常常用,例如写个程序,如果要做成通用性很强的程序,适用屏幕很强,一般布局的时候都是根据屏幕的长宽来定义的,所以我把这个总结一下,方便日后忘记的时候查阅.还有就是有时候写程序 ...
- 绘制bitmap 全屏 安卓获取 屏幕大小
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 绘制bitmap 全屏 Rectf rectF = new RectF(0, 0, w, ...
- C#获取屏幕大小或任务栏大小
C#获取屏幕大小或任务栏大小http://www.cnblogs.com/chlyzone/archive/2012/11/05/2754601.html
- Android获取屏幕大小
本来想着如下方法就能得到了 Display display = getWindowManager().getDefaultDisplay(); Log.i("view", &quo ...
随机推荐
- 用友U9 UFSoft.UBF.Business.Session
Session的概念 在现在UBF中,Session的本意是work unit,即持久层的一个边界,非常轻,主要用作批量提交,并标识这次批量提交的边界,不涉及到事务等概念. 当前ISession可以通 ...
- 记vs2017编辑launchSettings.json中launchUrl错误
当编辑launchSettings.json中launchUrl后,api访问出错,Swagger页面不能使用. 解决方法:将项目根目录下.vs文件夹删除,然后重新生成,ok
- java基础 接口常量
/** * 接口当中也可以定义"成员变量", 但是必须使用public static final三个关键字进行修饰 * 从效果上看,这其实就是接口的[常用] * 格式: * pub ...
- Javascript PC Emulator
Javascript PC Emulator https://bellard.org/jslinux/ JSLinux Run Linux or other Operating Systems in ...
- 内网漫游之SOCKS代理大结局
0×01 引言 在实际渗透过程中,我们成功入侵了目标服务器.接着我们想在本机上通过浏览器或者其他客户端软件访问目标机器内部网络中所开放的端口,比如内网的3389端口.内网网站8080端口等等.传统的方 ...
- Middle English finaunce金融
Etymology finance From Middle English finaunce, a surety bond.A supply of money or goods. With thy b ...
- CSS 基础样式
文本 p{ font-family:Cambria, "Hoefler Text", "Liberation Serif", Times, "Time ...
- PHP公众号开发给用户发微信消息提醒功能
最近做的一个项目,当有用户有资金到账或者成员变动时需要给他发一条微信消息提示.针对这个,开始想使用模板消息,但是刚注册的公众号申请消息模板需要几天时间申请,在时间不足下选择了使用客服消息接口,微信文档 ...
- sqlite3 FTS全文索引按照相关性排序
PS.后来发现,以下代码并不准确.请大家不要试了. -------以下是原内容------------------------------------------------------------- ...
- echarts地图 绘制部分上海市公交线路数据
源代码地址 https://github.com/a1115040996/MyHTML/blob/gh-pages/echarts/roadMap.html 预览地址 https://a1115040 ...