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库获取屏幕大小的更多相关文章

  1. js获取屏幕大小

    1.js获取屏幕大小 <html> <script> function a(){ document.write( "屏幕分辨率为:"+screen.widt ...

  2. 转:VC++获取屏幕大小第一篇 像素大小GetSystemMetrics

    VC++获取屏幕大小第一篇 像素大小 GetSystemMetrics>和<VC++获取屏幕大小第二篇物理大小GetDeviceCaps 上>和<VC++获取屏幕大小第三篇物理 ...

  3. wift - 使用UIScreen类获取屏幕大小尺寸

    UISreen类代表了屏幕,开发中一般用来获取屏幕相关的属性,例如获取屏幕的大小. 1 2 3 4 5 6 7 //获取屏幕大小 var screenBounds:CGRect = UIScreen. ...

  4. Android 获取屏幕大小和密度

    Android 获取屏幕大小和密度 DisplayMetrics metric = new DisplayMetrics(); getWindowManager().getDefaultDisplay ...

  5. cocos2d-x JS 获取屏幕大小或中点

    以一张背景图为例: var HelloWorldLayer = cc.Layer.extend({ ctor:function () { this._super(); var bg = new cc. ...

  6. Android获取屏幕大小和设置无标题栏

    android获取屏幕大小非常常用,例如写个程序,如果要做成通用性很强的程序,适用屏幕很强,一般布局的时候都是根据屏幕的长宽来定义的,所以我把这个总结一下,方便日后忘记的时候查阅.还有就是有时候写程序 ...

  7. 绘制bitmap 全屏 安卓获取 屏幕大小

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 绘制bitmap 全屏 Rectf rectF = new RectF(0, 0, w, ...

  8. C#获取屏幕大小或任务栏大小

    C#获取屏幕大小或任务栏大小http://www.cnblogs.com/chlyzone/archive/2012/11/05/2754601.html

  9. Android获取屏幕大小

    本来想着如下方法就能得到了 Display display = getWindowManager().getDefaultDisplay(); Log.i("view", &quo ...

随机推荐

  1. JavaScript由来

    在互联网时代,网速还很差劲的时候,表单输入数据的合法性验证需要与服务器交换数据,从而加重了使用者的负担. 网景公司为了解决这种简单问题开发了JavaScript.在1995年2月网景公司在发布自己的浏 ...

  2. java基础 接口常量

    /** * 接口当中也可以定义"成员变量", 但是必须使用public static final三个关键字进行修饰 * 从效果上看,这其实就是接口的[常用] * 格式: * pub ...

  3. ffmpeg命令参数详解

    ffmpeg命令参数详解 http://linux.51yip.com/search/ffmpeg ffmpeg图片加滤镜效果 参考:https://cloud.tencent.com/develop ...

  4. ASP.NET Core 配置文件

    在ASP.NET Core 中,应用程序配置数据可以使用JSON, XML 和 INI格式 和内置环境变量,命令行参数或内存中的集合. 1.如何获取和设置配置 ASP.NET Core配置系统针对以前 ...

  5. python爬虫User Agent用户代理

    UserAgent简介 UserAgent中文名为用户代理,是Http协议中的一部分,属于头域的组成部分,UserAgent也简称UA.它是一个特殊字符串头,是一种向访问网站提供你所使用的浏览器类型及 ...

  6. Javascript/js 的浅拷贝与深拷贝(复制)学习随笔

    js变量的数据类型值分基本类型值和引用类型值. 在ES6(ECMAScript6)以前,基本数据类型包括String.Number.Boolean.Undefined.Null. 基本类型值的复制(拷 ...

  7. NumPy 之 存储文件和线性代数

    import numpy as np File Input and Output NumPy is able to save and load data to and from disk either ...

  8. Golang: 读写之外的其他文件操作

    在上一篇文章中,我们介绍了常用的文件读写操作,今天接着来研究一下,除了读写以外的其他常见文件操作. 一.创建目录: package main import ( "fmt" &quo ...

  9. swipe滑动操作

    1.swipe() 滑动用法 swipe(self, start_x, start_y, end_x, end_y, duration=None) :Args: - start_x - 开始滑动的x坐 ...

  10. Odoo中的Widget

    转载请注明原文地址:https://www.cnblogs.com/ygj0930/p/10826144.html 一:Widget是什么 Odoo中定义了字段的显示形式,不同字段类型的字段都有其不同 ...