mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
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
|
||||
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
||||
XStoreName(GLWin.evdpy, GLWin.win, text);
|
||||
}
|
||||
|
||||
void cInterfaceGLX::SwapInterval(int Interval)
|
||||
@ -136,7 +136,7 @@ bool cInterfaceGLX::MakeCurrent()
|
||||
#if defined(HAVE_WX) && (HAVE_WX)
|
||||
Host_GetRenderWindowSize(GLWin.x, GLWin.y,
|
||||
(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);
|
||||
#endif
|
||||
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||
|
@ -24,9 +24,9 @@
|
||||
#if USE_EGL
|
||||
bool cXInterface::ServerConnect(void)
|
||||
{
|
||||
GLWin.evdpy = XOpenDisplay(NULL);
|
||||
GLWin.dpy = XOpenDisplay(NULL);
|
||||
|
||||
if (!GLWin.evdpy)
|
||||
if (!GLWin.dpy)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -39,7 +39,7 @@ bool cXInterface::Initialize(void *config)
|
||||
int num_visuals;
|
||||
EGLint vid;
|
||||
|
||||
if (!GLWin.evdpy) {
|
||||
if (!GLWin.dpy) {
|
||||
printf("Error: couldn't open X display\n");
|
||||
return false;
|
||||
}
|
||||
@ -51,7 +51,7 @@ bool cXInterface::Initialize(void *config)
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
GLWin.vi = XGetVisualInfo(GLWin.evdpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
GLWin.vi = XGetVisualInfo(GLWin.dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!GLWin.vi) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
@ -64,12 +64,12 @@ bool cXInterface::Initialize(void *config)
|
||||
GLWin.width = _twidth;
|
||||
GLWin.height = _theight;
|
||||
|
||||
GLWin.dpy = XOpenDisplay(NULL);
|
||||
GLWin.evdpy = XOpenDisplay(NULL);
|
||||
GLWin.parent = GLWin.win;
|
||||
GLWin.screen = DefaultScreen(GLWin.evdpy);
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
|
||||
if (GLWin.parent == 0)
|
||||
GLWin.parent = RootWindow(GLWin.evdpy, GLWin.screen);
|
||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* 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)
|
||||
{
|
||||
return eglGetDisplay(GLWin.evdpy);
|
||||
return eglGetDisplay(GLWin.dpy);
|
||||
}
|
||||
|
||||
void *cXInterface::CreateWindow(void)
|
||||
@ -90,22 +90,22 @@ void *cXInterface::CreateWindow(void)
|
||||
Atom wmProtocols[1];
|
||||
|
||||
// Setup window attributes
|
||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
||||
GLWin.attr.colormap = XCreateColormap(GLWin.evdpy,
|
||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
||||
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;
|
||||
|
||||
// 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.vi->depth, InputOutput, GLWin.vi->visual,
|
||||
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
XSync(GLWin.dpy, True);
|
||||
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1);
|
||||
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||
XMapRaised(GLWin.evdpy, GLWin.win);
|
||||
XSync(GLWin.evdpy, True);
|
||||
|
||||
GLWin.xEventThread = std::thread(&cXInterface::XEventThread, this);
|
||||
// Control window size and picture scaling
|
||||
@ -116,16 +116,16 @@ void *cXInterface::CreateWindow(void)
|
||||
|
||||
void cXInterface::DestroyWindow(void)
|
||||
{
|
||||
XDestroyWindow(GLWin.dpy, GLWin.win);
|
||||
XDestroyWindow(GLWin.evdpy, GLWin.win);
|
||||
GLWin.win = 0;
|
||||
if (GLWin.xEventThread.joinable())
|
||||
GLWin.xEventThread.join();
|
||||
XFreeColormap(GLWin.dpy, GLWin.attr.colormap);
|
||||
XFreeColormap(GLWin.evdpy, GLWin.attr.colormap);
|
||||
}
|
||||
|
||||
void cXInterface::UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
||||
XStoreName(GLWin.evdpy, GLWin.win, text);
|
||||
}
|
||||
|
||||
void cXInterface::XEventThread()
|
||||
|
Loading…
Reference in New Issue
Block a user