Commit Graph

352 Commits

Author SHA1 Message Date
Terry MacDonald
567c9b7af2 Reduced the displayid calls for profile comparison 2022-05-29 21:01:08 +12:00
Terry MacDonald
f6b1eed990 Fixed ProgramSetting loading and use
There was a flaw in the way that ProgramSettings was being used that meant there was a lot of reloading and saving going on which was unnecessary. Additionally there were some errors in the way that the Settings file was upgraded which mean that the old settings were keeping on getting overwritten. Fixes #104.
2022-05-28 21:09:53 +12:00
Terry MacDonald
29c590a972 Fixed High CPU issue
Replaced Task.Delay with Thread.Sleep as we were incorrectly pausing the monitoring thread. Should fix #110.
2022-05-18 21:32:33 +12:00
dependabot[bot]
335250035c
Bump NLog from 4.7.15 to 5.0.0
Bumps [NLog](https://github.com/NLog/NLog) from 4.7.15 to 5.0.0.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/compare/v4.7.15...v5.0)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-17 08:27:33 +00:00
Terry MacDonald
f8a9ca8e1e Added in partial DRS Setting support
This DRS Support is just reserving a space for the future addition of DRS Settings pulled from the driver. This will allow the recording of settings listed in the 3D Settings within the NVIDIA Control panel.
2022-04-20 20:35:51 +12:00
Terry MacDonald
9a745ea3e7 Adjusted mainform startup now we're singleinstance
Made some adjustments to when the MainForm is loaded, and how the NotifyIcon works for system tray.

Also Adjusted the way that the Windows Screens are computed so that we can reuse some of the code in AMD and NVIDIA screen generation so that the additional non-NVIDIA and non-AMD connected screens are still shown.
2022-04-20 17:39:34 +12:00
Terry MacDonald
ae7bb095e2 Revamped display layout image shortcut generation
Made many changes to simplify the configuration and make the profile display layout image generation faster and more reliable.
2022-04-19 21:12:00 +12:00
Terry MacDonald
51806494ab Added checks for non-NVIDIA screens to NVIDIA mode
This will ensure that all screens show up in the images even if they aren't connected through an NVIDIA device. I also made the same changes to the AMD mode.
2022-04-19 15:23:35 +12:00
Terry MacDonald
b7194dd6e9 Added extra logging 2022-04-19 09:51:35 +12:00
Terry MacDonald
f042622921 Added SpaceDesk to recognised PCI devices
Also improved logging around PatchAdapterIDs
2022-04-19 09:31:07 +12:00
Terry MacDonald
ff93a1007c Found exception when tracking taskbar location
This is a subtle error, caused by either the NVIDIA driver being slow, or windows being slow in updating the location of the windows taskbar edge. This was causing an error in the GetNVIDIASCreenPositions function. Have added a 0.5 second delay to allow windows to update iit's display layout before we try to read it which should help, and also if we can't find the taskbar location in the settings, we just assume it is at the bottom. This should avoid exception.
2022-04-17 23:15:55 +12:00
Terry MacDonald
6f778f556d Detect 0 width and height screens and alert
Added specific checks to find and alert on 0 width or 0 height screens. This will then break other parts of the display layout.

Also moved the cloned screen check higher up to ensure we skip them properly.
2022-04-16 15:07:10 +12:00
Terry MacDonald
cc5f334917 Fix to ToTightestBitmap
Removed a divide by zero issue with ToTighestBitmap that could cause issues.
2022-04-16 14:55:24 +12:00
Terry MacDonald
c99c166b3d Cloned display image layout fixes
Cloned displays weren't showing properly in the image layouts, and this fixes that issue.
2022-04-15 15:13:27 +12:00
Terry MacDonald
fa05920618 Fixed Desktop right-click menu
Had forgottent to update the profiles json file to new v2.3 filename.
2022-04-15 11:46:46 +12:00
Terry MacDonald
25b8d1102f [WIP] Partially overhauled NVIDIA screen calculations
Had some mistakes in the way that the profile graphics images were calculated on NVIDIA video cards. This meant that in some situations it calculated the image structures incorrectly, and didn't put the displays in the right places. This now changes that fact.

There is still an outstanding issue that the GetNVIDIAScreenPositions function still doesn't put the taskbar location in the right place yet. I need to fix that tomorrow.
2022-04-13 22:48:32 +12:00
Terry MacDonald
11792ec1a3 Fixed incorrect log function name 2022-04-13 09:30:27 +12:00
Terry MacDonald
e4aab07b03 Tweaked error messages to better represent errorlevel
Changed a few ERROR level log messages to WARN as that better represents their classification.
2022-04-10 09:40:28 +12:00
Terry MacDonald
2d554d217a Updated NVIDIALIbrary to latest version 2022-03-30 18:37:24 +13:00
Terry MacDonald
3cadb9a0fe Fixed SetDisplayConfig memory management 2022-03-30 12:05:53 +13:00
Terry MacDonald
53375df302 Fix memory deallocation
There were some issues with memory deallocation where AllocateHGlobal memory was being freed incorrectly with FreeCoTaskMem. This was causing issues with subsequent memory allocations.
2022-03-30 11:50:43 +13:00
Terry MacDonald
7bb96956f1 Fixed merge errors 2022-03-30 10:56:24 +13:00
Terry MacDonald
168fab9fc2 Merge from feature branch 2022-03-30 10:49:10 +13:00
Terry MacDonald
b4f9f32e1d Fully working DisplayConfig
NVIDIALibrary updated to properly support DisplayConfig functionality. Even works with Cloned mode now!
2022-03-30 10:43:47 +13:00
Terry MacDonald
e12cd19d14 [WIP] Error with Timing
The Advanced Target Info object returned by the NVIDIA driver points to memory outside the allocated memory. I need to figure out how the NVIDIA code allocates the memory, so I can account for it on return.
2022-03-30 09:01:15 +13:00
Terry MacDonald
490a5f135f [WIP] Partially fixed GetDisplayConfig
The returned structure doesn't match the structure put in
2022-03-29 10:09:29 +13:00
dependabot[bot]
8643ae5300
Bump NLog from 4.7.14 to 4.7.15
Bumps [NLog](https://github.com/NLog/NLog) from 4.7.14 to 4.7.15.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/v4.7.15/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/compare/v4.7.14...v4.7.15)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 08:36:01 +00:00
Terry MacDonald
cd9765e765 [WIP] Partially working GetDisplayConfig third pass
Need to get the timing stuff working as it isn't populated properly.
2022-03-26 21:29:53 +13:00
Terry MacDonald
3b4a5ac29d [WIP] Trying a different memeory structure for GetDisplayConfig 2022-03-26 20:11:52 +13:00
Terry MacDonald
faaa61586c [WIP] Understanding memory leak in GetDisplayConfig 2022-03-25 22:57:32 +13:00
Terry MacDonald
37e336cb95 Updated nuget packages 2022-03-25 22:44:46 +13:00
Terry MacDonald
37b9a79ff2 [WIP] Partial integration of new libraries.
Still some bits broken.
2022-03-25 21:51:38 +13:00
Terry MacDonald
842854e957 Merged from feature-update-libraries 2022-03-24 22:41:16 +13:00
Terry MacDonald
67c1015730 Updated the NVIDIALibrary and WinLibrary to v1.7.0
This is the version used within NVIDIAInfo v1.7.0
2022-03-24 22:36:42 +13:00
terrymacdonald
473d69058e
Merge pull request #90 from terrymacdonald/dependabot/nuget/develop/NLog-4.7.14
Bump NLog from 4.7.13 to 4.7.14
2022-03-07 07:54:32 +13:00
Terry MacDonald
72b1acfe46 [WIP] Attempt to get TaskBar changing to work 2022-03-05 18:46:47 +13:00
dependabot[bot]
2472ea5c39
Bump NLog from 4.7.13 to 4.7.14
Bumps [NLog](https://github.com/NLog/NLog) from 4.7.13 to 4.7.14.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/commits)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-23 08:24:04 +00:00
Terry MacDonald
87f62aa322 Made display changes reliable 2022-02-12 09:18:03 +13:00
Terry MacDonald
963b267158 Move SkippedConnectionTypes earlier to stop error 2022-02-10 09:02:17 +13:00
Terry MacDonald
1f6af1f0c7 Working taskbar refresh after stopping programs
Moved the refreshnotificationarea logic to only be used when needed.
2022-02-07 15:18:30 +13:00
Terry MacDonald
b65d42e3ea Working taskbar notification tray refresh 2022-02-07 15:01:59 +13:00
Terry MacDonald
093663bb1c Reverted attempts to get notification tray refresh
I have been attempting to force Windows to refresh the notification tray using various Win32 API methods by sending messages to those notification tray windows to get them to refresh, but I haven't been able to get the right combination of setings. I am now leaving it for the next littlw while to concentrate on other issues.
2022-02-07 14:43:20 +13:00
Terry MacDonald
2e52e3ceb1 [WIP] Attempt to refresh Taskbar SystemTary and Overflow Notification Window
Trying to get rid of any left over applications that DIsplayMagician had to kill the process of, so that the system tray is nice and tidy. Having some issues doing so.
2022-02-06 21:54:00 +13:00
Terry MacDonald
4f64537d89 Update AMDLibrary and WinLibrary to skip HDR if connector doesn't support it
This works for WinLibrary and *should* work for AMDLibrary, but I don't have an AMD video card to test it with :(.
2022-02-06 15:33:15 +13:00
Terry MacDonald
2d31efd4d2 Working NVIDIA screen displayview for non-mosaic screens
Had to make a few changes to how it showed non-mosaic screens to make it more reliable
2022-02-06 13:47:30 +13:00
Terry MacDonald
f7a3c221a0 Fixed bug with displaying NVIDIA screens in UI
There was a bug in the way that NVIDIA screen layouts were calculated. This error was due to a misunderstanding from me on how additional screens were listed within a mosaic config. Turns out additional screens are still recorded in the mosaic config, only just as 1x1 display grids. The screen finding logic now takes this into account.
2022-02-06 11:52:47 +13:00
Terry MacDonald
81b565dfa6 Fixed taskbar move in profiletools 2022-02-05 21:28:51 +13:00
Terry MacDonald
9ff418fe07 [WIP] Populate the screens with the TaskBar edge
Need to do this so that we can draw the taskbar edge for the user in the views we show them.
2022-02-05 11:15:54 +13:00
Terry MacDonald
488ea803fc First attempt at skipping the HDR and colour settings on unsupported connection types
Let's see if this works. It will skip grabbing the color data and the HDR data on monitors that don't support it. That includes the following connections types: VGA, COMPONENT, SVIDEO, DVI, COMPOSITE. Any other connection types will attempt to get HDR and Colour settings, so that we'll automatically support whatever new technology arrives in the future.  Should help fix the last part of #76.
2022-02-04 21:53:17 +13:00
Terry MacDonald
3aa07257b8 Working Taskbar positioning
Finally managed to get taskbar positioning working perfectly. Also managed to add a 'Profile Tools' button which will allow the user to easily move the windows taskbar around the screen to different places. Please note that Windwows 11 taskbar only works at the top of the screen, or at the bottom. The taskbar will move to the left or right, but only the start button is shown :(. So I've disabled selecting left or right in Windows 11.
2022-02-04 21:30:52 +13:00
Terry MacDonald
3e150cc28b Success moving main taskbar without explorer restart
Woo hoo! I managed to make the main taskbar move by sending a custom message I found that Windows 10 sends to the main taskbar.
2022-02-04 17:37:52 +13:00
Terry MacDonald
c45e66275a [WIP] Removing manual setting of taskbar location in DM
The idea should be to make the changes directly to windows, and DisplayMagician will set things up the same as it recorded you'd set.
2022-02-03 09:20:06 +13:00
Terry MacDonald
3b34d6943d [WIP] Fixed taskbar ProfileSettingsFOrm 2022-02-02 21:59:00 +13:00
Terry MacDonald
a13aa60258 [WIP] TaskBar changes 2022-02-02 11:44:13 +13:00
Terry MacDonald
c9a349125d [WIP] Added forcing taskbar edge ability 2022-02-02 11:25:11 +13:00
Terry MacDonald
f6e5dbc0b7 [WIP] Refactor for taskbar code
Partially through a different refactor to completely change how the taskbar settigns are stored, and the logic behind the application. Should make the taskbar more robust to apply.
2022-02-01 22:04:08 +13:00
Terry MacDonald
cd25f9a0fa [WIP] Partially working taskbar moving 2022-01-30 20:24:36 +13:00
Terry MacDonald
362088b5e3 Added checks to pause updating displayconfig while display change occurring
Added some checks to temporarily pause any 'getconfig' type activities while we're changing the displayconfig. This should result in less config corruption, and fewer errors when there are timing edge cases.
2022-01-29 15:25:52 +13:00
Terry MacDonald
76ec3d6426 Fixed bug in TaskBar processing when ni edge available 2022-01-29 14:55:24 +13:00
Terry MacDonald
b12815dcff Fixed mistaken file copy 2022-01-28 17:18:20 +13:00
Terry MacDonald
7d0c8e1ca4 Updated NVIDIALibrary and WinLibrary to latest version 2022-01-28 17:04:42 +13:00
Terry MacDonald
4661ffb72f Removed restart logic from WinLibrary 2022-01-25 09:42:50 +13:00
Terry MacDonald
90149e1d9d Merged develop into feature-taskbar-setting branch 2022-01-25 09:30:23 +13:00
Terry MacDonald
be30996020 Changed the message shown to users to remove recreate message
We are able to patch the taskbar settings in DisplayProfiles without needing to get the users to remake their display proifiles. This changes the messaging to users.

This changes *should* be the last ones needed to get taskbar setting integrated. Fixes #78 (as much as we can fix it).
2022-01-25 09:28:13 +13:00
Terry MacDonald
f40863685c Modify tasbkarsettings to only get the useful settings
Also updated the code comments to describe the various values and what they mean.
2022-01-24 21:39:49 +13:00
Terry MacDonald
b6e0f83163 Working windows taskbar location tracking
Works on Win 10, and partially on Win 11. Win11 won't update the main window until explorer.exe is restarted :(. There is talk that an upcoming Win 11 update will change that behaviour.
2022-01-23 22:45:02 +13:00
Terry MacDonald
918e3cda04 Initial working TaskBar position changes
Note - doesn't work n Windows 11.
2022-01-23 10:33:14 +13:00
Terry MacDonald
587814409a [WIP] Added in TaskBarSettings and restarting explorer 2022-01-22 15:35:25 +13:00
Terry MacDonald
f860b91a72 Enforced update to file format v2.2 2022-01-21 20:37:56 +13:00
Terry MacDonald
f5a8a05e63 Removed unused settings 2022-01-21 18:34:31 +13:00
Terry MacDonald
195820bea6 Make load profile function handle later versions of config file
This change makes the ProfileRepository handle loading json config files from later versions of DM without causing an exception. This will mean that you can install later model config files and still have them work ok.
2022-01-21 18:09:04 +13:00
Terry MacDonald
b50b49af74 Updated some error levels 2022-01-19 22:35:50 +13:00
Terry MacDonald
29b592a6d1 Initial attempt at recording taskbar location
Used some of Soroush Falahati's amazing code, and now have the potential for storing the taskbar display layout. This unfortunately requires a display config change, so I will need to engineer some backwards compatibility.
2022-01-19 22:02:57 +13:00
Terry MacDonald
b148d7484a Updated HDR colour setting logic
The NVIDIA HDR colour logic was flawed, and wouldn't always apply properly. These logic changes now set the NVIDIA HDR colour back to windows controlled each time  so the settings are at a known inital logical state. Then winlibray can set the windows HDR mode, and NVIDIA can set the NVIDIA HDR mode.
2022-01-18 20:43:45 +13:00
Terry MacDonald
21b9cae0d5 Added 'Send to Clipboard' option
Adds #79.

Also added popup menu to DisplayProfile window as it was missing.
2022-01-17 21:07:48 +13:00
Terry MacDonald
d24b15d37a [WIP] Threading improvements
Found that I was combining Threads and Tasks together...never a good idea. Have moved fully over to a Task based model. Now still having issues with parallelism.
2022-01-10 21:06:02 +13:00
Terry MacDonald
8b7b5f2e75 Updated version to 2.2.0.1 2022-01-08 10:44:54 +13:00
Terry MacDonald
ddd48b577d Changed notification icon handling
Made the code more robust and able to work using the new threaded instances
2022-01-06 09:05:55 +13:00
Terry MacDonald
53df422944 Fixed UI issues and updated Shortcuts UI
Also updated EULA to 2022. And fixed the DisplayMagician Explorer update.
2021-12-27 09:58:29 +13:00
Terry MacDonald
146129a088 Updated to v2.1.4.1 2021-12-23 18:50:35 +13:00
Terry MacDonald
c87f55c4a9 Updated version to 2.1.3.0 for release 2021-12-21 09:30:49 +13:00
Terry MacDonald
648bbccaca Tweaked various UI features to support resizing
Improved the minimum form sizes for multiple forms to stop them looking bad.

Updated the DisplayMagician and DisplayMagicianShared assembly versions to v2.1.2.0 in preparation for release as the next version of DisplayMagician.
2021-12-18 21:55:39 +13:00
Terry MacDonald
97a4e5f170 Added resizable Shortcut Form 2021-12-18 14:38:00 +13:00
Terry MacDonald
da8d5de7c3 Fixed GUI display across multiple adapters
Found a bug in the NVIDIA screen generation logic. Fixed it, then replicated the fix in AMD and Windows functions.
2021-12-17 12:25:02 +13:00
Terry MacDonald
94e8ffe338 [WIP] Attempt to fix the GUI display for MST DisplayPort connections
Displays daisy-chained via DIsplayPort MST devices aren't shown in the GUI properly. First attempt at a fix.
2021-12-17 11:53:23 +13:00
Terry MacDonald
de1d93ee4d Updated WinLibrary to v1.3.8
This version adds USB device support, and SuperDisplay detection (it is a way to use an Android Tablet as another windows display).

Also fixes cloned displays so that it uses the path priority rather than relying on HDR settings for mapping the cloned display ID to the real Display ID. This corrects some errors which occurred when some earlier screens didn't support HDR or the advanced Windows colour settings. It will now work in those situations.
2021-12-16 12:25:11 +13:00
Terry MacDonald
22ae2bc178 Fixed multiple adapters and unsupported HDR parsing
Now supports multiple display adapters. Has been tested by @matthex with his 7 screens and 2 display adapters and works. Should fix #60 finally.

Also changed the way that cloned display configurations are patched. Was using the HDR structure previously as that contains a direct mapping, but of course it completely breaks if HDR information isn't supported by the monitor, or provided over the connection technology used. So the changes I made now use the display path priority order to figure out which cloned monitor belongs to which item.

Firstly, the UID's are pulled from the physical displays so that we have a list of them. We then go through the paths, and for each target we check if there is a matching physical UID. If there is NOT a matching physical ID, then it is a cloned display target. We store that for later.

Next, we go through the paths again, and we figure out which physical displays are NOT in use as display targets. When we have that list, we then map the left over physical displays to the cloned displays in path priority order.

Finally, we then go through each cloned display target in the paths array, and set it to the configuration that windows needs so it will make a cloned display. We also go through the modes array, and set the physical display id to the corresponding mapped physical UID we calculated earlier.

All of this results in Windows accepting the cloned display configuration as expected.
2021-12-12 09:23:24 +13:00
Terry MacDonald
9416ac3346 Updated WinLibrary to latest version
This corrects some errors with the WinLibrary and how it handles cloned displays.

Also removed the 0.5 second delay between the end of the NVIDIALibrary call, and the start of the WinLibrary one, because they do not appear to be needed based on the NVIDIALibrary testing we've been doing with NVIDIAInfo.

Also corrected some log entries and comments.
2021-12-11 00:15:49 +13:00
Terry MacDonald
a7ef20677d Fixed some log entry names 2021-12-09 08:40:51 +13:00
Terry MacDonald
d546bf85fb Added a WinLibrary update config to refresh config
I *think* that NVIDIA Surround and AMD Eyefinity changes are so great that WinLibrary gets confused and gives up. NVIDIA Surround and AMD Eyefinity affects the windows display layout so much. This change adds a windows config refresh after the NVIDIA or AMD config is applied to make sure that the winLibrary calls are using the latest updated active config that results from the NVIDIALibrary and AMDLibrary config changes.
2021-12-08 21:43:22 +13:00
terrymacdonald
041bdfe74f
Merge pull request #62 from terrymacdonald/dependabot/nuget/develop/NLog-4.7.13
Bump NLog from 4.7.12 to 4.7.13
2021-12-07 18:33:44 +13:00
Terry MacDonald
b34cdcce6c Updated to latest WinLibrary version
This version of WinLibrary improves handling of multiple display adapters to cope with multiple displays across multiple display adapters. Hopefully fixes #60 (but no guarantees yet)
2021-12-07 18:33:16 +13:00
dependabot[bot]
b826cc05fc
Bump NLog from 4.7.12 to 4.7.13
Bumps [NLog](https://github.com/NLog/NLog) from 4.7.12 to 4.7.13.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/compare/v4.7.12...v4.7.13)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-06 08:24:45 +00:00
Terry MacDonald
20a7c85279 Updated toast notification to work from zip install
Used some amazing code from David Air at https://gist.github.com/davidair/c4ea207bf6eece4ef08b97ab29a3036f to enable toasts without install from a setup program. This allows me to debug toasts within VS2019.
2021-12-03 10:38:29 +13:00
Terry MacDonald
03d15fb8e9 Updated ValveKeyValue to latest version
Have had problems in the past uprading to the latest version but this one worked fine!
2021-11-27 14:07:00 +13:00
Terry MacDonald
24d5014441 Updated to v2.1.1.1 2021-11-23 21:34:15 +13:00
Terry MacDonald
63fdf646c7 Assembly version updates to align version numbers 2021-11-19 22:34:48 +13:00
Terry MacDonald
b8c71191bb Update all builds to x64
No 32bit builds as no OS we can support is 32bit any more.
2021-11-19 22:26:03 +13:00
Terry MacDonald
77ab0f20f1 Updated NVIDIA Library and WinLibrary based on testing
Did a HUGE amount of testing with the amazing help of @domenic as part of #41, and we finally got the right configuration sorted out! This update is a reflection of the changes required.
2021-11-19 22:20:43 +13:00
Terry MacDonald
24efd1a8d8 Changes required by recent NVIDIALibrary changes 2021-11-13 21:32:13 +13:00