From a4ab39340c3eabbe519404ab66efc1d23db35a32 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 14 Mar 2024 00:10:55 +0100 Subject: [PATCH] native: Remove custom resize method, rely on event loop (for now?) --- .../rs/ruffle/FullscreenNativeActivity.java | 6 ----- native/src/custom_event.rs | 2 -- native/src/lib.rs | 26 ------------------- 3 files changed, 34 deletions(-) diff --git a/app/ruffle/src/main/java/rs/ruffle/FullscreenNativeActivity.java b/app/ruffle/src/main/java/rs/ruffle/FullscreenNativeActivity.java index c5cf167..5854ac1 100644 --- a/app/ruffle/src/main/java/rs/ruffle/FullscreenNativeActivity.java +++ b/app/ruffle/src/main/java/rs/ruffle/FullscreenNativeActivity.java @@ -71,8 +71,6 @@ public class FullscreenNativeActivity extends GameActivity { private native void keydown(byte key_code, char key_char); private native void keyup(byte key_code, char key_char); - private native void resized(); - private native void requestContextMenu(); private native void runContextMenuCallback(int index); private native void clearContextMenu(); @@ -182,10 +180,6 @@ public class FullscreenNativeActivity extends GameActivity { layout.requestFocus(); this.mSurfaceView.getHolder().addCallback(this); ViewCompat.setOnApplyWindowInsetsListener(this.mSurfaceView, this); - - this.mSurfaceView.addOnLayoutChangeListener((vw, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { - resized(); - }); } @Override diff --git a/native/src/custom_event.rs b/native/src/custom_event.rs index 4414fe1..a502b98 100644 --- a/native/src/custom_event.rs +++ b/native/src/custom_event.rs @@ -1,7 +1,6 @@ //! Custom event type for Ruffle on Android use ruffle_core::events::KeyCode; -use ruffle_core::ViewportDimensions; /// User-defined events. #[derive(Debug)] @@ -15,6 +14,5 @@ pub enum RuffleEvent { }, RunContextMenuCallback(usize), ClearContextMenu, - Resize(ViewportDimensions), RequestContextMenu, } diff --git a/native/src/lib.rs b/native/src/lib.rs index e9c47e1..9fe9933 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -367,12 +367,6 @@ fn run(app: AndroidApp) { match receiver.try_recv() { Err(_) => {} - Ok(RuffleEvent::Resize(size)) => { - if let Some(player) = playerbox.as_ref() { - player.player.lock().unwrap().set_viewport_dimensions(size); - needs_redraw = true; - } - } Ok(RuffleEvent::TaskPoll) => { if let Some(player) = playerbox.as_ref() { player @@ -524,26 +518,6 @@ pub unsafe extern "C" fn Java_rs_ruffle_FullscreenNativeActivity_keyup( }); } -#[no_mangle] -#[allow(clippy::missing_safety_doc)] -pub unsafe extern "C" fn Java_rs_ruffle_FullscreenNativeActivity_resized( - mut env: JNIEnv, - this: JObject, -) { - let event_loop: MutexGuard> = - env.get_rust_field(this, "eventLoopHandle").unwrap(); - let size = get_view_size(); - if let Ok((w, h)) = size { - let viewport_scale_factor = 1.0; //window.scale_factor(); - let _ = event_loop.send(RuffleEvent::Resize(ViewportDimensions { - width: w as u32, - height: h as u32, - scale_factor: viewport_scale_factor, - })); - } - log::warn!("resized!"); -} - pub fn get_jvm<'a>() -> Result<(jni::JavaVM, JObject<'a>), Box> { // Create a VM for executing Java calls let context = ndk_context::android_context();