kangyu-california / PersistentWindows

fork of http://www.ninjacrab.com/persistent-windows/ with windows 10 update

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detect and ignore certain display-size events?

libove opened this issue · comments

This is a real niche case, and I don't know if it would be practical for PersistentWindows to find a way to manage this withOUT messing up more important more common cases. So, just, for discussion:
On a Lenovo ThinkPad P51 (under both Windows 10 and Windows 11-unofficial, all Pro or Enterprise, all 64-bit, throughout various Windows Feature releases, currently Windows 11 23H2), starting a couple of years ago with one of the never-ending marches of probably unnecessary updates to the display driver (Nvidia Quadro M1200, any driver newer than 452.57; presently running what Windows Device Manager shows as v31.0.15.2908 date May 30, 2023 provided by NVIDIA), from time to time when the computer enters sleep mode while NOT connected to its external display, on waking up it fails to reconnect to the external display. Display settings, re-"detect", Device Manager scan for new hardware,, physically unplugging and reattaching the display (HDMI cable) don't work to find the display again.
To get the external display recognized again it is necessary to restart the device - that is, either reboot Windows, or,
PNPUTIL /restart-device PCI\VEN_10DE&DEV_13B6&SUBSYS_225117AA&REV_A2\4&1de4a7cc&0&0008
(or whatever exact PCI path the display has at the moment, as detected by pnputil /enum-devices /class Display )

During the display device restart, the notebook's built-in display briefly (a couple of seconds) changes from its real built-in 1920x1080 resolution to the Windows fallback display driver resolution (which I suppose is 640x480 or 800x600), and various windows get resized - and PersistentWindows sees and remembers those resizes, to be small enough to fit the (Temporarily) artificially small screen.

So, the question is, could PersistentWindows detect maybe any of the following circumstances:

  • the display switches resolution from (anything bigger) to (ancient default VGA or SVGA 640x480 or 800x600 resolution) but then switches back within, say, thirty seconds; or
  • the display switches driver type from (anything real) to (Windows default VGA driver) but then switches back within, say, thirty seconds;
  • some other way of detecting this weird situation while avoiding inappropriate detecting real changes actually asked for by the user or imposed by real, persistent hardware failure?
    .. and in these cases, throws away the changes that it detected which lasted only, say, up to thirty seconds, and restores so the previous configuration if (after ~thirty seconds) the now-detected current(hopefully-stable) configuration matches/ is compatible with what was there before the commotion began?

Thanks,
-Jay

New display resolution change does not always trigger automatic restore.
Taking the VGA resolution for example, if user just sit through the 30 second resolution disruption (meaning user do not manipulate window position/size and no capture windows to disk operation is ever done), then PW would recognize the VGA resolution as non-user mode, and therefore would not bother to restore or even record window location.

Interesting, so it must be an even more complex interaction. If I can ever figure it out - define specific steps that reliably reproduce it - I'll post back. Thanks for the quick reply!