Comments (23)
In the above sentence are you referring to the scrolling issue or screen resolution?
The scrolling issue.
For the resolution issue... A larger DPI should be used when launching the X server for now. Hard to change the DPI on the fly. Also, I believe Xfce is not that good at HiDPI.
from selkies-gstreamer.
Is there a difference between the resolution of your client and the resolution of the remote screen?
from selkies-gstreamer.
I'm sorry @ehfd , I didn't get it. What do you mean by client vs remote screen resolution?
Are you talking about screen resolution?
from selkies-gstreamer.
Could you post a screenshot of the menu (small crescent at the right) so that the two things underlined are visible?
from selkies-gstreamer.
Sure, now I get it. Here is the screenshot.
from selkies-gstreamer.
Okay. The screen resolution is the same. It's another bug.
from selkies-gstreamer.
Potentially solvable in tandem to #98
from selkies-gstreamer.
From what I observed:
- In the JS code, input.js, the 'mousewheel' event it getting triggered almost 3x time on touchpad swipe compared to physical mouse wheel events.
- Also in webrtc_input.py, the self.mouse.scroll(dx, 1) method just scrolls one notch up or down (-1 and 1).
So I'm thinking as touchpad scroll event are thrice than mouse scroll, thus making the scrolling fast. Please correct me if I'm wrong.
from selkies-gstreamer.
You're right. We will fix that.
However, we are still unsure why the Mac's touchpad is hypersensitive in whatever browser you are using. We would need more information on your environment.
from selkies-gstreamer.
Related to #76.
from selkies-gstreamer.
Here's my environment information:
- Brave browser version: [Version 1.57.53 Chromium: 116.0.5845.114 (Official Build) (x86_64)]
- MacBook Pro 2020, Os version: macOS Ventura 13.4.1
- I've also tried in google chrome as well: Version 117.0.5938.132 (Official Build) (x86_64).
I remember trying to access the remote desktop few weeks back via windows laptop as well using brave browser and had encountered same scrolling sensitive issue with touchpad. Please let me know if more information is needed. Thank you!
from selkies-gstreamer.
@ehfd I'm not an expert in python or js but I'd like to work on this issue. Could you guide me please.
from selkies-gstreamer.
I also reproduce in Windows.
from selkies-gstreamer.
Hello @ehfd, any update on this issue?
I've actually tried a workaround for this, in which I tried to reduce the mouse scroll events that are being sent to remote client by the following logic. (basically setting a timeframe of 150ms before sending the next scroll event to remote client)
_isTouchpad(deltaY) {
return deltaY && Number.isInteger(deltaY) ? true : false;
}
_mouseWheelWrapper(event) {
if (this._isTouchpad(event.deltaY)) {
if (this.allowTrackpadScrolling) {
// stop trackpad scroll event until next 150ms
this.allowTrackpadScrolling = false;
this._mouseWheel(event);
setTimeout(() => {this.allowTrackpadScrolling = true}, 150)
}
} else {
this._mouseWheel(event);
}
}
I can see a difference upon scrolling the system applications like scrolling in terminal, but when it comes to browsers in remote client, it's still same as before (scrolling is still hypersensitive).
Also one small doubt, may I know why the icons are too small when the remote and client resolution is same.
![Screenshot 2023-10-01 at 6 50 16 PM](https://private-user-images.githubusercontent.com/57227290/273501039-1fc81130-3f07-470c-94b1-dd42c6d5c512.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU4MjAyNDAsIm5iZiI6MTcxNTgxOTk0MCwicGF0aCI6Ii81NzIyNzI5MC8yNzM1MDEwMzktMWZjODExMzAtM2YwNy00NzBjLTk0YjEtZGQ0MmM2ZDVjNTEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTE2VDAwMzkwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU2NWJhNGI2NGU1ZmNiZDc3M2QyMmI5ZmY5YWEzNTE2NTRkYjcwNmZhZjZmZGI0Nzg0NjM1YjVjYTk1Yjg3Y2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RDDS1nlNQM3IMQ3JhNbjLnfXsp1dEm6Kz7LbTqDd4zY)
from selkies-gstreamer.
Thanks for your investigation. Greatly appreciate it.
Looks like this needs a solution from the JavaScript side. We will investigate the issue and come back to you.
from selkies-gstreamer.
Thanks to you for replying.
Looks like this needs a solution from the JavaScript side.
In the above sentence are you referring to the scrolling issue or screen resolution?
from selkies-gstreamer.
I have moved the DPI issue to #110.
from selkies-gstreamer.
Hi @ehfd. I actually got some working solution to this hypersensitiveness of scroll for touchpad. Let me know what you think of this
So the problem here as stated before is, the number of events that get triggered for scroll on touchpad is much higher in number compared to typical mouse wheel. This is due to the effect of continuous scroll
or accelerated scroll
as mentioned here: https://developer.mozilla.org/en-US/docs/Web/API/Element/mousewheel_event#chrome
If the device supports continuous scroll (e.g., trackpad of MacBook or mouse wheel which can be turned smoothly), the value is computed from accelerated scroll amount.
To mitigate this I tried setting a threshold
to limit the amount of the scroll events being sent to the server as said long before #99 (comment). But this does't provide the smoother scroll effect.
When looked into neko, I saw the same technique of limiting number of events, but instead of just sending an event with button_mask just to scroll one notch up/down, they're sending a magnitude of value.
_mouseWheel(event) {
var mtype = (document.pointerLockElement ? "m2" : "m");
var button = 3;
if (event.deltaY < 0) {
button = 4;
}
// truncate the floating point decimal numbers and get an absolute value
var deltaY = Math.abs(Math.trunc(event.deltaY));
// this._scrollMagnitue=10
var magnitude = Math.min(deltaY, this._scrollMagnitude);
var mask = 1 << button;
var toks;
// Simulate button press and release.
for (var i = 0; i < 2; i++) {
if (i === 0)
this.buttonMask |= mask;
else
this.buttonMask &= ~mask;
toks = [
mtype,
this.x,
this.y,
this.buttonMask,
magnitude
];
this.send(toks.join(","));
}
event.preventDefault();
}
And on the server side I'd modified the part to support sending of multiple scroll events to X server based on the received magnitude. It's working quite reasonably compared to before.
But this fails to provide smooth scrolling in devices other than Mac. This is because the delta values differ from device to device. In mac the least delta value is 1 and in other devices it could be 4 or 5, producing different levels of granularity based on the hardware of the device and OS. This kind of makes the scrolling at high pace than user intended pace on non-mac devices.
So to mitigate this I tried to normalise the values by taking the least delta as a scale factor and scale the subsequent values with this factor. This resolved the issue of touchpad on other devices.
But, fails for mouse wheel events of non-mac devices by producing much slower scroll effect. This is due to the delta values being constant in most of the devices (except for Mac's connected mice) and exists in the range of 100 to 130. By applying the normalising technique, the delta values would always end up at a constant value 1
in mouse wheel generated events. Thus producing much slower scroll effect due to constant magnitude of 1
and threshold
of mouse wheel events.
To resolve this we've two options:
- make the mouse wheel events as
continuous scroll
just like mac does, so that we'd have inertia scrolling that would generate more number of events. - or remove the threshold on mouse wheel events
I've chosen the second approach (as it's easier to manipulate things at hand than to generate non existing ones) to remove the threshold on mouse wheel events. This solved the problem for touchpads and mice both in mac and non-mac devices.
Kindly let me know your thoughts on this approach. I've the changes ready and can make the PR as soon as possible.
from selkies-gstreamer.
@PMohanJ Lovely!
I like the approaches.
from selkies-gstreamer.
I've pushed the image to docker hub. You can test it by spinning up a container:
docker run -d --name selkies-dev -p 8080:8080 -p 3478:3478 pmohanj/selkies-dev-scroll:latest
Note: If you shift from touchpad to mouse, then the transition won't be smooth for 3-4 scroll notches. This is due to the fact that the scale factor needs to be adjusted.
Also the touchpad scrolling is still bit sensitive (it wouldn't be as same as our physical devices). This is primarily due to the fact that browsers still abstract the actual input event that occur that OS level, so we don't have raw inputs to manipulate them. And on the servers side the package pynput
is basically calling the XTEST
extension module of Xserver that was originally intended to test Xserver functions. So all it does is button press and release, which is same as XTestFakeButtonEvent that neko is using
int XTestFakeButtonEvent(display, button, is_press, delay);
Display *display;
unsigned int button;
Bool is_press;
unsigned long delay;
So on the server side we don't really have much control.
from selkies-gstreamer.
@PMohanJ Do you have the PR?
from selkies-gstreamer.
And perhaps investigating #102 in conjunction would help with a lot of hassle. Would it be possible?
from selkies-gstreamer.
I'll open a PR in few minutes.
And yeah, I'll try that #102 issue as well.
from selkies-gstreamer.
Related Issues (20)
- Various issues related to clipboard relaying HOT 18
- Issue with touchpad: cursor does not respond when one keyboard button is continued to be held HOT 3
- Support remote controlling retro console devices HOT 10
- Support Selkies Joystick Interposer in 32-bit (especially Wine), support manual installation in addition to DEB HOT 2
- Long hold ESC to exit full screen in the web interface does not work in certain cases and many key combinations leak to the client OS HOT 10
- [META] Rewrite gst-web HTML5 interface frontend HOT 5
- Audio randomly gets disabled after latest changes to webrtcbin HOT 12
- Various Resize/DPI improvements with the user interface and the cursor HOT 7
- Support extended stylus or touch gestures HOT 1
- x264 encoder failing to initialize HOT 3
- Add option to manually specify XAuthority files for login greeters HOT 3
- Audio does not play on "START" button press HOT 5
- Cannot start stream with NvFBC HOT 4
- Implement WebRTC statistics logging in host HOT 2
- Keyboard keystrokes continue to be held when packets are lost by congestion or unstable connection / Improve the last bit of keyboard latency overall while accommodating unstable connections HOT 3
- Instead of erroring with no audio server, restore server-side --disable_audio CLI option or automatically detect no PulseAudio server
- Achieve higher efficiency and quality in low-bandwidth and high-latency environments
- Gstreamer pipeline is not starting HOT 14
- Scale relative mouse movement which becomes slower or faster than normal depending on client and host resolution
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from selkies-gstreamer.