_wayland working minus sdl bug
This commit is contained in:
@@ -191,13 +191,16 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
}
|
||||
else if (_settings.Parent != nullptr && _settings.Parent->_settings.Type != WindowType::Regular && (_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup))
|
||||
{
|
||||
auto parent = _settings.Parent->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
_settings.Parent = parent;
|
||||
if (_settings.Parent->_settings.Type == WindowType::Regular)
|
||||
break;
|
||||
parent = _settings.Parent->GetSettings().Parent;
|
||||
auto parent = _settings.Parent->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
_settings.Parent = parent;
|
||||
if (_settings.Parent->_settings.Type == WindowType::Regular)
|
||||
break;
|
||||
parent = _settings.Parent->GetSettings().Parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup))
|
||||
@@ -696,7 +699,7 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
{
|
||||
int32 width = event.window.data1;
|
||||
int32 height = event.window.data2;
|
||||
|
||||
|
||||
_clientSize = Float2(static_cast<float>(width), static_cast<float>(height));
|
||||
_cachedClientRectangle.Size = _clientSize;
|
||||
|
||||
@@ -1028,6 +1031,22 @@ Int2 GetSDLWindowPosition(const SDLWindow* window)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
// Wayland doesn't support reporting window position in screen-space
|
||||
/*auto parent = window->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
Int2 parentPosition;// = GetSDLWindowPosition(parent);
|
||||
SDL_GetWindowPosition(parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position += parentPosition;
|
||||
parent = parent->GetSettings().Parent;
|
||||
}*/
|
||||
//Int2 rootParentPosition = GetSDLWindowPosition(parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
//position += rootParentPosition;
|
||||
}
|
||||
#endif
|
||||
return position;
|
||||
}
|
||||
@@ -1075,6 +1094,10 @@ void SetSDLWindowPosition(SDLWindow* window, const int x, const int y)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
SDL_SetWindowPosition(window->GetSDLWindow(), x, y);
|
||||
}
|
||||
@@ -1122,7 +1145,7 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
SDLWindow* parent = window->GetSettings().Parent;
|
||||
/*SDLWindow* parent = window->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
if (parent->GetSettings().Parent == nullptr)
|
||||
@@ -1143,7 +1166,7 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
}
|
||||
else
|
||||
relativePosition = parentPosition;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user