steam3d / MagicPods-Windows

Add little magic to your Airpods
https://magicpods.app
304 stars 11 forks source link

Popup window location not correct #396

Closed wsy closed 8 months ago

wsy commented 10 months ago

Device: AirPods Pro Computer: i7 6700k Bluetooth: Intel AX200 AppVersion: 2.0.59.0 x64

Problem screenshot

My computer has multiple displays.

The main display: DisplayM, 3840*2160@150% scale Main display setting

Another display: DisplayA, 1920*1080@100%scale image

App setting: PopupSize: Medium PopupLocation: BottomRight corner AppSetting

Steps to reproduce this bug:

  1. Open one program (such as Windows Terminal) and operate it on DisplayM.
  2. Open AirPods Pro's battery case and watch where the popup window will appear.
  3. MagicPods popup window should and it did appear at the bottom right corner of DisplayM.
  4. Operate one program on DisplayA.
  5. Open AirPods Pro's battery case and watch where the popup window will appear.
  6. MagicPods popup window should appear at the bottom right corner of main display. However, it appeared at wrong position.

My guess of what happened in step 6:

  1. MagicPods got the effective resolution of DisplayM, which is 2560x1440.
  2. MagicPods got the DPI scale of current display of active window, which is 100%.
  3. MagicPods display popup window at wrong pixel (2560,1440, 100%) instead of correct pixel (2560, 1440, 150%).

I think the bug is caused by "'DisplayM' is not necessarily 'current display of active window'". Further more, if you want to always display popup window on main display, 'current display of active window' is not necessarily where MagicPods' popup window will be displayed.

steam3d commented 10 months ago

Hi. Does the popup position right when you restart the app?

The MagicPods use primary monitor to show popup and subscribes to DPI changed event. I draw popup on this monitor (primary):

HMONITOR GetPrimaryMonitorHandle()
{
 const POINT ptZero = { 0, 0 };
 return MonitorFromPoint(ptZero, MONITOR_DEFAULTTOPRIMARY);
}
steam3d commented 10 months ago

Yep. I reproduced the issue. I think I understand what's going on, thanks, I'll fix it in the next update

steam3d commented 8 months ago

Fixed in 2.0.66.0