rocksdanister / lively

Free and open-source software that allows users to set animated desktop wallpapers and screensavers powered by WinUI 3.
https://rocksdanister.com/lively
GNU General Public License v3.0
15.09k stars 1.06k forks source link

Doesn't handle negative screen coordinates #177

Closed roblarky closed 4 years ago

roblarky commented 4 years ago

Describe the bug When a screen's location within the virtual desktop has a negative X or Y location, the wallpaper does not react at all, or is skewed by the amount which the screen is in the negative axis.

To Reproduce Steps to reproduce the behavior: Using three monitors with the setup below and the Periodic Table or Fluids V2 wallpaper. Move the mouse on the left screen (fully in negative X coordinates) anywhere (no wallpaper reaction). On the right screen (Y is -164), all wallpaper reactions are skewed/shifted higher (Y axis).

image CORRECTION: Screen 1 (right-most) Y location is -164, not -120

Expected behavior The wallpaper should react to the exact location of the mouse, and should account for screens with negative X/Y locations within the entire virtual desktop.

Screenshots/Video In the screenshot below, the hover element is not the one below the mouse cursor. This screen has a negative Y location within the entire virtual desktop. image

On my left screen, the entire X axis of the screen is negative, so no elements react to hover at all.

The Fluids V2 behaves the same, not aligned on screen with negative Y, and not at all on the left screen for which the X axis is entirely in the negative space (-1920 to -1).

Desktop:

Log file Log File: 20201028_141131.txt

rocksdanister commented 4 years ago

Thanks for the detailed report.

Looking at the code, I did some unnecessary math: https://github.com/rocksdanister/lively/blob/18a82f9689880de6536f09b989698e14dbb22844/src/livelywpf/livelywpf/Core/InputForwarding/RawInputDX.xaml.cs#L209-L247 Made some changes:

private static Point CalculateMousePos(int x, int y, Screen display)
{
 if (ScreenHelper.IsMultiScreen())
 {
   if (Program.SettingsVM.Settings.WallpaperArrangement == WallpaperArrangement.span)
   {
      x -= SystemInformation.VirtualScreen.Location.X;
      y -= SystemInformation.VirtualScreen.Location.Y;
    }
    else //per-display or duplicate mode.
    {
      x += -1 * display.Bounds.X;
      y += -1 * display.Bounds.Y;
    }
  }
  return new Point(x, y);
 }

Working fine on my end, but I can't test triple screen since I only have two; will you be interested in beta testing an early build?

roblarky commented 4 years ago

Sure thing.

rocksdanister commented 4 years ago

Sorry for the late reply, was setting things up.

So I made a separate repo for early releases: https://github.com/rocksdanister/lively-beta

Things to consider when testing:

  1. Fluid wallpaper with duplicate mode should be the easiest to test.
  2. Try setting each monitor as primary and try various arrangements.
roblarky commented 4 years ago

Works fine now. Thanks!