Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions benches/src/perfenc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
#![allow(clippy::print_stdout)]

use core::time::Duration;
use std::{io::Write, time::Instant};
use std::io::Write;
use std::time::Instant;

use anyhow::Context;
use ironrdp::pdu::rdp::capability_sets::{CmdFlags, EntropyBits};
use ironrdp::server::{
bench::encoder::{UpdateEncoder, UpdateEncoderCodecs},
BitmapUpdate, DesktopSize, DisplayUpdate, PixelFormat, RdpServerDisplayUpdates,
};
use tokio::{fs::File, io::AsyncReadExt, time::sleep};
use ironrdp::server::bench::encoder::{UpdateEncoder, UpdateEncoderCodecs};
use ironrdp::server::{BitmapUpdate, DesktopSize, DisplayUpdate, PixelFormat, RdpServerDisplayUpdates};
use tokio::fs::File;
use tokio::io::AsyncReadExt;
use tokio::time::sleep;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), anyhow::Error> {
Expand Down
9 changes: 5 additions & 4 deletions crates/iron-remote-desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ macro_rules! make_bridge {

#[wasm_bindgen(js_name = extensionCall)]
pub fn extension_call(
&self,
ext: $crate::Extension,
) -> Result<$crate::internal::wasm_bindgen::JsValue, IronError> {
<<$api as $crate::RemoteDesktopApi>::Session as $crate::Session>::extension_call(ext).map_err(IronError)
<<$api as $crate::RemoteDesktopApi>::Session as $crate::Session>::extension_call(&self.0, ext)
.map_err(IronError)
}
}

Expand Down Expand Up @@ -439,11 +441,10 @@ macro_rules! make_bridge {

#[doc(hidden)]
pub mod internal {
#[doc(hidden)]
pub use web_sys;

#[doc(hidden)]
pub use wasm_bindgen;
#[doc(hidden)]
pub use web_sys;

#[doc(hidden)]
pub fn setup(log_level: &str) {
Expand Down
2 changes: 1 addition & 1 deletion crates/iron-remote-desktop/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub trait Session {

fn supports_unicode_keyboard_shortcuts(&self) -> bool;

fn extension_call(ext: Extension) -> Result<JsValue, Self::Error>;
fn extension_call(&self, ext: Extension) -> Result<JsValue, Self::Error>;
}

pub trait SessionTerminationInfo {
Expand Down
3 changes: 2 additions & 1 deletion crates/ironrdp-graphics/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ pub fn find_different_rects_sub<const BPP: usize>(

#[cfg(test)]
mod tests {
use super::*;
use bytemuck::cast_slice;

use super::*;

#[test]
fn test_intersect() {
let r1 = Rect::new(0, 0, 640, 480);
Expand Down
7 changes: 5 additions & 2 deletions crates/ironrdp-server/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ pub trait RdpServerDisplay: Send {

#[cfg(test)]
mod tests {
use super::{BitmapUpdate, Framebuffer};
use core::num::NonZeroU16;
use ironrdp_graphics::{diff::Rect, image_processing::PixelFormat};

use ironrdp_graphics::diff::Rect;
use ironrdp_graphics::image_processing::PixelFormat;

use super::{BitmapUpdate, Framebuffer};

#[test]
fn framebuffer_update() {
Expand Down
2 changes: 1 addition & 1 deletion crates/ironrdp-web/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ impl iron_remote_desktop::Session for Session {
false
}

fn extension_call(ext: Extension) -> Result<JsValue, Self::Error> {
fn extension_call(&self, ext: Extension) -> Result<JsValue, Self::Error> {
Err(
IronError::from(anyhow::Error::msg(format!("unknown extension: {}", ext.ident())))
.with_kind(IronErrorKind::General),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { SessionEvent } from './session-event';
import { ConfigBuilder } from '../services/ConfigBuilder';
import type { Config } from '../services/Config';
import type { PartialObserver } from 'rxjs';
import type { Extension } from './Extension';

export interface UserInteraction {
setVisibility(state: boolean): void;
Expand All @@ -29,4 +30,6 @@ export interface UserInteraction {
resize(width: number, height: number, scale?: number): void;

setEnableClipboard(enable: boolean): void;

callExtension(ext: Extension): void;
}
6 changes: 6 additions & 0 deletions web-client/iron-remote-desktop/src/services/PublicAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { UserInteraction } from '../interfaces/UserInteraction';
import type { ScreenScale } from '../enums/ScreenScale';
import { ConfigBuilder } from './ConfigBuilder';
import { Config } from './Config';
import type { Extension } from '../interfaces/Extension';

export class PublicAPI {
private remoteDesktopService: RemoteDesktopService;
Expand Down Expand Up @@ -62,6 +63,10 @@ export class PublicAPI {
this.remoteDesktopService.setEnableClipboard(enable);
}

private callExtension(ext: Extension) {
this.remoteDesktopService.callExtension(ext);
}

getExposedFunctions(): UserInteraction {
return {
setVisibility: this.setVisibility.bind(this),
Expand All @@ -78,6 +83,7 @@ export class PublicAPI {
setCursorStyleOverride: this.setCursorStyleOverride.bind(this),
resize: this.resize.bind(this),
setEnableClipboard: this.setEnableClipboard.bind(this),
callExtension: this.callExtension.bind(this),
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { SessionTerminationInfo } from '../interfaces/SessionTerminationInf
import type { RemoteDesktopModule } from '../interfaces/RemoteDesktopModule';
import { ConfigBuilder } from './ConfigBuilder';
import type { Config } from './Config';
import type { Extension } from '../interfaces/Extension';

type OnRemoteClipboardChanged = (data: ClipboardData) => void;
type OnRemoteReceivedFormatsList = () => void;
Expand Down Expand Up @@ -280,6 +281,10 @@ export class RemoteDesktopService {
}
}

callExtension(ext: Extension) {
this.session?.extensionCall(ext);
}

private releaseAllInputs() {
this.session?.releaseAllInputs();
}
Expand Down
Loading