Reputation: 75
I have this simple code that draws a small window using X11:
int main(int, char*[])
{
Display* display = XOpenDisplay(NULL);
Window window = XCreateSimpleWindow(
display, XDefaultRootWindow(display),
100, 100, 200, 200, 4, 0, 0);
XEvent event;
XMapWindow(display, window);
XSelectInput(display, window, KeyPressMask | ButtonPressMask | ExposureMask);
while (True) {
XNextEvent(display, &event);
}
return 0;
}
Everything works fine, the window is drawn without problems.
The thing is I really want to understand how X11 works so I'm reading the source code of the headers but I'm unable to find the definition for XMapWindow()
- I need help.
This was the only similutede I could find in the Xlib.h
header file.
extern int XMapWindow(
Display* /* display */,
Window /* w */
);
Upvotes: 0
Views: 150
Reputation: 236
You can find the implementation of XMapWindow()
in the libX11 sources, specifically in src/MapWindow.c:XMapWindow().
It boils down to some locking, and a _XGetRequest(dpy, X_MapWindow, SIZEOF(xResourceReq))
call. That is defined in src/XlibInt.c:_XGetRequest(), and as you can guess by the name, adds the X_MapWindow request to the request queue sent to the X server.
How the X server (which manages the actual display) acts on that, is up to that X server implementation.
Upvotes: 1