mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge branch 'fix-linux-win-resize'
This commit is contained in:
commit
4f5832827e
@ -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);
|
||||
|
@ -115,7 +115,10 @@ out:
|
||||
#if HAVE_X11
|
||||
if (selected_platform != EGL_PLATFORM_X11) {
|
||||
if (GLWin.dpy)
|
||||
{
|
||||
XCloseDisplay(GLWin.dpy);
|
||||
XCloseDisplay(GLWin.evdpy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (selected_platform == EGL_PLATFORM_NONE)
|
||||
|
@ -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()
|
||||
@ -157,7 +157,7 @@ void cX11Window::CreateXWindow(void)
|
||||
|
||||
void cX11Window::DestroyXWindow(void)
|
||||
{
|
||||
XUnmapWindow(GLWin.dpy, GLWin.win);
|
||||
XUnmapWindow(GLWin.evdpy, GLWin.win);
|
||||
GLWin.win = 0;
|
||||
if (GLWin.xEventThread.joinable())
|
||||
GLWin.xEventThread.join();
|
||||
@ -175,9 +175,9 @@ void cX11Window::XEventThread()
|
||||
{
|
||||
XEvent event;
|
||||
KeySym key;
|
||||
for (int num_events = XPending(GLWin.dpy); num_events > 0; num_events--)
|
||||
for (int num_events = XPending(GLWin.evdpy); num_events > 0; num_events--)
|
||||
{
|
||||
XNextEvent(GLWin.dpy, &event);
|
||||
XNextEvent(GLWin.evdpy, &event);
|
||||
switch(event.type) {
|
||||
case KeyPress:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
@ -305,17 +305,17 @@ void cX11Window::XEventThread()
|
||||
case ConfigureNotify:
|
||||
Window winDummy;
|
||||
unsigned int borderDummy, depthDummy;
|
||||
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
|
||||
XGetGeometry(GLWin.evdpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
|
||||
&GLWin.width, &GLWin.height, &borderDummy, &depthDummy);
|
||||
GLInterface->SetBackBufferDimensions(GLWin.width, GLWin.height);
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((unsigned long) event.xclient.data.l[0] ==
|
||||
XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
|
||||
XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", False))
|
||||
Host_Message(WM_USER_STOP);
|
||||
if ((unsigned long) event.xclient.data.l[0] ==
|
||||
XInternAtom(GLWin.dpy, "RESIZE", False))
|
||||
XMoveResizeWindow(GLWin.dpy, GLWin.win,
|
||||
XInternAtom(GLWin.evdpy, "RESIZE", False))
|
||||
XMoveResizeWindow(GLWin.evdpy, GLWin.win,
|
||||
event.xclient.data.l[1], event.xclient.data.l[2],
|
||||
event.xclient.data.l[3], event.xclient.data.l[4]);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user