[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 ...
随机推荐
- HTML 引用大全
路径logo <link rel="icon" href="../framework7-4.4.10/kitchen-sink/core/img/ztjs.png& ...
- 关于注解sql和动态sql的写法
注解写sql一般写在mapper层,如果sql语句复杂建议不要写注解sql 拼接容易出错 二动态sql的话要在 main 下面创建一个resource ——mapper—— Mapper.xml 再在 ...
- asp获取access数据库中的一条随机记录
针对“用一条SQL得到数据库中的随机记录集”问题在网上已经有很多答案了: SQL Server 2000: SELECT TOP n * FROM tanblename ORDER BY NEWID( ...
- springboot使用 @Transactional 注解配置事务管理
介绍 springboot对数据库事务的使用非常的方便,只需要在方法上添加@Transactional注解即可.Spring 为事务管理提供了丰富的功能支持.Spring 事务管理分为编程式和声明式的 ...
- 2019 263云通信java面试笔试题 (含面试题解析)
本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.263云通信等公司offer,岗位是Java后端开发,因为发展原因最终选择去了263云通信,入职一年时间了,也 ...
- vue组件6 使用vue添加样式
class绑定,内联样式 数组语法 :class="[stylename]" js:data{stylename:classname} 对象语法:class={stylena ...
- pandas 之 数据合并
import numpy as np import pandas as pd Data contained in pandas objects can be combined together in ...
- NGINX PHP 报错整理合集
NGINX PHP "No input file specified" 修改php.ini conf cgi.fix_pathinfo=1; 修改nginx.conf,中的fast ...
- js检测页面触底
<script> function getDocumentTop() { var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = ...
- jmeter 实现登录参数化
业务场景 在测试过程中,一般需要模拟不同的用户登录,这样压测的数据比较平均,也能更好的模拟真实的压力情况. 如果使用同一个用户账号进行测试,那么比如在查询代办的时候,此人的待办太多,也不符合实际的情况 ...