This commit is contained in:
Antonio Scandurra 2022-08-29 19:59:58 +02:00
parent 0df97dce02
commit 30a3c0fb46
3 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,6 @@ fn main() {
cc::Build::new() cc::Build::new()
.file("src/dummy.m") .file("src/dummy.m")
.define("MACOSX_DEPLOYMENT_TARGET", "12.3") .flag("-mmacosx-version-min=12.3")
.flag("-ObjC")
.compile("dummy"); .compile("dummy");
} }

View File

@ -1,4 +1,4 @@
use std::{ffi::CStr, slice, str}; use std::{ffi::CStr, slice, str, ptr};
use block::ConcreteBlock; use block::ConcreteBlock;
use cocoa::{ use cocoa::{
@ -6,7 +6,7 @@ use cocoa::{
foundation::{NSArray, NSString, NSUInteger, NSInteger}, foundation::{NSArray, NSString, NSUInteger, NSInteger},
}; };
use core_graphics::display::CGDirectDisplayID; 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 log::LevelFilter;
use objc::{class, msg_send, sel, sel_impl, declare::ClassDecl, runtime::{Protocol, Object, Sel}}; use objc::{class, msg_send, sel, sel_impl, declare::ClassDecl, runtime::{Protocol, Object, Sel}};
use simplelog::SimpleLogger; use simplelog::SimpleLogger;
@ -71,7 +71,8 @@ fn main() {
let stream: id = msg_send![class!(SCStream), alloc]; let stream: id = msg_send![class!(SCStream), alloc];
let stream: id = msg_send![stream, initWithFilter: filter configuration: config delegate: nil]; let stream: id = msg_send![stream, initWithFilter: filter configuration: config delegate: nil];
let error: id = 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| { let start_capture_completion = ConcreteBlock::new(move |error: id| {
if !error.is_null() { if !error.is_null() {

View File

@ -19,6 +19,7 @@ fn generate_dispatch_bindings() {
.header("src/platform/mac/dispatch.h") .header("src/platform/mac/dispatch.h")
.allowlist_var("_dispatch_main_q") .allowlist_var("_dispatch_main_q")
.allowlist_function("dispatch_async_f") .allowlist_function("dispatch_async_f")
.allowlist_function("dispatch_queue_create")
.parse_callbacks(Box::new(bindgen::CargoCallbacks)) .parse_callbacks(Box::new(bindgen::CargoCallbacks))
.layout_tests(false) .layout_tests(false)
.generate() .generate()