Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gintama91 committed Jun 30, 2023
1 parent baba5d0 commit ae1bfb5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions ext/wry_ruby/src/application/event_loop.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use magnus::{
define_class, define_global_function, function, method, Error, Module, Object, Value,
function, Error, Object,
};
use std::cell::RefCell;

use std::marker::PhantomData;
use std::sync::atomic::{AtomicPtr, Ordering};
use wry::application::dpi::LogicalSize;
use std::sync::atomic::{AtomicPtr};

use wry::application::event_loop::{
EventLoop as EventLoopImpl,
};
Expand All @@ -19,7 +19,7 @@ pub struct SafeWrapper<T> {
_marker: PhantomData<*mut T>,
}

unsafe impl<T> Send for SafeWrapper<T> {}
unsafe impl<T> Send for SafeWrapper<T> {}

impl EventLoop {
pub fn new() -> Self {
Expand Down
2 changes: 1 addition & 1 deletion ext/wry_ruby/src/application/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod event_loop;

pub fn init() -> Result<(), Error> {
tray_id::init()?;
// window::init()?;
window::init()?;
clipboard::init()?;
event_loop::init()?;
Ok(())
Expand Down
13 changes: 6 additions & 7 deletions ext/wry_ruby/src/application/window.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
use magnus::{Error, define_global_function, function, define_class};
use magnus::{Error, define_global_function, function};
use wry::application::dpi::LogicalSize;
use wry::application::window::WindowBuilder;

use wry::{
application::{
event::{Event, StartCause, WindowEvent},
event_loop::{ControlFlow, EventLoop},
event_loop::{ControlFlow},
},
webview::WebViewBuilder,
};

pub fn WindoWnew(title: String, width: u32, height: u32) {
pub fn WindoWnew(title: String, width: u32, height: u32, resizable: bool) {
let event_loop = wry::application::event_loop::EventLoop::new();
let mut window_builder = WindowBuilder::new();
window_builder = window_builder.with_title(title.clone());
window_builder = window_builder.with_inner_size(LogicalSize::new(width, height));
window_builder = window_builder.with_resizable(false);
window_builder = window_builder.with_resizable(resizable);

let window = window_builder.build(&event_loop).expect("Failed to create window");

Expand Down Expand Up @@ -45,8 +44,8 @@ pub fn WindoWnew(title: String, width: u32, height: u32) {


pub fn init() -> Result<(), Error> {

define_global_function("new_window", function!(WindoWnew, 3));
println!("inside init");
define_global_function("new_window", function!(WindoWnew, 4));
// define_global_function("hello_wry", function!(new, 3));
// application::init();
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion test/test_wry_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class TestWryRuby < Minitest::Test
# end

def test_hello_wry

new_window "Hello Wry",100,400,true # title, width, height, resizable
end
end

0 comments on commit ae1bfb5

Please sign in to comment.