Commit Graph

103 Commits

Author SHA1 Message Date
Terry MacDonald
181b3b8a9a Added AMD display rotation awareness
Fixes #153. AMD display profiles with rotated displays will now show that rotation properly in the display layout. Last commit included NVIDIA and Windows, and this now means all supported video cards now have this feature so the issue can be closed.
2022-12-28 20:16:05 +13:00
Terry MacDonald
97664100e8 Added ability to show display rotation for NVIDIA and Windows
Added display rotation awareness to the Screen awareness parsing. This code is used to create the generic 'Screens' structures that are used to generate the display profile icons. This partially fixes #153. I still have to add the AMD configuration equivalent!
2022-12-27 21:40:52 +13:00
Terry MacDonald
8cc59583e1 Updated branch with latest develop hotfixes 2022-07-15 09:04:56 +12:00
Terry MacDonald
eefa361773 Fixed error when returning from Mosaic layouts in WIndows 10
There was an error that occurred in NvAPI_SetDisplayConfig when attempting to go from an NVIDIA Surround to a non-NVIDIA Surround setup on a machine that has multiple video cards installed in it. This is due to the fact that the NVIDIA driver only sees the displays connected to NVIDIA video adapters.

The previous DM logic tried to set the DisplayConfig after switching to or from a Surround display profile, but this would fail when returning from a a Surround display profile on Win 10 devices. It appears that the NVIDIA driver AUTOMATICALLY disables all additional displays in windows when it returns from a Surround profile. This simple fact means that the DisplayConfig won't be applied properly, and it errors with an NVAPI_INVALID_ARGUMENT error. This doesn't actually matter though, as the WinLibrary comes to the rescue.

WinLibrary can see all the video adapters available, and so will turn the required displays back on and set them up just right! We *may* lose are some specific DisplayConfig parameters abeing set as part of this process, but I'm not totally sure about that as WinLibrary is basically feature parity with the DisplayConfig settings as far as I can tell.

The fix is to look specifically for the NVAPI_INVALID_ARGUMENT error when attempting to set the NvAPI_DisplayConfig, and if this happens we check if we were going from a surround profile to a non-surround profile. If that is true, then we simply ignore that error. WinLibrary then clears up that problem and everything proceeds as normal.

This should (fingers crossed) fix #119!

This change also makes it far faster to grab and set the tabaskbar settings from registry, though this logic may not detect some Windows 10 formats which appear to be LOCALDISPLAY(\d,\d,\d\d) settings which I've never seen before. It should be generally much faster and more reliable.
2022-07-14 22:41:59 +12:00
Terry MacDonald
cb51ea9245 Set all the JSON.net default values
We now properly set the default JSON values for everything except Display Profiles, which should avoid crashes to desktop if we miss setting a value from it's default in the future. This should help with application robustness.
2022-07-08 09:59:29 +12:00
Terry MacDonald
83b8938e1a Reduces config scanning delay as much as possible
WinLibrary currently waits 5 seconds if it can't read the taskbar registry, and then it tries again. This is because based on my testing, if a screen layout changes, windows takes up to 20 seconds to update registry to record this fact. We have to wait until windows has finished 4 times before we are sure to have passed the 20 second window.

This is likely the delay you have mentioned. I *think* that I can slightly speed this up. We only MUST to do this delay when we are recording the config (i.e. creating a new display profile), and other times it's kind of a nice to have. So I've attempted to speed this up using a 'fastScan' option for the WinLibrary GetActiveConfig function. This will enable it to only query once for the general scans of the active config, and if there is a problem getting the data it will just accept that fact and will still return quickly. But it will still take up to 20 seconds when creating a new display profile as it is REALLY important we get that data correctly.

Fixes #129
2022-07-02 15:08:54 +12:00
Terry MacDonald
e99db6d4af Updated NLog exception logging format to capture all details
Updated the NLog exception handling to make use of the additional logging options released recently. This will help provide me with more details when users create the Support ZIP File.
2022-06-28 13:47:56 +12:00
Terry MacDonald
e893fbac69 Increased logging and improved uplay library processing 2022-06-17 10:18:55 +12:00
Terry MacDonald
cb43f74629 Fixed potential bug with window taskbar location during screen generation
There is a possibility that there are two displays with the same UID. This happens with software created displays such as SpaceDesk and Superdisplay. This means that we need to try and figure out which screen is the right screen, and then when we know which screen we were really wanting to
2022-06-10 18:52:26 +12:00
Terry MacDonald
3fba28087c Made TaskBarLayout creation more robust
TaskBarLayout now catches exceptions recording the taskbar location and handles them properly. It will skip any screenss that it cannot access the taskbar information for. The Screen layout generator for NVIDIA, AMD and Windows have all been updated to handle having no taskbar layout information (it just assumes the taskbar is down the bottom of the screen).

Hopefully fixes #114
2022-06-02 19:51:07 +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
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
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
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
37b9a79ff2 [WIP] Partial integration of new libraries.
Still some bits broken.
2022-03-25 21:51:38 +13:00
Terry MacDonald
87f62aa322 Made display changes reliable 2022-02-12 09:18:03 +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
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
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
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
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
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
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
Terry MacDonald
24efd1a8d8 Changes required by recent NVIDIALibrary changes 2021-11-13 21:32:13 +13:00
Terry MacDonald
f72fc6feea Attempted to reduce the number of video card library calls
Found some calls that were bypassing the video library state buffering I'd put in place earlier. This should generally make DisplayMagician faster and minimise the number of log entries written to DisplayMagician.log.
2021-10-31 12:50:57 +13:00
Terry MacDonald
cc125b6601 Add an extra layer of library protection
Stopping unneeded AMD calls in NVIDIA mode, and NVIDIA calls in AMD mode.
2021-10-29 22:10:29 +13:00
Terry MacDonald
3ea0ff479b Updated screen drawing so surround displays work with additional screens
The display logic now works when both NVIDIA surround and normal windows are both being used at the same time.
2021-10-28 20:57:16 +13:00
Terry MacDonald
51b03c7c1c Fixed issue updating the current display profile
The profile updating logic wouldn't work with the new way of buffering the display config, which means that when swapping back to DisplayMagician after updating the display layout wouldn't automatically update the display profile. Now, it forces this.
2021-10-24 21:34:43 +13:00
Terry MacDonald
419969ad5f Changed profile detection
Changed Profiles to use new methods for profiles detection provided by the new video card library updates for NVIDIALibrary, AMDLibrary and WinLibrary. This should make DisplayMagician faster as there is less repetition.
2021-10-24 21:29:53 +13:00
Terry MacDonald
2ee4c90c3c Small improvement in video library access speed 2021-10-17 20:55:59 +13:00
Terry MacDonald
81f2d08fe0 Fixed profile matching for cloned displays
Weird error where having a clone causes an extra 'zeroed out' entry in the Windows Display Modes sequence. This change modifies the Windows mode info checks to allow for this situation.
2021-10-17 10:44:03 +13:00
Terry MacDonald
cf1ff873ef Added patch to convert v2.0.1 displaySource to list
This should help avoid a crash to desktop when using cloned displays. Partially fixes #47
2021-10-16 16:45:49 +13:00
Terry MacDonald
e41279d706 Improved NVIDIALIbrary SetActiveOverride function
It now only applies configuration changes if they are needed to be applied. If the colour settings are the same then they aren't applied.
2021-10-09 19:58:22 +13:00
Terry MacDonald
c5b06988dd Fixed broken apply profile logic
Changed an AND to a NAND and now it works.
2021-10-09 18:42:50 +13:00
Terry MacDonald
8d060edf83 Updated ProfileItem so it applies overrides later
Updated the profile so that it applies the new split video application process properly to DisplayMagician profiles. Should fix #45 (we shall soon see).
2021-10-07 21:15:14 +13:00
Terry MacDonald
e0bb774fde First fully working AMD Eyefinity implementation.
AMD Eyefinity now works just as well as the NVIDIA implementation... probably even more robustly than the NVIDIA one. Fixes #37 and #21. I'll now start on some other bugfixing and features in preparation for DisplayMagician v2.0.0
2021-09-21 21:21:10 +12:00