Add demo image to README and warning.

This commit is contained in:
Peter 2024-10-05 03:29:14 +08:00
parent 829486994b
commit c97fd82d34
3 changed files with 9 additions and 2 deletions

View File

@ -184,10 +184,10 @@ namespace WindowOverlayApp
private void ForegroundEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) private void ForegroundEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
{ {
if (hwnd == notepadHandle) if (IsAnyParentMatching(hwnd, notepadHandle))
{ {
UpdateOverlayWindow(); UpdateOverlayWindow();
} else if (!IsAnyParentMatching(hwnd,notepadHandle) && !IsWindowClass(hwnd, "ForegroundStaging") && !IsWindowClass(hwnd, "MultitaskingViewFrame")) } else if (!IsWindowClass(hwnd, "ForegroundStaging") && !IsWindowClass(hwnd, "MultitaskingViewFrame"))
{ {
SetWindowPos(this.Handle, 1, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(this.Handle, 1, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

View File

@ -1,5 +1,10 @@
# Vivado Dark Mode # Vivado Dark Mode
![Vivado dark mode](example_dark_mode.png)
> [!WARNING]
> This is demo code to show dark mode for any light mode application on Windows is possible, the code is not polished for a final product and the current code does not handle all edge cases.
This will eventually become a program to make any windows application dark mode, stay tuned. This will eventually become a program to make any windows application dark mode, stay tuned.
This demo uses the Windows magnification API to invert a window and make it dark mode. This demo uses the Windows magnification API to invert a window and make it dark mode.
@ -7,6 +12,8 @@ This demo uses the Windows magnification API to invert a window and make it dark
## Bugs/Notes ## Bugs/Notes
- When switching windows, it will momentarily flash. This is because of some latency in handling the window foreground event, I am not sure if it is possible to improve on this to make it less noticeable. - When switching windows, it will momentarily flash. This is because of some latency in handling the window foreground event, I am not sure if it is possible to improve on this to make it less noticeable.
- Window title is hardcoded, meaning if the dark mode program was started after the window title does not match "Vivado 24.1" (for example after opening a project) it will fail.
- Currently it just inverts the program, but the magnification API supports transformation matrices so it is possible to use a different color mapping that might be better.
- Currently this handles sub-windows (such as save dialogs) by making the magnification window have the maximum Z order. This simplifies things, but also means if another window is over the active window it too will be inverted - Currently this handles sub-windows (such as save dialogs) by making the magnification window have the maximum Z order. This simplifies things, but also means if another window is over the active window it too will be inverted
- Creating magnification lenses for each window with the Z height 1 above the relavant window would fix this issue. - Creating magnification lenses for each window with the Z height 1 above the relavant window would fix this issue.

BIN
example_dark_mode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB