After more 2 000 000 (two million) views on forum for 1.5.0.x development versions... and 1.6.1.0, 1.6.3.0-dev versions
A new stable version, UltraVNC 1.6.4.0 and UltraVNC SC 1.6.4.0 have been released: https://forum.uvnc.com/viewtopic.php?t=38095
Feedback is always welcome

2025-12-14: 1.7.1.X-dev release builds need tests and feedback: https://forum.uvnc.com/viewtopic.php?t=38134

2025-12-02: We need help: English Wikipedia UltraVNC page has been requested to deletion: https://forum.uvnc.com/viewtopic.php?t=38127
Any help is welcome to improve the UltraVNC page and/or to comment on the Wikipedia Talk page

2025-05-06: Forum password change request: https://forum.uvnc.com/viewtopic.php?t=38078

2023-09-21: Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Development: UltraVNC development is always here... Any help is welcome
Feedback is welcome

Scroll bar handling

Any features you would like to see in UltraVNC? Propose it here
Post Reply
neitsch
Posts: 1
Joined: 2006-08-05 21:42

Scroll bar handling

Post by neitsch »

Hmm, the developer forums are locked down, and the bbcode is double-spacing my patches. Is this the right place to post this?

I fixed some things in UltraVNC 1.0.2 that weren't doing what I expected:

Don't show the scrollbars if things fit inside the window.
[syntax="c"]
--- ClientConnection.cpp 2006/08/05 18:05:00 1.1
+++ ClientConnection.cpp 2006/08/05 18:30:15
@@ -2103,15 +2103,26 @@
else
SetRect(&fullwinrect, 0, 0, m_si.framebufferWidth, m_si.framebufferHeight);

- AdjustWindowRectEx(&fullwinrect,
- GetWindowLong(m_hwnd, GWL_STYLE) & ~WS_VSCROLL & ~WS_HSCROLL,
- FALSE, GetWindowLong(m_hwnd, GWL_EXSTYLE));
- /*
+
+ if(m_hScrollBarVisible) {
+ fullwinrect.bottom += GetSystemMetrics(SM_CXHSCROLL);
+ }
+ if(m_vScrollBarVisible) {
+ fullwinrect.right += GetSystemMetrics(SM_CXVSCROLL);
+ }
+
+/*
AdjustWindowRectEx(&fullwinrect,
GetWindowLong(m_hwndMain, GWL_STYLE),
FALSE, GetWindowLong(m_hwndMain, GWL_EXSTYLE));
- */
+*/

+ AdjustWindowRectEx(&fullwinrect,
+ GetWindowLong(m_hwnd, GWL_STYLE) & ~WS_VSCROLL & ~WS_HSCROLL,
+ FALSE, GetWindowLong(m_hwnd, GWL_EXSTYLE));
+
+
+
m_fullwinwidth = fullwinrect.right - fullwinrect.left;
m_fullwinheight = (fullwinrect.bottom - fullwinrect.top);

@@ -2477,7 +2488,7 @@
rgbQ.r = ((((i >> m_myFormat.redShift) & m_myFormat.redMax) * 65535) + m_myFormat.redMax/2) / m_myFormat.redMax;
}

- for (i=0; i<256; i++)
+ for (int i=0; i<256; i++)
{
bi.color.rgbRed = rgbQ.r >> 8;
bi.color.rgbGreen = rgbQ.g >> 8;
@@ -5459,14 +5470,22 @@

#ifndef UNDER_CE
if (_this->InFullScreenMode() ||
- _this->m_winwidth >= _this->m_fullwinwidth &&
+ _this->m_winwidth >= _this->m_fullwinwidth) {
+ ShowScrollBar(hwnd, SB_HORZ, FALSE);
+ _this->m_hScrollBarVisible = FALSE;
+ } else {
+ ShowScrollBar(hwnd, SB_HORZ, TRUE);
+ _this->m_hScrollBarVisible = TRUE;
+ }
+
+ if(_this->InFullScreenMode() ||
_this->m_winheight >= (_this->m_fullwinheight + ((Rtb.bottom - Rtb.top) )) ) {
//_this->m_winheight >= _this->m_fullwinheight ) {
- ShowScrollBar(hwnd, SB_HORZ, FALSE);
ShowScrollBar(hwnd, SB_VERT, FALSE);
+ _this->m_vScrollBarVisible = FALSE;
} else {
- ShowScrollBar(hwnd, SB_HORZ, TRUE);
ShowScrollBar(hwnd, SB_VERT, TRUE);
+ _this->m_vScrollBarVisible = TRUE;
}
#endif

--- ClientConnection.h 2006/08/05 18:05:00 1.1
+++ ClientConnection.h 2006/08/05 18:01:54
@@ -482,6 +482,9 @@

// Window may be scrollable - these control the scroll position
int m_hScrollPos, m_hScrollMax, m_vScrollPos, m_vScrollMax;
+ // Whether the scroll bars are visible
+ BOOL m_hScrollBarVisible;
+ BOOL m_vScrollBarVisible;
// The current window size
int m_winwidth, m_winheight;
__int64 m_BytesSend;
[/code]

Scroll when mouse wheeling over the vertical scrollbar.

Code: Select all

--- ClientConnection.cpp	2006/08/05 18:42:15	1.2
+++ ClientConnection.cpp	2006/08/05 20:10:13	1.3
@@ -5597,7 +5597,20 @@
 					
 					// RealVNC 335 method
 				case WM_MOUSEWHEEL:
-					if (!_this->m_opts.m_ViewOnly)
+					if(DefWindowProc(hwnd, WM_NCHITTEST, 0,	lParam) == HTVSCROLL) {
+						int scrollDelta = -short(HIWORD(wParam));
+
+						UINT uScroll;
+						if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0)) {
+							uScroll = 3;    /* default value */
+						}
+
+						if (uScroll == 0) {
+							return 0;
+						}
+
+						_this->ScrollScreen(0, scrollDelta / 10 * uScroll);
+					} else if (!_this->m_opts.m_ViewOnly)
 						_this->ProcessMouseWheel((SHORT)HIWORD(wParam));
 					return 0;
 [/syntax]

[mod=494,1154820132]replaced code by syntax=c[/mod]
Last edited by neitsch on 2006-08-05 23:22, edited 1 time in total.
Post Reply