Skip to content

Commit

Permalink
Revert "Fix blurry window on native Wayland"
Browse files Browse the repository at this point in the history
This reverts commit 6dd5ed8.
  • Loading branch information
Maia-Everett committed Apr 22, 2024
1 parent 6dd5ed8 commit 53d6bab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 111 deletions.
2 changes: 2 additions & 0 deletions src/XIVLauncher.Core/DesktopEnvironment/DesktopHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ private static float GetXWaylandScaleFactor()

while ((line = process.StandardOutput.ReadLine()) != null)
{
Console.WriteLine("L {0}", line);

var match = XrdbRegex().Match(line);

if (match != null && match.Success)
Expand Down
14 changes: 0 additions & 14 deletions src/XIVLauncher.Core/DesktopEnvironment/SdlHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;

using Serilog;

using Veldrid.Sdl2;

namespace XIVLauncher.Core.DesktopEnvironment;
Expand All @@ -23,11 +21,6 @@ internal static unsafe partial class SdlHelpers
private static int SDL_GetDisplayDPI(int displayIndex, float* ddpi, float* hdpi, float* vdpi)
=> s_sdl_getDisplayDPI(displayIndex, ddpi, hdpi, vdpi);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void SDL_GL_GetDrawableSize_t(SDL_Window SDL2Window, int* w, int* h);
private static SDL_GL_GetDrawableSize_t s_getDrawableSize = Sdl2Native.LoadFunction<SDL_GL_GetDrawableSize_t>("SDL_GL_GetDrawableSize");
private static void SDL_GL_GetDrawableSize(SDL_Window Sdl2Window, int* w, int* h) => s_getDrawableSize(Sdl2Window, w, h);

private static unsafe string GetString(byte* stringStart)
{
int characters = 0;
Expand Down Expand Up @@ -58,11 +51,4 @@ public static Vector2 GetDisplayDpiScale()
Log.Verbose("SDL reports {0}x{1} DPI", hdpi, vdpi);
return new Vector2(hdpi / 96, vdpi / 96);
}

public static Vector2 GetWindowScale(Sdl2Window window)
{
int width, height;
SDL_GL_GetDrawableSize(window.SdlWindowHandle, &width, &height);
return new Vector2((float)width / window.Width, (float)height / window.Height);
}
}
88 changes: 0 additions & 88 deletions src/XIVLauncher.Core/DesktopEnvironment/XLVeldridStartup.cs

This file was deleted.

12 changes: 3 additions & 9 deletions src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,16 @@ private static void Main(string[] args)
var windowWidth = (int)ImGuiHelpers.GetScaled(1280);
var windowHeight = (int)ImGuiHelpers.GetScaled(800);

XLVeldridStartup.CreateWindowAndGraphicsDevice(
VeldridStartup.CreateWindowAndGraphicsDevice(
new WindowCreateInfo(50, 50, windowWidth, windowHeight, WindowState.Normal, $"XIVLauncher {version}"),
new GraphicsDeviceOptions(false, null, true, ResourceBindingModel.Improved, true, true),
out window,
out gd);

var windowScale = SdlHelpers.GetWindowScale(window).Y;
ImGuiHelpers.GlobalScale *= windowScale;

window.Resized += () =>
{
var scaledWidth = (int)Math.Round(window.Width * windowScale);
var scaledHeight = (int)Math.Round(window.Height * windowScale);
gd.MainSwapchain.Resize((uint)scaledWidth, (uint)scaledHeight);
bindings.WindowResized(scaledWidth, scaledHeight);
gd.MainSwapchain.Resize((uint)window.Width, (uint)window.Height);
bindings.WindowResized(window.Width, window.Height);
Invalidate();
};
cl = gd.ResourceFactory.CreateCommandList();
Expand Down

0 comments on commit 53d6bab

Please sign in to comment.