From 30a3c0fb46e05d544c0f725dbf30dfa3b8bb12a4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2022 19:59:58 +0200 Subject: [PATCH] WIP --- crates/capture/build.rs | 3 +-- crates/capture/src/main.rs | 7 ++++--- crates/gpui/build.rs | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/capture/build.rs b/crates/capture/build.rs index abbc019943..f45dc922c6 100644 --- a/crates/capture/build.rs +++ b/crates/capture/build.rs @@ -6,7 +6,6 @@ fn main() { cc::Build::new() .file("src/dummy.m") - .define("MACOSX_DEPLOYMENT_TARGET", "12.3") - .flag("-ObjC") + .flag("-mmacosx-version-min=12.3") .compile("dummy"); } diff --git a/crates/capture/src/main.rs b/crates/capture/src/main.rs index 59d87b5225..a77ac61342 100644 --- a/crates/capture/src/main.rs +++ b/crates/capture/src/main.rs @@ -1,4 +1,4 @@ -use std::{ffi::CStr, slice, str}; +use std::{ffi::CStr, slice, str, ptr}; use block::ConcreteBlock; use cocoa::{ @@ -6,7 +6,7 @@ use cocoa::{ foundation::{NSArray, NSString, NSUInteger, NSInteger}, }; use core_graphics::display::CGDirectDisplayID; -use gpui::{actions, elements::*, keymap::Binding, Menu, MenuItem, mac::dispatcher::dispatch_get_main_queue}; +use gpui::{actions, elements::*, keymap::Binding, Menu, MenuItem, mac::dispatcher::{dispatch_get_main_queue, dispatch_queue_create}}; use log::LevelFilter; use objc::{class, msg_send, sel, sel_impl, declare::ClassDecl, runtime::{Protocol, Object, Sel}}; use simplelog::SimpleLogger; @@ -71,7 +71,8 @@ fn main() { let stream: id = msg_send![class!(SCStream), alloc]; let stream: id = msg_send![stream, initWithFilter: filter configuration: config delegate: nil]; let error: id = nil; - let _: () = msg_send![stream, addStreamOutput: output type: 0 sampleHandlerQueue: dispatch_get_main_queue() error: &error]; + let queue = dispatch_queue_create(ptr::null(), ptr::null_mut()); + let _: () = msg_send![stream, addStreamOutput: output type: 0 sampleHandlerQueue: queue error: &error]; let start_capture_completion = ConcreteBlock::new(move |error: id| { if !error.is_null() { diff --git a/crates/gpui/build.rs b/crates/gpui/build.rs index 836d586c26..967423d3f7 100644 --- a/crates/gpui/build.rs +++ b/crates/gpui/build.rs @@ -19,6 +19,7 @@ fn generate_dispatch_bindings() { .header("src/platform/mac/dispatch.h") .allowlist_var("_dispatch_main_q") .allowlist_function("dispatch_async_f") + .allowlist_function("dispatch_queue_create") .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .layout_tests(false) .generate()