Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

1.3.3 dev 10

Skyfighter
40
40
Posts: 127
Joined: 2014-12-31 22:10

Re: 1.3.3 dev 10

Post by Skyfighter »

Cool, seems to be pretty perfect: Double-click, maximize-button and CTRL+ALT+F12 now all restore window on Last Position! Thank you very much Thomas! :thumbs:
Skyfighter wrote:If you are in fullscreen-mode and use the minimize-button (title bar, 3rd from the right) the window-position (of the fullscreen-viewer) should NOT be saved/NOT overwrite the last saved window position of the viewer. (Currently: If you bring back the minimized fullscreen-viewer and switch to window mode the last window position is lost = window will be positioned top left on the screen.)
This is now fixed as long as you switched to fullscreen mode using maximize-button or CTRL+ALT+F12, but using double-click (on title bar) still results in lost last window position = window will be positioned top left on the screen. (It doesn't matter how SavePos/SaveSize are set)


Stumbled about another one: "viewer window does not utlitize available free space in heigh/y-axis and shows vertical scroll-bar"
(Viewer: AutoScaling disabled - instead: fixed Scaling, e.g. 100% or 150% ; easier to reproduce with SavePos=0 & SaveSize=0)
If the remote screen does not fit local screen (single-monitor) in horizontal dimension/x-axis (e.g. remote server by default shows/presents two remote monitors): the viewer not only shows a horizontal/x-axis scroll bar (this is ok & needed) but a vertical/y-axis scrollbar, too (not ok: viewer window height could be bigger to show full height of remote screen -> there is enough free space and thus no need to reduce window height and show a vertical scrollbar).
Not sure why the viewer does not show the full height of the remote screen although it could (= enough unused local free space in height)!?

Edit 31/07/21 09:35: Tried to describe the new point better, hope it is understandable!?
Skyfighter
40
40
Posts: 127
Joined: 2014-12-31 22:10

Re: 1.3.3 dev 10

Post by Skyfighter »

ddengine @ Win10-v2004: fallback to schook every day
Since Rudi improved ddengine initialization in march-2021 (see viewtopic.php?t=37146&start=30#p109459, viewtopic.php?t=37146&start=30#p109469) it worked flawless for me on my test-pc (Win10-v1909, v1.3.3-dev5/14.03.2021).
Until a few weeks ago when my test-pc got updated to Win10-v2004: now, every morning/new day I'm stuck on schook (instead of ddengine), no matter how often I disconnect & reconnect the viewer session. If I restart the uvnc_service once, it utilitizes ddengine for the rest of the day (as if there were no problem)...until next morning when it uses schook again.
Although I am watching it, I have not been able to find any clues as to why there is a fallback to schook every day/morning:
  • problem started with Win10-v2004 (did not exist under Win10-v1909); problem exists @Win10-2004 with v1.3.3-dev5/14.03.2021 and v1.3.3-dev10/16.05.2021
  • process-ids of both winvnc.exe do not change over night (although: first day = ddengine, next day = schook); (= does not look to me as if the service would crash overnight or restart automatically)
  • pc is switched on continuously all the time (no standby/hibernate/...)
  • (next day = schook): the viewer connection state "hangs" 2-3 seconds (noticeably longer than with ddengine) in the state "Password accepted" before the viewer shows the remote screen
  • (next day = schook): it does not matter how often I disconnect&reconnect the viewer; it does not matter if there is a wait-time between disconnect&reconnect -> it remains on using schook
Any ideas what I could do to further analyse this? Am I the only one who sees a ddenginge failure like that? Any help is appreciated!
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6863
Joined: 2004-04-23 10:21
Contact:

Re: 1.3.3 dev 10

Post by Rudi De Vos »

Signed build with your latest code.
https://uvnc.eu/download/133/vncviewer133dev11.zip

Do you have any logging, for the ddengine.
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

Thank you,

Is "vncviewer.cpp" not Updated? DPI per Monitor v2 is not active

https://1drv.ms/f/s!AkdsiVHAVCeBhjFMuxmAGxOAqLdT

Uploaded 2 Pictures to see difference of dpi aware
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

with your exe, see Logfile (the Window is very small)

Time to use the actual WindowsSDK ?


Logfile

Code: Select all

...
Geometry 3840 x 1080 depth 24
Screen work area is 5760 x 80
Reset keyboard for first use
Flush dead key gives: 1 character(s): 0x0020 ( )
Clipboard changed
Ignore Clipboard while initializing!
No next window in chain; WM_DRAWCLIPBOARD will not be passed
SetClipboardViewer to 0x00190578; next is 0x00000000. Last error 0x00000000Screen work area is 5760 x 80
Update-processing thread started
Screen work area is 5760 x 80
Screen work area is 5760 x 80
Screen work area is 5760 x 80
Requesting new pixel format
Receiving cursor shape update, cursor 32x32
bufsize expanded to 16640
Receiving cursor shape update, cursor 32x32
My Exe
Remote=3840 x 1080
Open on Monitor 1 (4k)
Move to Monitor 2/3 Full HD
And Move Back

Code: Select all

Geometry 3840 x 1080 depth 24
Screen work area is 3840 x 2080
Reset keyboard for first use
Flush dead key gives: 1 character(s): 0x0020 ( )
Clipboard changed
Ignore Clipboard while initializing!
No next window in chain; WM_DRAWCLIPBOARD will not be passed
SetClipboardViewer to 0x00090908; next is 0x00000000. Last error 0x00000000Screen work area is 3840 x 2080
Update-processing thread started
Screen work area is 3840 x 2080
Screen work area is 3840 x 2080
Screen work area is 3840 x 2080
Requesting new pixel format
Receiving cursor shape update, cursor 32x32
bufsize expanded to 16640
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Screen work area is 7680 x 2080
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Receiving cursor shape update, cursor 32x32
Reset keyboard for first use
Flush dead key gives: 1 character(s): 0x0020 ( )
Screen work area is 3840 x 2080
rdr::Exception (1): rdr::SystemException: read: Unknown error (10004)
Update-processing thread finishing
WndProchwnd ChangeClipboardChain hwnd 0x00090908 / m_hwndcn 0x00090908, 0x00000000 (1)
Deregistered connection from app
Exiting
VNC viewer closing down
for the next weeks i have no many time
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6863
Joined: 2004-04-23 10:21
Contact:

Re: 1.3.3 dev 10

Post by Rudi De Vos »

dpi only seems to work if you also set the manifest.
DPI Awareness Per Monitor High DPI AWare
It should also work without any setting else we get problems with all version < 1703 as they don't support V2.

//Min Vista
typedef BOOL(*SetProcessDPIAwareFunc)();
//Min Windows 8.1
typedef HRESULT(*SetProcessDpiAwarenessFunc) (PROCESS_DPI_AWARENESS);
//Min Windows 10, version 1703
typedef HRESULT(*SetProcessDpiAwarenessContextFunc) (DPI_AWARENESS_CONTEXT);

We need to use some cascade
If not supported or it fail use an older method.

Code: Select all

	HRESULT hr = S_FALSE;
	if (SetProcessDpiAwarenessContextF) {
		hr = SetProcessDpiAwarenessContextF(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
	if (hr != S_OK && setDPIpiAwarenessF)
		hr = setDPIpiAwarenessF(PROCESS_PER_MONITOR_DPI_AWARE);
	if (hr != S_OK && (setDPIAwareF))
		setDPIAwareF();
Changes pushed to git, merged with your latest code

Reuploaded build, with latest changesd and manifest set.
https://uvnc.eu/download/133/vncviewer133dev11.zip
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

Check with this Tool

https://docs.microsoft.com/en-us/sysint ... s/sigcheck
sigcheck64.exe -m "vncviewer.exe"

Code: Select all

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*' />
    </dependentAssembly>
  </dependency>
</assembly>

For Enable PerMonitorV2 only in Manifest, this must be in manifest

Code: Select all

...
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> <!-- adding v1 as fallback would result in v2 not being applied to dialogs on capable systems -->
...
In Git
FullScreenTitleBar.cpp
CreateToolTipForRect(Photo, PhotoTip, "Screenshot, dubble click for settings");
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

with your new exe, per Monitor v1 is active

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
	<dependency>
		<dependentAssembly>
			<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"/>
		</dependentAssembly>
	</dependency>
	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
		<security>
			<requestedPrivileges>
				<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
			</requestedPrivileges>
		</security>
	</trustInfo>
	<application xmlns="urn:schemas-microsoft-com:asm.v3">
		<windowsSettings>
			<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
		</windowsSettings>
	</application>
</assembly>
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

I Download from Git
don´t upgrade (I have Visual Studio 2019)
manualy select Windows SDK 10.0 (newest)
Plattformtoolset v142
Kompile and per Monitor v1 is active

Disable Manifesttool/DPI in Settings and per Monitor v2 is active
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6863
Joined: 2004-04-23 10:21
Contact:

Re: 1.3.3 dev 10

Post by Rudi De Vos »

Disable Manifesttool/DPI in Settings and per Monitor v2 is active
Yep, i did the same.
using 141 and sdk 10.0.18362.0

I still need to test on older win10 without v2 and win7 and 8.

win7 single screen ok
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

See Picture in Onedrive: "SetStretchBltMode 1BLACKONWHITE 2COLORONCOLOR 3HALFTONE .png"

Only If Scaling is 200% or 300%, the Result is better if simply double the pixel


ClientConnection.cpp Line 5022

Code: Select all

else
			{

				int n = m_opts.m_scale_num;
				int d = m_opts.m_scale_den;
				int m = n % d;
				if (m == 0)
					// Text at High DPI Monitor 200% or 300% 
					SetStretchBltMode(hdc, BLACKONWHITE);
					//SetStretchBltMode(hdc, COLORONCOLOR);
					//SetStretchBltMode(hdc, HALFTONE);
				else
					SetStretchBltMode(hdc, HALFTONE);

				SetBrushOrgEx(hdc, 0, 0, NULL);
				{
					if (m_hmemdc)
					{
						ObjectSelector bb(m_hmemdc, m_membitmap);
						StretchBlt(
							hdc,
							ps.rcPaint.left,
							ps.rcPaint.top,
							ps.rcPaint.right - ps.rcPaint.left,
							ps.rcPaint.bottom - ps.rcPaint.top,
							m_hmemdc,
							(ps.rcPaint.left + m_hScrollPos)     * d / n,
							(ps.rcPaint.top + m_vScrollPos)      * d / n,
							(ps.rcPaint.right - ps.rcPaint.left) * d / n,
							(ps.rcPaint.bottom - ps.rcPaint.top) * d / n,
							SRCCOPY);
					}
				}
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

Remove from Git ?

vncviewer_VC2017.vcxproj
<Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
</Manifest>
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

Viewer

I the connection is lost. The Restore/ConnectionLost Dialog is on a Other Monitor.
if click "Close" in this Dialog, the Dialog is Closed and the connection is restored -> OK
if you only see the window of the client connection and close the clientconnection window. The Dialog on the Other monitor is not closed. -> Close Dialog also, and Exit
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

New Viewer Exe in Onedrive

New Option:
Not in GUI, only Inifile

if AutoScalingEven=1
AutoScaling only scale to 100,200 or 300%

For other Scaling "Scale to Window" is faster

options.vnc

Code: Select all

[options]
AutoScaling=1
AutoScalingEven=1
Other Fix AutoScaling no Boarder in calculation if Fullscreen

toDo
SessionDialog.cpp after DPI change
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

merge with git code
Now Autosize scale is OK (no Border, biggest possible window)

Faster and better result for other then 100,200,300% is to use "scale to window" (directX)
Autosize is working with directX in window mode too.

toDo
keep aspect ratio for Fullscreen in directX (Only if Autosize?)
GUI

https://1drv.ms/f/s!AkdsiVHAVCeBhjFMuxmAGxOAqLdT
Skyfighter
40
40
Posts: 127
Joined: 2014-12-31 22:10

Re: 1.3.3 dev 10

Post by Skyfighter »

@Thomas Levering
I have a dumb question: Comparing your test builds with older/released vncviewer builds I am not able to find any changes regarding "dpi behaviour" until now. I'm using a older windows 10 release (v1803 / build 17134) on my pc and there is only one monitor with 4k resolution (3840x2160) and 150% scaling connected. Since I'm running this setup (for a few years now) I'm using vncviewer with 150% Scaling (otherwise remote screens are too small). But shouldn't your "dpi awareness" development/improvents make this 150% vncviewer scaling setting obsolete (because your code should respect/apply the windows scaling setting)?
(For example the toolbar-buttons of your test builds look the same compared to old released vncviewer builds - but shouldn't they be scaled (= shown bigger) according to the windows 150% scaling setting? This makes me believe something doesn't work as expected on my side.)
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6863
Joined: 2004-04-23 10:21
Contact:

Re: 1.3.3 dev 10

Post by Rudi De Vos »

All patches and changes from ( Thomas and tyan0) are in 1.3.3 dev 12.
Please test with this version
Skyfighter
40
40
Posts: 127
Joined: 2014-12-31 22:10

Re: 1.3.3 dev 10

Post by Skyfighter »

Had not seen the new topics - thanks Rudi!
Unfortunately I can't see any change with dev12 viewer (built: Aug 26 2021 21:04:09) either: Toolbar icons remain tiny and I have to set vncviewer scaling to 150% to see server screen contents in a meaningful size (= Windows 150% scaling is ignored). What am I doing wrong?
Thomas Levering
40
40
Posts: 84
Joined: 2015-01-23 06:45

Re: 1.3.3 dev 10

Post by Thomas Levering »

1.
FullScreenTitleBar Is not in dev12 and not in Git (changed Files in my Onedrive)
2.
Toolbar is the old
3.
many changes are with >=2 Monitors and different DPI
4.
Autosize changed.
New setting „Even“
Try scale 200% and enable/disable „scale to window“ to see difference
I use Autosize Even, if move a window from 4k to hd Monitor, the size change from 100% to 200%.
Locked