Make EGL and X11 dpy/evdpy usage consistent. EGL needs testing.
This commit is contained in:
parent
03dfe7b816
commit
1666e091ef
|
@ -25,7 +25,7 @@
|
||||||
// Show the current FPS
|
// Show the current FPS
|
||||||
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
|
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
|
||||||
{
|
{
|
||||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
XStoreName(GLWin.evdpy, GLWin.win, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cInterfaceGLX::SwapInterval(int Interval)
|
void cInterfaceGLX::SwapInterval(int Interval)
|
||||||
|
@ -136,7 +136,7 @@ bool cInterfaceGLX::MakeCurrent()
|
||||||
#if defined(HAVE_WX) && (HAVE_WX)
|
#if defined(HAVE_WX) && (HAVE_WX)
|
||||||
Host_GetRenderWindowSize(GLWin.x, GLWin.y,
|
Host_GetRenderWindowSize(GLWin.x, GLWin.y,
|
||||||
(int&)GLWin.width, (int&)GLWin.height);
|
(int&)GLWin.width, (int&)GLWin.height);
|
||||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y,
|
XMoveResizeWindow(GLWin.evdpy, GLWin.win, GLWin.x, GLWin.y,
|
||||||
GLWin.width, GLWin.height);
|
GLWin.width, GLWin.height);
|
||||||
#endif
|
#endif
|
||||||
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#if USE_EGL
|
#if USE_EGL
|
||||||
bool cXInterface::ServerConnect(void)
|
bool cXInterface::ServerConnect(void)
|
||||||
{
|
{
|
||||||
GLWin.evdpy = XOpenDisplay(NULL);
|
GLWin.dpy = XOpenDisplay(NULL);
|
||||||
|
|
||||||
if (!GLWin.evdpy)
|
if (!GLWin.dpy)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,7 +39,7 @@ bool cXInterface::Initialize(void *config)
|
||||||
int num_visuals;
|
int num_visuals;
|
||||||
EGLint vid;
|
EGLint vid;
|
||||||
|
|
||||||
if (!GLWin.evdpy) {
|
if (!GLWin.dpy) {
|
||||||
printf("Error: couldn't open X display\n");
|
printf("Error: couldn't open X display\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ bool cXInterface::Initialize(void *config)
|
||||||
|
|
||||||
/* The X window visual must match the EGL config */
|
/* The X window visual must match the EGL config */
|
||||||
visTemplate.visualid = vid;
|
visTemplate.visualid = vid;
|
||||||
GLWin.vi = XGetVisualInfo(GLWin.evdpy, VisualIDMask, &visTemplate, &num_visuals);
|
GLWin.vi = XGetVisualInfo(GLWin.dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||||
if (!GLWin.vi) {
|
if (!GLWin.vi) {
|
||||||
printf("Error: couldn't get X visual\n");
|
printf("Error: couldn't get X visual\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -64,12 +64,12 @@ bool cXInterface::Initialize(void *config)
|
||||||
GLWin.width = _twidth;
|
GLWin.width = _twidth;
|
||||||
GLWin.height = _theight;
|
GLWin.height = _theight;
|
||||||
|
|
||||||
GLWin.dpy = XOpenDisplay(NULL);
|
GLWin.evdpy = XOpenDisplay(NULL);
|
||||||
GLWin.parent = GLWin.win;
|
GLWin.parent = GLWin.win;
|
||||||
GLWin.screen = DefaultScreen(GLWin.evdpy);
|
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||||
|
|
||||||
if (GLWin.parent == 0)
|
if (GLWin.parent == 0)
|
||||||
GLWin.parent = RootWindow(GLWin.evdpy, GLWin.screen);
|
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||||
|
|
||||||
/* Set initial projection/viewing transformation.
|
/* Set initial projection/viewing transformation.
|
||||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||||
|
@ -82,7 +82,7 @@ bool cXInterface::Initialize(void *config)
|
||||||
|
|
||||||
void *cXInterface::EGLGetDisplay(void)
|
void *cXInterface::EGLGetDisplay(void)
|
||||||
{
|
{
|
||||||
return eglGetDisplay(GLWin.evdpy);
|
return eglGetDisplay(GLWin.dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *cXInterface::CreateWindow(void)
|
void *cXInterface::CreateWindow(void)
|
||||||
|
@ -90,22 +90,22 @@ void *cXInterface::CreateWindow(void)
|
||||||
Atom wmProtocols[1];
|
Atom wmProtocols[1];
|
||||||
|
|
||||||
// Setup window attributes
|
// Setup window attributes
|
||||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
GLWin.attr.colormap = XCreateColormap(GLWin.evdpy,
|
||||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
GLWin.parent, GLWin.vi->visual, AllocNone);
|
||||||
GLWin.attr.event_mask = KeyPressMask | StructureNotifyMask | FocusChangeMask;
|
GLWin.attr.event_mask = KeyPressMask | StructureNotifyMask | FocusChangeMask;
|
||||||
GLWin.attr.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
|
GLWin.attr.background_pixel = BlackPixel(GLWin.evdpy, GLWin.screen);
|
||||||
GLWin.attr.border_pixel = 0;
|
GLWin.attr.border_pixel = 0;
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
GLWin.win = XCreateWindow(GLWin.dpy, GLWin.parent,
|
GLWin.win = XCreateWindow(GLWin.evdpy, GLWin.parent,
|
||||||
GLWin.x, GLWin.y, GLWin.width, GLWin.height, 0,
|
GLWin.x, GLWin.y, GLWin.width, GLWin.height, 0,
|
||||||
GLWin.vi->depth, InputOutput, GLWin.vi->visual,
|
GLWin.vi->depth, InputOutput, GLWin.vi->visual,
|
||||||
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
|
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);
|
||||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1);
|
||||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||||
XMapRaised(GLWin.dpy, GLWin.win);
|
XMapRaised(GLWin.evdpy, GLWin.win);
|
||||||
XSync(GLWin.dpy, True);
|
XSync(GLWin.evdpy, True);
|
||||||
|
|
||||||
GLWin.xEventThread = std::thread(&cXInterface::XEventThread, this);
|
GLWin.xEventThread = std::thread(&cXInterface::XEventThread, this);
|
||||||
// Control window size and picture scaling
|
// Control window size and picture scaling
|
||||||
|
@ -116,16 +116,16 @@ void *cXInterface::CreateWindow(void)
|
||||||
|
|
||||||
void cXInterface::DestroyWindow(void)
|
void cXInterface::DestroyWindow(void)
|
||||||
{
|
{
|
||||||
XDestroyWindow(GLWin.dpy, GLWin.win);
|
XDestroyWindow(GLWin.evdpy, GLWin.win);
|
||||||
GLWin.win = 0;
|
GLWin.win = 0;
|
||||||
if (GLWin.xEventThread.joinable())
|
if (GLWin.xEventThread.joinable())
|
||||||
GLWin.xEventThread.join();
|
GLWin.xEventThread.join();
|
||||||
XFreeColormap(GLWin.dpy, GLWin.attr.colormap);
|
XFreeColormap(GLWin.evdpy, GLWin.attr.colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cXInterface::UpdateFPSDisplay(const char *text)
|
void cXInterface::UpdateFPSDisplay(const char *text)
|
||||||
{
|
{
|
||||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
XStoreName(GLWin.evdpy, GLWin.win, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cXInterface::XEventThread()
|
void cXInterface::XEventThread()
|
||||||
|
|
Loading…
Reference in New Issue