jjstecchino 8 Posted July 1, 2017 Share Posted July 1, 2017 PS I did not experience any blurriness. From what I read that may happen if you move your app from a monitor to another with different dpi. Frontview is designed to reside on one monitor so that should not be a problem. I read the article with the sample app for per monitor dpi awareness and it seems to add a great deal of complexity probably necessary if your app can be moved around different monitors. In FV case since it is stationary on one monitor, perhaps letting WPF appropriately scale the UI and using the m11/m12 hack to get the scale factor could be sufficient. I realize it is a half baked solution and not truly per monitor aware but it could be enough for this case scenario. If you remove [disableDPIawarness] does it break windows 8? Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 1, 2017 Author Share Posted July 1, 2017 (edited) Without [disableDPIawarness] WPF seems to be scaling the app automatically, respecting the per monitor settings in windows10 (not sure about 8.1). Are you recalculating the UI elements based on DPI? If not I would let WPF handle the scaling and the remaining issue is positioning. With [disapleDPIawareness] off the UI seems to position correctly but it is stretched * scale factor. I do not know if it this is due to running Debug as I have not be able to compile a release target. Can you give me some instructions on that? Changing target to release in the VS GUI does not cut it. Screen.Bounds seems to be returning Top and Left coordinates multiplied by the largest scale factor, regardless of which monitor the scaling has been set on. So for example if the large scale factor is 200% front view Top and Left are multiplied by 2. m11/m12 composition seems to be reliably returning the appropriate scale factor, dx seems to be always == dy (is there any case where dx != dy? can we use one of either one to set a var ScaleFactor?) Dividing Top/Left by dx=dy=ScaleFactor seems to reliably returning the right Top/Left coordinates. The screen positioning has to be recalculated based on the DPI - that is essentially the issue. Presume you can compile a release version?- just change configuration manager to release. If so the issue will be in the log - which is you need the sqllite.dll and the Yatse2.ico in the same directory - copy over. Yes - the screen position is calculated based on the DPI returned. On windows 8.1 the returned DPI was correct. On Windows 10 Creators update - the returned DPI only is correct if the application is PerMonitorDPIAware - otherwise it is 100%/96 dpi and the positioning is then wrong. This is the new Pinvoke in Init() try { if (Environment.OSVersion.Version.Major >= 6) { Logger.Instance().Log("FrontView+", "Display settings: Major >6 Settings PerMonitor DPI Aware",true); ScreenExtensions.ProcessDPIAwareness awareness; ScreenExtensions.GetProcessDpiAwareness(Process.GetCurrentProcess().Handle, out awareness); Logger.Instance().Log("DPI", "DPI Awareness equals: " + awareness.ToString(), true); ScreenExtensions.SetProcessDpiAwareness(ScreenExtensions.ProcessDPIAwareness.ProcessPerMonitorDPIAware); } } catch (EntryPointNotFoundException)//this exception occures if OS does not implement this API, just ignore it. { Logger.Instance().Log("Dpiaware", "OS does not support",true); } ScreenExtensions.ProcessDPIAwareness awareness2; try { ScreenExtensions.GetProcessDpiAwareness(Process.GetCurrentProcess().Handle, out awareness2); Logger.Instance().Log("DPI", "DPI Awareness After Setting equals: " + awareness2.ToString(), true); } catch { } & the new logging of the changes [08:41:37.7580] FrontView+ : Display settings: Major >6 Settings PerMonitor DPI Aware [08:41:37.7685] DPI : DPI Awareness equals: ProcessDPIUnaware [08:41:37.7786] DPI : DPI Awareness After Setting equals: ProcessPerMonitorDPIAware Have a read of the blog posts above - explains how much was cocked up in windows 8.1 and how much was recently changed Glenn Edited July 1, 2017 by GlennNZ Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 1, 2017 Share Posted July 1, 2017 But Top and Left for positioning are calculated from Screen.Bound.Location.X and .Y. These values seems to be the 100% coordinates * scale (as set in display settings). Do not see DPI in any calculation those values. Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 1, 2017 Author Share Posted July 1, 2017 But Top and Left for positioning are calculated from Screen.Bound.Location.X and .Y. These values seems to be the 100% coordinates * scale (as set in display settings). Do not see DPI in any calculation those values. That's is incorrect and needs to be updated/changed. And will do so now. It is caught in the positionscreen function which is called early and regularly - which updates window positioning based on dpi factors. There the dpi factors are applied to the screen bounds x/y- correcting the position. Glenn Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 1, 2017 Share Posted July 1, 2017 Glenn on Positionscreen you have screen bounds divided by the m11/m12 factors and positioning on my screen is correct, however the UI is magnified * 2 on a 200% scaling * 3 on 300% etc. Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 1, 2017 Author Share Posted July 1, 2017 (edited) The problem still is variable reporting of the DPI scale. With both monitors at 120 dpi - I correctly get this result from the GetDPIForMonitor call: PI GetDPIforMonitor:Effective:\\.\DISPLAY1 dpiX:120: dpiY:120 : <boolean>true</boolean> But the M11 and M12: [09:30:11.5230] Screens DPI ELSE after: Dx:1 and Dy:1 : <boolean>true</boolean> Report 1. Having said that the Screen Bounds is no longer scaled at all - so the screen correctly positions: <Size> <Width>2560</Width> <Height>1440</Height> </Size> With that 2560/1440 being the pixel/pixel correct screen bounds without any scaling. It looks like just setting PerMonitorDPIAware - means everything else falls into place. The question is can I do this on Windows 8.1 (Better log off and log on again - as was getting some changes in behaviour in DPI reporting if I didn't do that) Well scratch that! I log off and on again - and the behaviour has completed changed. Frontview window is now scaled up (which we don't want) m11/m12 are correctly reported at 1.25 and 1.25 Same as GetDPIForMonitor which is 120/120 Screen Bounds are unscaled - at 2560/1440 But correctly positioned. G Edited July 1, 2017 by GlennNZ Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 1, 2017 Share Posted July 1, 2017 Are you having issues with the UI getting magnified by the scale factor i.e. 1.25 in your case? if I leave [disableDPIawarness] my UI magnifies meaning WPF is not handling scaling anymore. Otherwise the behavior I observe is the same as yours after reboot Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 1, 2017 Share Posted July 1, 2017 I guess when you say FV windows scaled up you mean magnified right? Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 1, 2017 Share Posted July 1, 2017 Do you have a win 8.1 for testing? Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 2, 2017 Author Share Posted July 2, 2017 Are you having issues with the UI getting magnified by the scale factor i.e. 1.25 in your case? if I leave [disableDPIawarness] my UI magnifies meaning WPF is not handling scaling anymore. Otherwise the behavior I observe is the same as yours after reboot Yep - the Frontview window enlarges according to the DPI factor - because it should be DPIAware/perMonitor. Its aware for positioning - just not for total size unfortunately. Will need to scale the whole window/FrontView down depending on the scaling size to overcome. Working through that now. Glenn Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 2, 2017 Share Posted July 2, 2017 I believe that [disableDPIawareness] disable WPF automatic scaling so it needs to be handled in code Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 2, 2017 Share Posted July 2, 2017 Also watch out if you change scaling and you don't log off then on, the previous scaling gets reported to your app. Thats may be the issue you were having after reboot. Logging off is enough, reboot may not be necessary Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 2, 2017 Share Posted July 2, 2017 post Yatse2Windows.cs, I'd love following along Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 2, 2017 Author Share Posted July 2, 2017 (edited) post Yatse2Windows.cs, I'd love following along Can do. Have wrapped the xaml in a DPI class to scale depending on the dpi factor - works well for interior/but not whole box. Realised that could just adjust the window/screen resolution by whatever DPI factor - so doing that now. Working version of that is now up. Glenn Edited July 2, 2017 by GlennNZ Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 2, 2017 Author Share Posted July 2, 2017 Can do. Have wrapped the xaml in a DPI class to scale depending on the dpi factor - works well for interior/but not whole box. Realised that could just adjust the window/screen resolution by whatever DPI factor - so doing that now. Working version of that is now up. Glenn Seems to be working as expected across a number of dpi settings. Screen size and contents are always 1:1 regardless of DPI value. Positioning also working; but needs more testing. Unfortunatey don't think I have a windows 8.1 test system around - but will see. Maybe VM - and can try with one monitor Glenn Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 2, 2017 Author Share Posted July 2, 2017 post Yatse2Windows.cs, I'd love following along Uploading Version 1.260/Installer For further testing Seems great on windows 10, issue with be other lower windows versions Glenn Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 2, 2017 Share Posted July 2, 2017 Good Morning Glenn, 1.260 works very well, scales properly and responds to resolution and 2nd monitor position changes appropriately. A minor thing: The splash screen that normally appears on the primary monitor, is not scaling (i.e. at 200% the splash is smaller, at 300% it is much smaller) also it is not centered anymore but it is shifted toward the top left corner. It sees to be a coordinates translation issue. Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 2, 2017 Share Posted July 2, 2017 Actually to be correct the splash screen displays briefly in normal size and centering, then moves and resize to toward left and top and then slowly fades Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 2, 2017 Author Share Posted July 2, 2017 Good Morning Glenn, 1.260 works very well, scales properly and responds to resolution and 2nd monitor position changes appropriately. A minor thing: The splash screen that normally appears on the primary monitor, is not scaling (i.e. at 200% the splash is smaller, at 300% it is much smaller) also it is not centered anymore but it is shifted toward the top left corner. It sees to be a coordinates translation issue. Thanks.Had noticed that and made some changes to timing of dpiaware setting to overcome (Which haven't workedO I believe it is because the application is becoming dpiaware at startup; and literally when the splash screen is displayed. Will keep it on back burner and see what can do - but splash is essentially part of wpf - so probably can't do much more. Need to test on two monitor windows 8/8.1 machine.... Glenn Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 2, 2017 Share Posted July 2, 2017 Great job on the per monitor DPI. If you need me to test anything let me know and.... Thank you Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 3, 2017 Author Share Posted July 3, 2017 (edited) Great job on the per monitor DPI. If you need me to test anything let me know and.... Thank youThanksHave posted 1.261 which fixes the splash screen issue (moved the routine even closer to start) Also updates Sqllite and newtonsoftjson dlls to latest version (and includes in source) New installer should be up (was a small hiccup with first installer as forgot to include sql.interop.dll which is now needed) Can also confirm / works well on Windows 10 prior to Creators update. I would hope that means it should also run without problem on windows 8 and 8.1, but more testing the better. Glenn Sent from my iPhone using Tapatalk Edited July 3, 2017 by GlennNZ Link to comment Share on other sites More sharing options...
jjstecchino 8 Posted July 3, 2017 Share Posted July 3, 2017 Glenn it is working perfectly . Thanks Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 3, 2017 Author Share Posted July 3, 2017 Glenn it is working perfectly . ThanksGood to hear- thanks for your help. And it seems is working in 8.1 fine from what I hear.Glenn Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 9, 2017 Author Share Posted July 9, 2017 Update to Version 1.266 Latest updates bring dpi awareness and scaling and customisable sizing for all screens. (enables complete customisation at any screen size) - DPI Aware/Scales properly - ALL Size - slider for changing the size of everything - Kodi remote: If fanart entry is blank will use the thumbnail (can add setting to turn on/off - but looks better than default in my testing) What are these changes do you say? The Below ALL Size slider changes the interior Scaling of Frontview - ever screen's scaling is changed. This allows you to have tiny tiny text and huge artwork or huge text, obscuring most of the artwork: For example : (All these screen sizes are at 1024x768) Lets make the screen as tiny as possible: (the setting screen updates immediately to new size) & All other screens are also resized: Now Playing screen: (again all screen sizes are 1024x768) And if we turn up ALL Size to maximum (we lose some of the settings screen...) Now Playing screen: (again all screen sizes are 1024x768) All screens change including - Movie/TV and Time/Weather starting screen: Link to comment Share on other sites More sharing options...
GlennNZ 83 Posted July 9, 2017 Author Share Posted July 9, 2017 (edited) Update to Version 1.266 Latest updates bring dpi awareness and scaling and customisable sizing for all screens. (enables complete customisation at any screen size) - DPI Aware/Scales properly - ALL Size - slider for changing the size of everything - Kodi remote: If fanart entry is blank will use the thumbnail (can add setting to turn on/off - but looks better than default in my testing) What are these changes do you say? The Below ALL Size slider changes the interior Scaling of Frontview - every screen's scaling is changed. This allows you to have tiny tiny text and huge artwork or huge text, obscuring most of the artwork: For example : (All these screen sizes are at 1024x768) Lets make the screen as tiny as possible: (the setting screen updates immediately to new size) & All other screens are also resized: Now Playing screen: (again all screen sizes are 1024x768) And if we turn up ALL Size to maximum (we lose some of the settings screen...) Now Playing screen: (again all screen sizes are 1024x768) All screens change including - Movie/TV and Time/Weather starting screen: Up on GitHub Glenn Edited August 19, 2017 by GlennNZ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now