_noprog?
This commit is contained in:
@@ -483,7 +483,7 @@ bool SDLInput::HandleEvent(SDLWindow* window, SDL_Event& event)
|
||||
else
|
||||
{
|
||||
const Float2 mousePos = window->ClientToScreen({ event.motion.x, event.motion.y });
|
||||
LOG(Info, "motion {},{}, mouse: {}", event.motion.x, event.motion.y, mousePos);
|
||||
//LOG(Info, "motion {},{}, mouse: {}", event.motion.x, event.motion.y, mousePos);
|
||||
Input::Mouse->OnMouseMove(mousePos, window);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -164,6 +164,7 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
// The SDL window position is always relative to the parent window
|
||||
//x = 5;
|
||||
//y = 5;
|
||||
Int2 oldpos(x, y);
|
||||
if (_settings.Parent != nullptr && SDLPlatform::UsesX11())
|
||||
{//(_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup)
|
||||
//if (_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup)
|
||||
@@ -189,9 +190,9 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
/*auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
x -= (int)monitorBounds.GetLeft();
|
||||
y -= (int)monitorBounds.GetTop();
|
||||
y -= (int)monitorBounds.GetTop();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +219,8 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
_handle = GetNativeWindowPointer(_window);
|
||||
ASSERT(_handle != nullptr);
|
||||
|
||||
SDL_SyncWindow(_window);
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
@@ -239,7 +242,16 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
SDL_GetWindowSizeInPixels(_window, &rect.w, &rect.h);
|
||||
_cachedClientRectangle = Rectangle((float)rect.x, (float)rect.y, (float)rect.w, (float)rect.h);
|
||||
|
||||
LOG(Info, "new window at {}, expected: {}, {}", _cachedClientRectangle.GetTopLeft(), x, y);
|
||||
Int2 newpos = GetPosition();
|
||||
LOG(Info, "new window at {}, expected: {}", newpos, oldpos);
|
||||
ASSERT(newpos == oldpos);
|
||||
|
||||
oldpos = newpos;
|
||||
SetPosition(newpos);
|
||||
newpos = GetPosition();
|
||||
|
||||
LOG(Info, "new window sanity set at {}", newpos);
|
||||
ASSERT(newpos == oldpos);
|
||||
|
||||
SDL_SetWindowHitTest(_window, &OnWindowHitTest, this);
|
||||
InitSwapChain();
|
||||
@@ -857,16 +869,16 @@ Int2 GetSDLWindowPosition(const SDLWindow* window)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(window->GetSettings().Parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position -= parentPosition;
|
||||
position += parentPosition;
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position -= Int2(monitorBounds.GetTopLeft());
|
||||
//position += Int2(monitorBounds.GetTopLeft());
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position += Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
position -= Int2(monitorBounds.GetTopLeft());
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position -= Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -896,12 +908,12 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
SDLWindow* parent = window->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
if (parent->GetSettings().Type != WindowType::Tooltip && parent->GetSettings().Type != WindowType::Popup)
|
||||
/*if (parent->GetSettings().Type != WindowType::Tooltip && parent->GetSettings().Type != WindowType::Popup)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
relativePosition += parentPosition;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
//if (parent->GetSettings().Parent == nullptr || (parent->GetSettings().Type != WindowType::Tooltip && parent->GetSettings().Type != WindowType::Popup))
|
||||
// break;
|
||||
parent = parent->GetSettings().Parent;
|
||||
@@ -990,7 +1002,7 @@ void SetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
relativePosition -= parentPosition;
|
||||
//break;
|
||||
break;
|
||||
}
|
||||
//if (parent->GetSettings().Parent == nullptr || (parent->GetSettings().Type != WindowType::Tooltip && parent->GetSettings().Type != WindowType::Popup))
|
||||
// break;
|
||||
@@ -1059,18 +1071,24 @@ void SDLWindow::SetPosition(const Float2& position)
|
||||
Int2 relativePosition(static_cast<int>(position.X), static_cast<int>(position.Y));
|
||||
relativePosition += topLeftBorder;
|
||||
SetRelativeWindowPosition(this, relativePosition);
|
||||
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
|
||||
SDL_SetWindowPosition(_window, relativePosition.X, relativePosition.Y);
|
||||
SDL_SyncWindow(_window);
|
||||
|
||||
Int2 newPos;
|
||||
SDL_GetWindowPosition(_window, &newPos.X, &newPos.Y);
|
||||
if (!(newPos.X == relativePosition.X && newPos.Y == relativePosition.Y))
|
||||
ASSERT(false);
|
||||
//if (!(newPos.X == relativePosition.X && newPos.Y == relativePosition.Y))
|
||||
// ASSERT(false);
|
||||
|
||||
newPos = GetPosition();
|
||||
if (!(newPos.X == relativePosition.X && newPos.Y == relativePosition.Y))
|
||||
ASSERT(false);
|
||||
//if (!(newPos.X == position.X && newPos.Y == position.Y))
|
||||
// ASSERT(false);
|
||||
}
|
||||
|
||||
void SDLWindow::SetClientPosition(const Float2& position)
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace FlaxEngine.GUI
|
||||
WrapPosition(ref mousePos, 10);
|
||||
locationSS = mousePos + new Float2(15, 10);
|
||||
var ppp = Input.MouseScreenPosition;
|
||||
locationSS = new Float2(5, 5);
|
||||
var bef = locationSS;
|
||||
|
||||
// Create window
|
||||
@@ -230,6 +231,7 @@ namespace FlaxEngine.GUI
|
||||
var bef = _window.Position;
|
||||
WrapPosition(ref mousePos, 10);
|
||||
mousePos += new Float2(15, 10);
|
||||
mousePos = new Float2(5, 5);
|
||||
|
||||
if (_window)
|
||||
_window.Position = mousePos;
|
||||
|
||||
Reference in New Issue
Block a user