From 601a5d62a4557be679965c2c64a2f707a9c5e024 Mon Sep 17 00:00:00 2001 From: Micah Johnston Date: Mon, 7 Sep 2020 21:39:21 -0500 Subject: [PATCH] remove mspc channel (to be replaced by baseview-specific WindowHandle --- examples/open_window.rs | 8 +------- src/macos/window.rs | 6 +----- src/win/window.rs | 6 +----- src/x11/window.rs | 8 +------- 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/examples/open_window.rs b/examples/open_window.rs index 4a6f546..861c95b 100644 --- a/examples/open_window.rs +++ b/examples/open_window.rs @@ -1,5 +1,3 @@ -use std::sync::mpsc; - use baseview::{Event, Window, WindowHandler}; fn main() { @@ -10,11 +8,7 @@ fn main() { parent: baseview::Parent::None, }; - let (_app_message_tx, app_message_rx) = mpsc::channel::<()>(); - - // Send _app_message_tx to a separate thread, then send messages to the GUI thread. - - let _ = Window::open::(window_open_options, app_message_rx); + Window::open::(window_open_options); } struct MyProgram {} diff --git a/src/macos/window.rs b/src/macos/window.rs index d142884..ee4c0d9 100644 --- a/src/macos/window.rs +++ b/src/macos/window.rs @@ -1,5 +1,4 @@ use std::ffi::c_void; -use std::sync::mpsc; use cocoa::appkit::{ NSApp, NSApplication, NSApplicationActivateIgnoringOtherApps, @@ -19,10 +18,7 @@ pub struct Window { } impl Window { - pub fn open( - options: WindowOpenOptions, - app_message_rx: mpsc::Receiver, - ) { + pub fn open(options: WindowOpenOptions) { unsafe { let _pool = NSAutoreleasePool::new(nil); diff --git a/src/win/window.rs b/src/win/window.rs index b735daf..bcc53f9 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -15,7 +15,6 @@ use std::cell::RefCell; use std::ffi::c_void; use std::ptr::null_mut; use std::rc::Rc; -use std::sync::mpsc; use raw_window_handle::{windows::WindowsHandle, HasRawWindowHandle, RawWindowHandle}; @@ -137,10 +136,7 @@ pub struct Window { } impl Window { - pub fn open( - options: WindowOpenOptions, - app_message_rx: mpsc::Receiver, - ) { + pub fn open(options: WindowOpenOptions) { unsafe { let title = (options.title.to_owned() + "\0").as_ptr() as *const i8; diff --git a/src/x11/window.rs b/src/x11/window.rs index 4b7694b..c5c5a30 100644 --- a/src/x11/window.rs +++ b/src/x11/window.rs @@ -1,6 +1,5 @@ use std::ffi::CStr; use std::os::raw::{c_ulong, c_void}; -use std::sync::mpsc; use super::XcbConnection; use crate::{Event, MouseButtonID, MouseScroll, Parent, WindowHandler, WindowOpenOptions}; @@ -14,10 +13,7 @@ pub struct Window { } impl Window { - pub fn open( - options: WindowOpenOptions, - app_message_rx: mpsc::Receiver, - ) { + pub fn open(options: WindowOpenOptions) { // Convert the parent to a X11 window ID if we're given one let parent = match options.parent { Parent::None => None, @@ -122,8 +118,6 @@ unsafe impl HasRawWindowHandle for Window { // Event loop fn run_event_loop(window: &mut Window, handler: &mut H) { loop { - // somehow poll app_message_rx for messages at the same time - let ev = window.xcb_connection.conn.wait_for_event(); if let Some(event) = ev { let event_type = event.response_type() & !0x80;