Window impl on Linux progress
This commit is contained in:
@@ -718,6 +718,7 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
settings.HasBorder = false;
|
||||
#if PLATFORM_WINDOWS
|
||||
// Skip OS sizing frame and implement it using LeftButtonHit
|
||||
settings.HasSizingFrame = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -483,8 +483,9 @@ int32 GPUSwapChainVulkan::TryPresent(Function<int32(GPUSwapChainVulkan*, void*)>
|
||||
|
||||
// Recreate swapchain
|
||||
ASSERT(_swapChain != VK_NULL_HANDLE);
|
||||
int32 width = _width, height = _height;
|
||||
ReleaseGPU();
|
||||
CreateSwapChain(_width, _height);
|
||||
CreateSwapChain(width, height);
|
||||
|
||||
// Flush commands
|
||||
_device->GetMainContext()->Flush();
|
||||
@@ -571,8 +572,9 @@ void GPUSwapChainVulkan::Present(bool vsync)
|
||||
}
|
||||
|
||||
// Rebuild swapchain for the next present
|
||||
int32 width = _width, height = _height;
|
||||
ReleaseGPU();
|
||||
CreateSwapChain(_width, _height);
|
||||
CreateSwapChain(width, height);
|
||||
_device->GetMainContext()->Flush();
|
||||
_device->WaitForGPU();
|
||||
return;
|
||||
|
||||
@@ -1681,7 +1681,6 @@ void LinuxPlatform::Tick()
|
||||
switch (event.type)
|
||||
{
|
||||
case ClientMessage:
|
||||
{
|
||||
// User requested the window to close
|
||||
if ((X11::Atom)event.xclient.data.l[0] == xAtomDeleteWindow)
|
||||
{
|
||||
@@ -1691,31 +1690,32 @@ void LinuxPlatform::Tick()
|
||||
window->Close(ClosingReason::User);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FocusIn:
|
||||
{
|
||||
// Update input context focus
|
||||
X11::XSetICFocus(IC);
|
||||
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xfocus.window);
|
||||
if (window)
|
||||
{
|
||||
window->OnGotFocus();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FocusOut:
|
||||
{
|
||||
// Update input context focus
|
||||
X11::XUnsetICFocus(IC);
|
||||
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xfocus.window);
|
||||
if (window)
|
||||
{
|
||||
window->OnLostFocus();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
// Handle window resizing
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xclient.window);
|
||||
if (window)
|
||||
{
|
||||
window->CheckForWindowResize();
|
||||
}
|
||||
break;
|
||||
case PropertyNotify:
|
||||
// Report minimize, maximize and restore events
|
||||
@@ -1736,7 +1736,6 @@ void LinuxPlatform::Tick()
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xproperty.window);
|
||||
if (window == nullptr)
|
||||
continue;
|
||||
|
||||
X11::Atom* atoms = (X11::Atom*)data;
|
||||
|
||||
bool foundHorz = false;
|
||||
|
||||
@@ -319,13 +319,10 @@ void LinuxWindow::SetClientBounds(const Rectangle& clientArea)
|
||||
{
|
||||
X11::XSizeHints hints;
|
||||
hints.flags = PMinSize | PMaxSize;
|
||||
|
||||
hints.min_height = height;
|
||||
hints.max_height = height;
|
||||
|
||||
hints.min_width = width;
|
||||
hints.max_width = width;
|
||||
|
||||
X11::XSetNormalHints(display, window, &hints);
|
||||
}
|
||||
|
||||
@@ -605,7 +602,7 @@ void LinuxWindow::Maximize(bool enable)
|
||||
|
||||
XSendEvent(display, X11_DefaultRootWindow(display), 0, SubstructureRedirectMask | SubstructureNotifyMask, &event);
|
||||
}
|
||||
else
|
||||
else if (enable)
|
||||
{
|
||||
X11::Atom states[2];
|
||||
states[0] = wmMaxVert;
|
||||
|
||||
Reference in New Issue
Block a user