_cleaning
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run
This commit is contained in:
@@ -604,15 +604,14 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
}
|
||||
case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED:
|
||||
{
|
||||
SDL_DisplayID display = SDL_GetDisplayForWindow(_window);
|
||||
float scale = SDL_GetWindowDisplayScale(_window);
|
||||
if (scale > 0.0f && _dpiScale != scale)
|
||||
{
|
||||
float oldScale = _dpiScale;
|
||||
_dpiScale = scale;
|
||||
_dpi = (int)(_dpiScale * DefaultDPI);
|
||||
int w = (int)(_cachedClientRectangle.GetWidth() * (scale / oldScale));
|
||||
int h = (int)(_cachedClientRectangle.GetHeight() * (scale / oldScale));
|
||||
_dpi = static_cast<int>(_dpiScale * DefaultDPI);
|
||||
int w = static_cast<int>(_cachedClientRectangle.GetWidth() * (scale / oldScale));
|
||||
int h = static_cast<int>(_cachedClientRectangle.GetHeight() * (scale / oldScale));
|
||||
_cachedClientRectangle.Size = Float2(static_cast<float>(w), static_cast<float>(h));
|
||||
SDL_SetWindowSize(_window, w, h);
|
||||
// TODO: Recalculate fonts
|
||||
@@ -690,12 +689,6 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
if (SDLInput::HandleEvent(this, event))
|
||||
return;
|
||||
}
|
||||
|
||||
// ignored
|
||||
if (event.type == SDL_EVENT_WINDOW_ICCPROF_CHANGED)
|
||||
return;
|
||||
|
||||
//LOG(Info, "Unhandled SDL event: {0}", event.type);
|
||||
}
|
||||
|
||||
void* SDLWindow::GetNativePtr() const
|
||||
@@ -854,18 +847,12 @@ void SDLWindow::BringToFront(bool force)
|
||||
|
||||
void SDLWindow::SetClientBounds(const Rectangle& clientArea)
|
||||
{
|
||||
int oldX, oldY;
|
||||
int oldW, oldH;
|
||||
SDL_GetWindowPosition(_window, &oldX, &oldY);
|
||||
SDL_GetWindowSizeInPixels(_window, &oldW, &oldH);
|
||||
int newX = static_cast<int>(clientArea.GetLeft());
|
||||
int newY = static_cast<int>(clientArea.GetTop());
|
||||
int newW = static_cast<int>(clientArea.GetWidth());
|
||||
int newH = static_cast<int>(clientArea.GetHeight());
|
||||
|
||||
int newX = (int)clientArea.GetLeft();
|
||||
int newY = (int)clientArea.GetTop();
|
||||
int newW = (int)clientArea.GetWidth();
|
||||
int newH = (int)clientArea.GetHeight();
|
||||
|
||||
//if (newX != oldX || newY != oldY)
|
||||
SetSDLWindowScreenPosition(this, newX, newY);
|
||||
SetSDLWindowScreenPosition(this, newX, newY);
|
||||
SDL_SetWindowSize(_window, newW, newH);
|
||||
}
|
||||
|
||||
@@ -888,29 +875,17 @@ void SDLWindow::SetPosition(const Float2& position)
|
||||
Int2 topLeftBorder;
|
||||
SDL_GetWindowBordersSize(_window, &topLeftBorder.Y, &topLeftBorder.X, nullptr, nullptr);
|
||||
|
||||
// The position is relative to the parent window
|
||||
Int2 relativePosition(static_cast<int>(position.X), static_cast<int>(position.Y));
|
||||
relativePosition += topLeftBorder;
|
||||
Int2 screenPosition(static_cast<int>(position.X), static_cast<int>(position.Y));
|
||||
screenPosition += topLeftBorder;
|
||||
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
// TODO: is this needed?
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
screenPosition += Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
|
||||
SetSDLWindowScreenPosition(this, 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);
|
||||
|
||||
newPos = GetPosition();
|
||||
//if (!(newPos.X == position.X && newPos.Y == position.Y))
|
||||
// ASSERT(false);
|
||||
|
||||
//LOG(Info, "SetPosition before: {}, after {}, relative {}", position, newPos, relativePosition);
|
||||
SetSDLWindowScreenPosition(this, screenPosition.X, screenPosition.Y);
|
||||
}
|
||||
|
||||
void SDLWindow::SetClientPosition(const Float2& position)
|
||||
|
||||
Reference in New Issue
Block a user