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

enable retina scale factor #7269

Merged
merged 2 commits into from
Feb 27, 2024
Merged

enable retina scale factor #7269

merged 2 commits into from
Feb 27, 2024

Conversation

21pages
Copy link
Collaborator

@21pages 21pages commented Feb 27, 2024

#6980 #5246

  • Enabled only when there are only one video service
  • Scale mouse event, remote cursor position, remote menu display button, and adjust resolution menu
rustdesk_Y7s7nqxHiM.mp4

multi window:

rustdesk_qiOAhTgRTx.mp4

Old version control mac retina screen
rustdesk_JrsBXWCcIA

#[cfg(target_os = "macos")]
Some(message::Union::CursorPosition(pos)) => {
if let Some(msg) = conn.retina.on_cursor_pos(&pos, conn.display_idx) {
sent = true;
Copy link
Owner

@rustdesk rustdesk Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not rewrite msg here.
msg = new_msg

video_service_count += 1;
}
}
*scrap::quartz::ENABLE_RETINA.lock().unwrap() = video_service_count < 2;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the first one can be retina, then following subscription will be not-retina. If so, there is still issue for multiple window/display case, because the first display is retina, the other displays are not.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another worse case, the capture uses retina, but the subscriber's displays info shows non-retina.

Copy link
Collaborator Author

@21pages 21pages Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scrap::quartz::ENABLE_RETINA is a global control and is used when querying the display size in display service in a loop , so "use retina as retina" or all non-retina.
A display is retina when BackingScaleFactor > 1.0 and ENABLE_RETINA is true

Copy link
Owner

@rustdesk rustdesk Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not put here, you should put in connection.rs. because multiple connections with one subscription for each connection should still can use retina.

Copy link
Collaborator Author

@21pages 21pages Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

video_service_count is the number of video services with subscriber, or captured screen count. When multiple connections are connected to the same screen, they will share the same video service, and count is 1.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about one subscribe to display 1, another one subscribe to display 2?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can ignore this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

video_service_count will be 2.

both display 1:
image

one connection display 1 and another disply 2

image

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about one subscribe to display 1, another one subscribe to display 2?

For this, retina is fine. But we can ignore this case.

@rustdesk
Copy link
Owner

I did not see you test multiple windows.

@21pages
Copy link
Collaborator Author

21pages commented Feb 27, 2024

I did not see you test multiple windows.

Updated to the above, but found another problem. video_service_count can be 0 when there is a connection. It may be a sequence problem. I will find the reason. (Because on_subscribe and on_unsubscribe are also called in add_connection, remove_connection.)

@@ -629,7 +633,7 @@ impl Connection {
},
Some((instant, value)) = rx.recv() => {
let latency = instant.elapsed().as_millis() as i64;
let msg: &Message = &value;
let mut msg= value;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format

@21pages 21pages force-pushed the retina branch 3 times, most recently from faead91 to 3fb3237 Compare February 27, 2024 09:16
}
None
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add #[inline] for above 3 functions

* enabled only when there are only one video service running
* scale mouse event
* scale cursor position
* scale remote menu display button
* adjust resolution

Signed-off-by: 21pages <pages21@163.com>
@rustdesk rustdesk merged commit 50d080d into rustdesk:master Feb 27, 2024
7 checks passed
jurykor pushed a commit to spikszma/rustdesk that referenced this pull request Apr 8, 2024
* enable retina scale factor

* enabled only when there are only one video service running
* scale mouse event
* scale cursor position
* scale remote menu display button
* adjust resolution

Signed-off-by: 21pages <pages21@163.com>

* Update server.rs

---------

Signed-off-by: 21pages <pages21@163.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants