Fix resizing and maximizing window on Linux
This commit is contained in:
@@ -51,6 +51,10 @@ void GPUSwapChainVulkan::ReleaseBackBuffer()
|
|||||||
|
|
||||||
void GPUSwapChainVulkan::OnReleaseGPU()
|
void GPUSwapChainVulkan::OnReleaseGPU()
|
||||||
{
|
{
|
||||||
|
GPUDeviceLock lock(_device);
|
||||||
|
|
||||||
|
_device->WaitForGPU();
|
||||||
|
|
||||||
ReleaseBackBuffer();
|
ReleaseBackBuffer();
|
||||||
|
|
||||||
// Release data
|
// Release data
|
||||||
|
|||||||
@@ -1714,7 +1714,7 @@ void LinuxPlatform::Tick()
|
|||||||
window = WindowsManager::GetByNativePtr((void*)event.xclient.window);
|
window = WindowsManager::GetByNativePtr((void*)event.xclient.window);
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
window->CheckForWindowResize();
|
window->OnConfigureNotify(&event.xconfigure);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
|
|||||||
@@ -451,16 +451,17 @@ void LinuxWindow::CheckForWindowResize()
|
|||||||
|
|
||||||
LINUX_WINDOW_PROLOG;
|
LINUX_WINDOW_PROLOG;
|
||||||
|
|
||||||
// Cache client size
|
// Get client size
|
||||||
X11::XWindowAttributes xwa;
|
X11::XWindowAttributes xwa;
|
||||||
X11::XGetWindowAttributes(display, window, &xwa);
|
X11::XGetWindowAttributes(display, window, &xwa);
|
||||||
int32 width = xwa.width;
|
const int32 width = xwa.width;
|
||||||
int32 height = xwa.height;
|
const int32 height = xwa.height;
|
||||||
_clientSize = Vector2(static_cast<float>(width), static_cast<float>(height));
|
const Vector2 clientSize((float)width, (float)height);
|
||||||
|
|
||||||
// Check if window size has been changed
|
// Check if window size has been changed
|
||||||
if (width > 0 && height > 0 && (_swapChain == nullptr || width != _swapChain->GetWidth() || height != _swapChain->GetHeight()))
|
if (clientSize != _clientSize && width > 0 && height > 0)
|
||||||
{
|
{
|
||||||
|
_clientSize = clientSize;
|
||||||
OnResize(width, height);
|
OnResize(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -580,6 +581,17 @@ void LinuxWindow::OnLeaveNotify(void* event)
|
|||||||
Input::Mouse->OnMouseLeave(this);
|
Input::Mouse->OnMouseLeave(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinuxWindow::OnConfigureNotify(void* event)
|
||||||
|
{
|
||||||
|
auto configureEvent = (X11::XConfigureEvent*)event;
|
||||||
|
const Vector2 clientSize((float)configureEvent->width, (float)configureEvent->height);
|
||||||
|
if (clientSize != _clientSize)
|
||||||
|
{
|
||||||
|
_clientSize = clientSize;
|
||||||
|
OnResize(configureEvent->width, configureEvent->height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LinuxWindow::Maximize(bool enable)
|
void LinuxWindow::Maximize(bool enable)
|
||||||
{
|
{
|
||||||
LINUX_WINDOW_PROLOG;
|
LINUX_WINDOW_PROLOG;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public:
|
|||||||
void OnButtonRelease(void* event);
|
void OnButtonRelease(void* event);
|
||||||
void OnMotionNotify(void* event);
|
void OnMotionNotify(void* event);
|
||||||
void OnLeaveNotify(void* event);
|
void OnLeaveNotify(void* event);
|
||||||
|
void OnConfigureNotify(void* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user