X11_Util: Resize the GLX window by listening to events on the parent

We now have two cases: the GLX window is parented into a frame, or it's
parented into the MainNoGUI host. In both cases, the GLX window should
be locked to the size of the parent, so just sync it up based on that.
This commit is contained in:
Jasper St. Pierre 2014-08-06 22:22:13 -04:00
parent d6f4f4df42
commit e7471958e4
2 changed files with 3 additions and 9 deletions

View File

@ -840,13 +840,6 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
}
#if defined(HAVE_X11) && HAVE_X11
wxRect client_rect = m_RenderParent->GetClientRect();
XMoveResizeWindow(X11Utils::XDisplayFromHandle(GetHandle()),
(Window) Core::GetWindowHandle(),
client_rect.x, client_rect.y,
client_rect.width, client_rect.height);
#endif
m_LogWindow->Refresh();
m_LogWindow->Update();
}

View File

@ -11,7 +11,6 @@ void cX11Window::CreateXWindow(void)
// Setup window attributes
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
GLWin.parent, GLWin.vi->visual, AllocNone);
GLWin.attr.event_mask = StructureNotifyMask;
GLWin.attr.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
GLWin.attr.border_pixel = 0;
@ -19,7 +18,8 @@ void cX11Window::CreateXWindow(void)
GLWin.win = XCreateWindow(GLWin.dpy, GLWin.parent,
0, 0, 1, 1, 0,
GLWin.vi->depth, InputOutput, GLWin.vi->visual,
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
CWBorderPixel | CWBackPixel | CWColormap, &GLWin.attr);
XSelectInput(GLWin.dpy, GLWin.parent, StructureNotifyMask);
XMapWindow(GLWin.dpy, GLWin.win);
XSync(GLWin.dpy, True);
@ -45,6 +45,7 @@ void cX11Window::XEventThread()
XNextEvent(GLWin.dpy, &event);
switch (event.type) {
case ConfigureNotify:
XResizeWindow(GLWin.dpy, GLWin.win, event.xconfigure.width, event.xconfigure.height);
GLInterface->SetBackBufferDimensions(event.xconfigure.width, event.xconfigure.height);
break;
default: