就像主题的主题说的那样:
感谢阅读,帮助反馈
关注[YouTube]: Future Tech Labs - X11 Tutorials - 1 - Creating a Simple Window 教程,并提出了以下(虚拟)示例。
main00.c:
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main()
{
Display *pd = NULL;
if ((pd = XOpenDisplay((char*)NULL)) == NULL) {
printf("XOpenDisplay error\n");
return -1;
}
int scr = DefaultScreen(pd);
Window win = XCreateSimpleWindow(pd, RootWindow(pd, scr),
100, 100, 320, 200, 15, BlackPixel(pd, scr), WhitePixel(pd, scr));
XSetStandardProperties(pd, win, "Cygwin X q075977479", "q075977479", None, NULL, 0, NULL);
XMapWindow(pd, win);
XEvent ev;
while (XNextEvent(pd, &ev) == 0) {
}
XUnmapWindow(pd, win);
XDestroyWindow(pd, win);
XCloseDisplay(pd);
printf("\nDone.\n\n");
return 0;
}
输出:
[cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackExchange/StackOverflow/q075977479]> ~/sopr.sh ### Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ### [064bit prompt]> uname -a CYGWIN_NT-10.0-19045 cfati-5510-0 3.4.6-1.x86_64 2023-02-14 13:23 UTC x86_64 Cygwin [064bit prompt]> ls main00.c [064bit prompt]> gcc main00.c -o main00.exe -lX11 [064bit prompt]> ls main00.c main00.exe [064bit prompt]> DISPLAY=:0 ./main00.exe
还有窗户:
可能还想检查:
[X]:Xlib - C 语言 X 接口 - X API
[Cygwin]:第 3 章。使用 Cygwin/X - Cygwin 细节