c - 如何在 mac 上使用 libxcb?
问题描述
我的笔记本电脑是 Macbook Pro。我在上面安装了 libxcb 并尝试了 x.org 给出的一个简单示例:
#include <unistd.h> /* pause() */
#include <xcb/xcb.h>
int main ()
{
xcb_connection_t *c;
xcb_screen_t *screen;
xcb_window_t win;
/* Open the connection to the X server */
c = xcb_connect (NULL, NULL);
/* Get the first screen */
screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
/* Ask for our window's Id */
win = xcb_generate_id(c);
/* Create the window */
xcb_create_window (c, /* Connection */
XCB_COPY_FROM_PARENT, /* depth (same as root)*/
win, /* window Id */
screen->root, /* parent window */
0, 0, /* x, y */
150, 150, /* width, height */
10, /* border_width */
XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */
screen->root_visual, /* visual */
0, NULL); /* masks, not used yet */
/* Map the window on the screen */
xcb_map_window (c, win);
/* Make sure commands are sent before we pause, so window is shown */
xcb_flush (c);
pause (); /* hold client until Ctrl-C */
return 0;
}
但是屏幕上没有显示窗口。有什么我忘记了吗?
解决方案
推荐阅读
- flutter - 防止flutter_admod横幅重新加载
- python - StratifiedKFold 拆分训练和验证集大小
- matlab - 将 2000x3 十进制矩阵 .txt 文件转换为二进制 2000x3 .txt 文件
- c# - 未使用 AzureTokenServiceProvider 进行身份验证
- python - 尝试通过 pip 安装 pycrypto 时出现非常混乱的错误
- laravel - 如何将自定义事件添加到 Laravel 模型
- php - SQL 缓存表布局 - UPDATE / INSERT 性能
- php - MySql 通过 Ultimate Member Plugin 查询散列密码?
- laravel - 如何在 laravel 上限制特定用户的路由
- c# - 在使用 ASP.NET Core 3.0 首次加载之前,通过授权服务器保护 SPA 的正确方法是什么?