talonvoice / beta

Issue tracker for the private Talon Beta
10 stars 0 forks source link

Mac active window screen not correct #114

Closed dwiel closed 3 years ago

dwiel commented 4 years ago

I have 3 monitors, from left to right: 4k, 1080, 4k. All are aligned on their top boundary. The center screen has the menubar on it.

When I run the following code:

    for screen in sorted_screens():
        print(screen)
    win = ui.active_window()
    print("ui.active_window().screen", win.screen)
    print("old window dimensions:", win.rect)

I get the following output:

2020-09-11 10:24:18    IO Screen(x=-3840.0, y=0.0, size=(3840.0, 2160.0), mm=(1354.6666463216147, 761.9999885559082))
2020-09-11 10:24:18    IO Screen(x=-1680.0, y=0.0, size=(1680.0, 1050.0), mm=(285.7499957084656, 179.29411495433135))
2020-09-11 10:24:18    IO Screen(x=0.0, y=0.0, size=(3840.0, 2160.0), mm=(596.5504497563073, 335.5596279879229))
2020-09-11 10:24:18    IO ui.active_window().screen Screen(x=0.0, y=0.0, size=(3840.0, 2160.0), mm=(596.5504497563073, 335.5596279879229))
2020-09-11 10:24:18    IO old window dimensions: Rect(0.0, 23.0, 1920.0, 1417.0)

The problem is the active window is not on the rightmost screen as it would appear from this debug output. It is in the top left corner of the middle screen.

dwiel commented 4 years ago

It appears that the window width and height are possibly correct, but x should be -1680.0.

dwiel commented 4 years ago

Also, I was expecting the menu bar to be at position (0, 0), but according to the screen layout listed in the debug output above, it is at position (-1680.0, 0.0).

lunixbochs commented 4 years ago

is it fixed if you restart talon, by the screens changing?

dwiel commented 4 years ago

yes. Now I get the correct values:

2020-09-11 10:35:39    IO Screen(x=-3840.0, y=0.0, size=(3840.0, 2160.0), mm=(1354.6666463216147, 761.9999885559082))
2020-09-11 10:35:39    IO Screen(x=0.0, y=0.0, size=(2560.0, 1440.0), mm=(596.5504497563073, 335.5596279879229))
2020-09-11 10:35:39    IO Screen(x=2560.0, y=-34.0, size=(1440.0, 900.0), mm=(285.7499957084656, 179.29411495433135))
2020-09-11 10:35:39    IO ui.active_window().screen Screen(x=0.0, y=0.0, size=(2560.0, 1440.0), mm=(596.5504497563073, 335.5596279879229))
2020-09-11 10:35:39    IO old window dimensions: Rect(0.0, 23.0, 1920.0, 1417.0)
dwiel commented 4 years ago

no monitors have been unplugged or plugged in since starting talon previously, though perhaps it did encounter a computer sleep-wake cycle.

lunixbochs commented 4 years ago

Probably QT’s fault, would love a repro

dwiel commented 4 years ago

To be clear, restarting talon fixed it. I did not change any screen settings.

lunixbochs commented 4 years ago

I know. Maybe see if it happens again after sleep

dwiel commented 4 years ago

It just happened again.

  1. Put computer to sleep with three displays
  2. Wake computer with only built-in display
  3. Put computer to sleep with only built-in display
  4. Wake computer with three displays

Screens are messed up again. Restarting talon fixes it.

I also just tried:

  1. Put computer to sleep with three displays
  2. Wake computer with three displays

not a problem

lunixbochs commented 4 years ago

Ok, I’m guessing screen update events don’t happen when the computer is asleep.

dwiel commented 4 years ago

Is this something you think you will workaround in talon or something I should try to work around in user?

lunixbochs commented 4 years ago

You won’t be able to trigger a screen refresh from python, I’ll think about it. How urgent is this?

dwiel commented 4 years ago

It's not a huge deal, I have a script to restart talon and dragon that I'm in the habit of using after waking up anyway.

lunixbochs commented 3 years ago

may be fixed on mac as of the upcoming beta release (approximately 0.1.2-60), please confirm

lunixbochs commented 3 years ago

closing, please reopen if you test on beta and this isn't actually fixed