Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Fix Windows pointer (#40639) #40890

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ codegen-units = 1
# This rev hash corresponds to https://github.com/Devolutions/IronRDP/pull/436. It is being merged while that PR is
# still open in IronRDP in order to get these changes into a release, however it should be updated once that PR is
# merged. In the meantime, no other IronRDP hash's (without these changes) should be used.
ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac", features = ["rustls"]}
ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "e5bd2beab54bee2cf173cc110a804df2e709a1ac" }
ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275", features = ["rustls"]}
ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "49dab7d8df4bd785bf17fce97ac02beaba0b0275" }
1 change: 1 addition & 0 deletions lib/srv/desktop/rdp/rdpclient/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ fn create_config(params: &ConnectParams, pin: String) -> Config {
autologon: true,
pointer_software_rendering: false,
performance_flags: PerformanceFlags::default()
| PerformanceFlags::DISABLE_CURSOR_SHADOW // this is required for pointer to work correctly in Windows 2019
| if !params.show_desktop_wallpaper {
PerformanceFlags::DISABLE_WALLPAPER
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ function TdpClientCanvas(props: Props) {
}
}, [client, clientOnPngFrame]);

const previousCursor = useRef('auto');

useEffect(() => {
if (client && updatePointer) {
const canvas = canvasRef.current;
Expand All @@ -110,20 +108,29 @@ function TdpClientCanvas(props: Props) {
hotspot_y?: number;
}) => {
if (typeof pointer.data === 'boolean') {
if (pointer.data) {
canvas.style.cursor = previousCursor.current;
} else {
previousCursor.current = canvas.style.cursor;
canvas.style.cursor = 'none';
}
canvas.style.cursor = pointer.data ? 'default' : 'none';
return;
}
const cursor = document.createElement('canvas');
let cursor = document.createElement('canvas');
cursor.width = pointer.data.width;
cursor.height = pointer.data.height;
cursor
.getContext('2d', { colorSpace: pointer.data.colorSpace })
.putImageData(pointer.data, 0, 0);
if (pointer.data.width > 32 || pointer.data.height > 32) {
// scale the cursor down to at most 32px - max size fully supported by browsers
const resized = document.createElement('canvas');
let scale = Math.min(32 / cursor.width, 32 / cursor.height);
resized.width = cursor.width * scale;
resized.height = cursor.height * scale;

let context = resized.getContext('2d', {
colorSpace: pointer.data.colorSpace,
});
context.scale(scale, scale);
context.drawImage(cursor, 0, 0);
cursor = resized;
}
canvas.style.cursor = `url(${cursor.toDataURL()}) ${
pointer.hotspot_x
} ${pointer.hotspot_y}, auto`;
Expand Down