From 159d7527955f131e096cf1602b7f9f66cc5d66cb Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 10 Sep 2021 18:11:35 +0000 Subject: [PATCH 1/9] Update noVNC commit --- kasmweb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmweb b/kasmweb index e0bb9f6..d1e4bda 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit e0bb9f6bcf945da6cb10fd0eb48b63b48bf09bb8 +Subproject commit d1e4bda4b3ed118ed90752ffe0f08b9ead0851c9 From 3f680a7b803e23a44b434f4d2604c19324ce2f74 Mon Sep 17 00:00:00 2001 From: mmcclaskey Date: Thu, 23 Sep 2021 14:04:19 -0400 Subject: [PATCH 2/9] KASM-1913 webp mode tweaks (#55) Co-authored-by: matt --- common/rfb/TightWEBPEncoder.cxx | 18 +++++++++--------- kasmweb | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/rfb/TightWEBPEncoder.cxx b/common/rfb/TightWEBPEncoder.cxx index 4953ff4..74c109c 100644 --- a/common/rfb/TightWEBPEncoder.cxx +++ b/common/rfb/TightWEBPEncoder.cxx @@ -71,12 +71,12 @@ static const struct TightWEBPConfiguration conf[10] = { { 24, 0 }, // 1 { 30, 0 }, // 2 { 37, 0 }, // 3 - { 42, 1 }, // 4 - { 65, 1 }, // 5 - { 78, 1 }, // 6 - { 85, 2 }, // 7 - { 88, 3 }, // 8 - { 100, 4 } // 9 + { 42, 0 }, // 4 + { 65, 0 }, // 5 + { 78, 0 }, // 6 + { 85, 0 }, // 7 + { 88, 0 }, // 8 + { 100, 0 } // 9 }; @@ -143,7 +143,7 @@ void TightWEBPEncoder::compressOnly(const PixelBuffer* pb, const uint8_t quality method = conf[qualityIn].method; } else { quality = 8; - method = 4; + method = 0; } WebPConfigInit(&cfg); @@ -214,7 +214,7 @@ void TightWEBPEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) method = conf[qualityLevel].method; } else { quality = 8; - method = 4; + method = 0; } WebPConfigInit(&cfg); @@ -265,7 +265,7 @@ rdr::U32 TightWEBPEncoder::benchmark() const rdr::U8* buffer; struct timeval start; int stride, i; - const uint8_t quality = 8, method = 4; + const uint8_t quality = 8, method = 2; WebPConfig cfg; WebPPicture pic; WebPMemoryWriter wrt; diff --git a/kasmweb b/kasmweb index d1e4bda..a0907e9 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit d1e4bda4b3ed118ed90752ffe0f08b9ead0851c9 +Subproject commit a0907e9390e8a135a280f7e4157eced05b8ec687 From dd26c40844f6c1a19ce5c70e685e49abcd353049 Mon Sep 17 00:00:00 2001 From: mmcclaskey Date: Thu, 23 Sep 2021 18:49:52 -0400 Subject: [PATCH 3/9] KASM-1970 fix broken pipeline (#56) Allow jobs to fail if they are not required for the greater KAsm. Later we should modify this to not allow a fail fo rrelease branches --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c8584fb..771a4ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,7 @@ stages: build_ubuntu_bionic: stage: build + allow_failure: true before_script: - *prepare_build after_script: @@ -36,6 +37,7 @@ build_ubuntu_bionic: build_ubuntu_bionic_libjpeg_turbo: stage: build + allow_failure: false before_script: - *prepare_build after_script: @@ -48,6 +50,7 @@ build_ubuntu_bionic_libjpeg_turbo: build_ubuntu_focal: stage: build + allow_failure: true before_script: - *prepare_build after_script: @@ -60,6 +63,7 @@ build_ubuntu_focal: build_debian_buster: stage: build + allow_failure: true before_script: - *prepare_build after_script: @@ -72,6 +76,7 @@ build_debian_buster: build_debian_bullseye: stage: build + allow_failure: true before_script: - *prepare_build after_script: @@ -84,6 +89,7 @@ build_debian_bullseye: build_kali_rolling: stage: build + allow_failure: true before_script: - *prepare_build after_script: @@ -96,6 +102,7 @@ build_kali_rolling: build_centos7: stage: build + allow_failure: true before_script: - *prepare_build after_script: From 93e47e5d541e540459050da5626f8ab67739d486 Mon Sep 17 00:00:00 2001 From: mmcclaskey Date: Fri, 24 Sep 2021 08:25:35 -0400 Subject: [PATCH 4/9] Bugfix/kasm 1912 websocket crash (#57) * Copy-paste bug in SSE2 scaling to under 0.5x * Better handling of websocket frames * KASM-1912 websocket crash, scaling bug Co-authored-by: Lauri Kasanen Co-authored-by: matt --- common/network/websockify.c | 23 +++++++++++++---------- common/rfb/EncodeManager.cxx | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/common/network/websockify.c b/common/network/websockify.c index a97c189..f0a322a 100644 --- a/common/network/websockify.c +++ b/common/network/websockify.c @@ -44,11 +44,11 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) { int maxfd, client = ws_ctx->sockfd; unsigned int opcode, left, ret; unsigned int tout_start, tout_end, cout_start, cout_end; - unsigned int tin_start, tin_end; + unsigned int tin_end; ssize_t len, bytes; tout_start = tout_end = cout_start = cout_end = - tin_start = tin_end = 0; + tin_end = 0; maxfd = client > target ? client+1 : target+1; while (1) { @@ -165,7 +165,7 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) { } if (FD_ISSET(client, &rlist)) { - bytes = ws_recv(ws_ctx, ws_ctx->tin_buf + tin_end, BUFSIZE-1); + bytes = ws_recv(ws_ctx, ws_ctx->tin_buf + tin_end, BUFSIZE-1-tin_end); if (pipe_error) { break; } if (bytes <= 0) { handler_emsg("client closed connection\n"); @@ -180,13 +180,13 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) { printf("\n"); */ if (ws_ctx->hybi) { - len = decode_hybi(ws_ctx->tin_buf + tin_start, - tin_end-tin_start, + len = decode_hybi(ws_ctx->tin_buf, + tin_end, ws_ctx->tout_buf, BUFSIZE-1, &opcode, &left); } else { - len = decode_hixie(ws_ctx->tin_buf + tin_start, - tin_end-tin_start, + len = decode_hixie(ws_ctx->tin_buf, + tin_end, ws_ctx->tout_buf, BUFSIZE-1, &opcode, &left); } @@ -208,10 +208,13 @@ static void do_proxy(ws_ctx_t *ws_ctx, int target) { break; } if (left) { - tin_start = tin_end - left; - //printf("partial frame from client"); + const unsigned tin_start = tin_end - left; + //handler_emsg("partial frame from client, %u left, start %u end %u, lens %lu %lu\n", + // left, tin_start, tin_end, bytes, len); + memmove(ws_ctx->tin_buf, ws_ctx->tin_buf + tin_start, left); + tin_end = left; } else { - tin_start = 0; + //handler_emsg("handled %lu/%lu bytes\n", bytes, len); tin_end = 0; } diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 30489c7..9a079bc 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -1024,7 +1024,7 @@ PixelBuffer *rfb::progressiveBilinearScale(const PixelBuffer *pb, rdr::U8 *newpx = ((ManagedPixelBuffer *) newpb)->getBufferRW(newpb->getRect(), &newstride); - SSE2_scale(oldpx, tgtw, tgth, newpx, oldstride, newstride, tgtdiff); + SSE2_scale(oldpx, tgtw, tgth, newpx, oldstride, newstride, tgtw / (float) oldw); if (del) delete pb; } From 5a1f9b9ae27d9a537d170f18503caea97dd341a5 Mon Sep 17 00:00:00 2001 From: mmcclaskey Date: Wed, 29 Sep 2021 13:47:14 -0400 Subject: [PATCH 5/9] Update README download link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4356ecb..a618547 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Future Goals: #### Debian-based ```sh -wget -qO- https://github.com/kasmtech/KasmVNC/releases/download/v0.9.1-beta/kasmvncserver_0.9.1~beta-1_amd64.deb +wget -qO- https://github.com/kasmtech/KasmVNC/releases/download/v0.9.2-beta/kasmvncserver_ubuntu_bionic_0.9.2_amd64.deb sudo dpkg -i kasmvncserver_0.9.1~beta-1_amd64.deb sudo apt-get -f install From e470021ca65e4b7c988a14aacfaf8cfe3789f1d1 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Sun, 3 Oct 2021 13:33:04 -0400 Subject: [PATCH 6/9] KASM-1985 Address build failures by updating Centos CA certs --- builder/dockerfile.centos_core.build | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/dockerfile.centos_core.build b/builder/dockerfile.centos_core.build index 4574075..c277e1a 100644 --- a/builder/dockerfile.centos_core.build +++ b/builder/dockerfile.centos_core.build @@ -3,6 +3,7 @@ FROM centos:centos7 ENV KASMVNC_BUILD_OS centos ENV KASMVNC_BUILD_OS_CODENAME core +RUN yum update -y ca-certificates RUN yum install -y build-dep xorg-server libxfont-dev sudo RUN yum install -y gcc cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver RUN yum install -y libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev openssl-devel From 3f3d31312c68f485303b362b3ff13df230a93276 Mon Sep 17 00:00:00 2001 From: mmcclaskey Date: Mon, 4 Oct 2021 10:48:14 -0400 Subject: [PATCH 7/9] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a618547..6d13c51 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Future Goals: ```sh wget -qO- https://github.com/kasmtech/KasmVNC/releases/download/v0.9.2-beta/kasmvncserver_ubuntu_bionic_0.9.2_amd64.deb -sudo dpkg -i kasmvncserver_0.9.1~beta-1_amd64.deb +sudo dpkg -i kasmvncserver_*.deb sudo apt-get -f install # We provide an example script to run KasmVNC at # From 0a45fcc700e848146794abf46d6a90fad72bb61a Mon Sep 17 00:00:00 2001 From: Mariusz Marciniak Date: Thu, 16 Sep 2021 04:10:19 -0700 Subject: [PATCH 8/9] KASM-1871 Add smooth scrolling Previously all scrolling relied on "clicking" the up/down or left/right scroll buttons which made it unprecise and to always scroll at the same speed. Now we pass the scroll delta directly to the xorg input driver so the scroll is more responsinve and adaptive. --- .gitmodules | 2 +- common/rfb/InputHandler.h | 4 +++- common/rfb/SMsgReader.cxx | 4 +++- common/rfb/VNCSConnectionST.cxx | 4 ++-- common/rfb/VNCSConnectionST.h | 2 +- kasmweb | 2 +- unix/xserver/hw/vnc/Input.c | 30 +++++++++++++++++++++++++-- unix/xserver/hw/vnc/Input.h | 1 + unix/xserver/hw/vnc/XserverDesktop.cc | 11 ++++++---- unix/xserver/hw/vnc/XserverDesktop.h | 2 +- 10 files changed, 48 insertions(+), 14 deletions(-) diff --git a/.gitmodules b/.gitmodules index e43a13a..bcb6a03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "kasmweb"] path = kasmweb url = https://github.com/kasmtech/noVNC.git - branch = master + branch = feature/KASM-1871_scroll_sensitivity diff --git a/common/rfb/InputHandler.h b/common/rfb/InputHandler.h index 806625f..e16a810 100644 --- a/common/rfb/InputHandler.h +++ b/common/rfb/InputHandler.h @@ -38,7 +38,9 @@ namespace rfb { virtual void pointerEvent(const Point& __unused_attr pos, int __unused_attr buttonMask, const bool __unused_attr skipClick, - const bool __unused_attr skipRelease) { } + const bool __unused_attr skipRelease, + int scrollX, + int scrollY) { } virtual void clientCutText(const char* __unused_attr str, int __unused_attr len) { } }; diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx index de5e1b3..b9d3491 100644 --- a/common/rfb/SMsgReader.cxx +++ b/common/rfb/SMsgReader.cxx @@ -223,7 +223,9 @@ void SMsgReader::readPointerEvent() int mask = is->readU8(); int x = is->readU16(); int y = is->readU16(); - handler->pointerEvent(Point(x, y), mask, false, false); + int scrollX = is->readS16(); + int scrollY = is->readS16(); + handler->pointerEvent(Point(x, y), mask, false, false, scrollX, scrollY); } diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index bd24229..10e265c 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -692,7 +692,7 @@ void VNCSConnectionST::setPixelFormat(const PixelFormat& pf) setCursor(); } -void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease) +void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease, int scrollX, int scrollY) { pointerEventTime = lastEventTime = time(0); server->lastUserInputTime = lastEventTime; @@ -720,7 +720,7 @@ void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool } } - server->desktop->pointerEvent(pointerEventPos, buttonMask, skipclick, skiprelease); + server->desktop->pointerEvent(pointerEventPos, buttonMask, skipclick, skiprelease, scrollX, scrollY); } } diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h index 86c99c6..4262337 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -204,7 +204,7 @@ namespace rfb { virtual void queryConnection(const char* userName); virtual void clientInit(bool shared); virtual void setPixelFormat(const PixelFormat& pf); - virtual void pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease); + virtual void pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease, int scrollX, int scrollY); virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); virtual void framebufferUpdateRequest(const Rect& r, bool incremental); virtual void setDesktopSize(int fb_width, int fb_height, diff --git a/kasmweb b/kasmweb index a0907e9..d20e5d7 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit a0907e9390e8a135a280f7e4157eced05b8ec687 +Subproject commit d20e5d78fac5a8866dba5bff2585cd4bb75f7fc9 diff --git a/unix/xserver/hw/vnc/Input.c b/unix/xserver/hw/vnc/Input.c index f8ac3fd..e8f9170 100644 --- a/unix/xserver/hw/vnc/Input.c +++ b/unix/xserver/hw/vnc/Input.c @@ -234,6 +234,14 @@ void vncPointerMove(int x, int y) cursorPosY = y; } +void vncScroll(int x, int y) { + ValuatorMask mask; + valuator_mask_zero(&mask); + valuator_mask_set(&mask, 2, x); + valuator_mask_set(&mask, 3, y); + QueuePointerEvents(vncPointerDev, MotionNotify, 0, POINTER_RELATIVE, &mask); +} + void vncGetPointerPos(int *x, int *y) { if (vncPointerDev != NULL) { @@ -261,7 +269,7 @@ static int vncPointerProc(DeviceIntPtr pDevice, int onoff) * is not a bug. */ Atom btn_labels[BUTTONS]; - Atom axes_labels[2]; + Atom axes_labels[4]; switch (onoff) { case DEVICE_INIT: @@ -278,11 +286,29 @@ static int vncPointerProc(DeviceIntPtr pDevice, int onoff) axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); + axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL); + axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL); + InitPointerDeviceStruct(pDev, map, BUTTONS, btn_labels, (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), - 2, axes_labels); + 4, axes_labels); + + InitValuatorAxisStruct(pDevice, 2, axes_labels[2], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative); + InitValuatorAxisStruct(pDevice, 3, axes_labels[3], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative); + + char* envScrollFactorH = getenv("SCROLL_FACTOR_H"); + char* envScrollFactorV = getenv("SCROLL_FACTOR_V"); + + float scrollFactorH = envScrollFactorH ? atof(envScrollFactorH) : 50.0; + float scrollFactorV = envScrollFactorV ? atof(envScrollFactorV) : 50.0; + + LOG_INFO("Mouse horizonatl scroll factor: %f", scrollFactorH); + LOG_INFO("Mouse vertical scroll factor: %f", scrollFactorV); + + SetScrollValuator(pDevice, 2, SCROLL_TYPE_HORIZONTAL, scrollFactorH, SCROLL_FLAG_NONE); + SetScrollValuator(pDevice, 3, SCROLL_TYPE_VERTICAL, scrollFactorV, SCROLL_FLAG_PREFERRED); break; case DEVICE_ON: pDev->on = TRUE; diff --git a/unix/xserver/hw/vnc/Input.h b/unix/xserver/hw/vnc/Input.h index 76680c0..ddc4e06 100644 --- a/unix/xserver/hw/vnc/Input.h +++ b/unix/xserver/hw/vnc/Input.h @@ -35,6 +35,7 @@ void vncInitInputDevice(void); void vncPointerButtonAction(int buttonMask, const unsigned char skipclick, const unsigned char skiprelease); void vncPointerMove(int x, int y); +void vncScroll(int x, int y); void vncGetPointerPos(int *x, int *y); void vncKeyboardEvent(KeySym keysym, unsigned xtcode, int down); diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 1e9d663..a892128 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -446,11 +446,14 @@ void XserverDesktop::approveConnection(uint32_t opaqueId, bool accept, void XserverDesktop::pointerEvent(const Point& pos, int buttonMask, - const bool skipClick, const bool skipRelease) + const bool skipClick, const bool skipRelease, int scrollX, int scrollY) { - vncPointerMove(pos.x + vncGetScreenX(screenIndex), - pos.y + vncGetScreenY(screenIndex)); - vncPointerButtonAction(buttonMask, skipClick, skipRelease); + if (scrollX == 0 && scrollY == 0) { + vncPointerMove(pos.x + vncGetScreenX(screenIndex), pos.y + vncGetScreenY(screenIndex)); + vncPointerButtonAction(buttonMask, skipClick, skipRelease); + } else { + vncScroll(scrollX, scrollY); + } } unsigned int XserverDesktop::setScreenLayout(int fb_width, int fb_height, diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h index 014a48e..70394fa 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.h +++ b/unix/xserver/hw/vnc/XserverDesktop.h @@ -90,7 +90,7 @@ public: // rfb::SDesktop callbacks virtual void pointerEvent(const rfb::Point& pos, int buttonMask, - const bool skipClick, const bool skipRelease); + const bool skipClick, const bool skipRelease, int scrollX = 0, int scrollY = 0); virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); virtual unsigned int setScreenLayout(int fb_width, int fb_height, const rfb::ScreenSet& layout); From 24e21325ef3a68cb88059b9691888e0054f5f7f4 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Tue, 12 Oct 2021 13:37:40 -0400 Subject: [PATCH 9/9] KASM-1871 Pull in submodule from tip of master --- .gitmodules | 2 +- kasmweb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index bcb6a03..e43a13a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "kasmweb"] path = kasmweb url = https://github.com/kasmtech/noVNC.git - branch = feature/KASM-1871_scroll_sensitivity + branch = master diff --git a/kasmweb b/kasmweb index d20e5d7..a4cf389 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit d20e5d78fac5a8866dba5bff2585cd4bb75f7fc9 +Subproject commit a4cf38902911e9ff07e9d3eb7909c5ba932a5089