1
0
Fork 0

remove mspc channel (to be replaced by baseview-specific WindowHandle

This commit is contained in:
Micah Johnston 2020-09-07 21:39:21 -05:00
parent c51aea5c12
commit 601a5d62a4
4 changed files with 4 additions and 24 deletions

View file

@ -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::<MyProgram>(window_open_options, app_message_rx);
Window::open::<MyProgram>(window_open_options);
}
struct MyProgram {}

View file

@ -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<H: WindowHandler>(
options: WindowOpenOptions,
app_message_rx: mpsc::Receiver<H::Message>,
) {
pub fn open<H: WindowHandler>(options: WindowOpenOptions) {
unsafe {
let _pool = NSAutoreleasePool::new(nil);

View file

@ -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<H: WindowHandler>(
options: WindowOpenOptions,
app_message_rx: mpsc::Receiver<H::Message>,
) {
pub fn open<H: WindowHandler>(options: WindowOpenOptions) {
unsafe {
let title = (options.title.to_owned() + "\0").as_ptr() as *const i8;

View file

@ -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<H: WindowHandler>(
options: WindowOpenOptions,
app_message_rx: mpsc::Receiver<H::Message>,
) {
pub fn open<H: WindowHandler>(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<H: WindowHandler>(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;