Search code examples
c++x11xlib

Is Display unique for every window in X11?


I'm a beginner to X11, i created a class just to create,show and destroy the window. In the Constructor i create variables for Window,Display etc, But do i need to create Display for every Window o create or shall i use the same Display for all windows?



class Widget
{
public:
Widget();
void createWidget(int x,int y,int w,int h);
void showWidget();
void destroyWidget();

private:
Display *disp;
int screenNumber;
unsigned long white;
unsigned long black;
Window win;
XEvent evt;
long eventMask;
};


Solution

  • That depends on where you want to create the window. If it is on the same system - same GPU, then yes, you can use the same Display.