Question

Due to XIM and XFT usage, I have to use XDisplay sometimes in my XCB based code.

My question, should I open display at the beginning of my program, and close it at end. Or open and close every time I need to use it?

Was it helpful?

Solution

It is better to open once the XDisplay. At least that is the common practice.

IIRC, XOpenDisplay involves setting up a TCP connect to the X11 server and having a few exchanges to initialize, e.g. for X11 atoms which became standard but not predefined (I'm not sure of the last point)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top