Commit Graph

88 Commits

Author SHA1 Message Date
bors-servo f7e0b97e0b Auto merge of #436 - AsafFisher:master, r=jrmuizel
Add CGEventTap

https://github.com/servo/core-graphics-rs/issues/111
2021-05-26 13:18:34 -04:00
Jeff Muizelaar ce17c9aa59 Add CFData::from_arc
This allows creating a zero-copy CFData wrapping existing data.
2021-02-14 11:52:04 -05:00
Makoto Kato 2fe22f8c98 Add CFStringCreateWithCharactersNoCopy 2021-01-26 13:59:23 +09:00
Asaf Fisher edb187a17c core-foundation: Add basic CFMachPort 2021-01-23 03:24:30 +02:00
Yu Shimura 437be24cdb CFBundleCopyResourcesDirectoryURL 2020-10-14 11:10:39 +09:00
Jeff Muizelaar c55fd48fbe Fix the definition of CFAllocatorContext
The function pointers can be null so should be wrapped in Option.

This struct was basically unusable before so I think we should
be fine making this change while only bumping the patch version.
I was unable to find any uses of it on github.
2020-10-13 17:55:00 -04:00
bors-servo d540fee244 Auto merge of #412 - sassman:feat/number-type-as-const, r=jrmuizel
feat(CFNumber): change `CFNumberType` from static to const, to improve match expression ergonomics

this PR changes the `CFNumberType` values like `kCFNumberSInt64Type` from `static` to `const`.

That way it is possible to simplify match expressions like this:

before:
```rust
let type_id = unsafe { CFNumberGetType(value) };
match type_id {
    si64 if si64 == kCFNumberSInt64Type => {},
    si32 if si32 == kCFNumberSInt32Type => {},
    _ => {},
}
```

after:
```rust
let type_id = unsafe { CFNumberGetType(value) };
match type_id {
    kCFNumberSInt64Type => {},
    kCFNumberSInt32Type => {},
    _ => {},
}
```

Note: function call `CFNumberGetType(value)` is implemented in PR #411
2020-10-07 08:48:55 -04:00
Sven Assmann b078b8754d feat(CFNumber): change CFNumberType from static to const, to improve match expression ergonomics 2020-10-07 09:17:32 +02:00
bors-servo 0be2364850 Auto merge of #411 - sassman:master, r=jrmuizel
add `CFNumberGetType` to determine specific number type

this PR adds support for `CFNumberGetType` that is needed if there is a `CFNumberRef` and it is not clear what sort of number it is.

Now it would be possible to do such a thing:

```rust
let type_id = unsafe { CFNumberGetType(value) };
match type_id {
    si64 if si64 == kCFNumberSInt64Type => {},
    si32 if si32 == kCFNumberSInt32Type => {},
    _ => {},
}
```
2020-10-06 18:14:01 -04:00
Sven Assmann 9007f1348c feat(CFBoolean): add function CFBooleanGetValue to retrieve a value of a CFBooleanRef 2020-10-04 12:26:01 +02:00
Sven Assmann 36d06c85ba feat(CFNumber): add CFNumberGetType to figure out the correct numeric type of a CFNumberRef 2020-10-04 10:42:40 +02:00
Bryan Burgers a4e2983219 Add CFTimeZone::name
Add a `name` method to `CFTimeZone` to get the time zone ID (e.g.,
"America/Los_Angeles") of the current time zone.

Core Foundation calls this "name" instead of "id" in its method
signatures, but acknowledges it in the closely-related NSTimeZone
related docs. Since most of the other methods in this library match
closely with CF naming, also use `name` here.

> Time zone database entries such as “America/Los_Angeles” are IDs, not
> names. An example of a time zone name is “Pacific Daylight Time”.
> Although many NSTimeZone symbols include the word “name”, they
> actually refer to IDs.
2020-06-29 07:18:58 -05:00
bors-servo 14ee94aef7 Auto merge of #359 - roblabla:cfset-missing-methods, r=jdm
CFSet: Add missing methods in -sys

Adds a handful of missing methods from the CFSet family.
2020-05-17 12:50:08 -04:00
Kornel 6ded5c360f CFBundleCopyBundleURL 2020-05-08 11:38:31 +01:00
brunohgouveia 1f4c983cee Add missing APIs to CTLine 2020-04-13 21:25:53 +01:00
roblabla 63a8dc37c3 CFSet: Add missing methods in -sys 2020-03-21 18:34:08 +00:00
Vasiliy Badanov aa6d1cd4c1 Fix for link error "Undefined symbols for architecture x86_64: _CFMutableAttributedStringGetTypeID" 2020-02-21 23:40:36 +03:00
Wez Furlong cf3659fc6f Fix CFRunLoop types to avoid UB
A number of callback functions associated with the CFRunLoop types are
allowed to be NULL to evoke default behavior.

Prior to this commit the definition of those structs prevented passing
in null which meant resorting to transmute or other tricks to
effectively set null, but with recent compiler versions the compiler
emits `ud2` instructions and triggers a fault at runtime.

The correct resolution for this is to define these fields as `Option`al
callbacks and that is what this commit does.

I've used this approach successfully here in another project:
Refs: https://github.com/wez/wezterm/commit/398f333c32fb1ff4ccd9cc001a66ae22522eb60c

I've bumped up the version for the crate as part of this commit
because it effectively changes the API around these structs.
2019-11-11 19:57:48 -08:00
Wesley Moore b2a4a0e566 Add CFDataGetBytes to CFData bindings 2019-10-15 09:53:39 +11:00
Wesley Moore 35e3e5b5c1 Add CFCharacterSet to core-foundation-sys 2019-10-10 15:33:37 +11:00
Aleksi Juvani 552021c096 Fix i686-apple-darwin compile target 2019-08-22 21:56:34 +03:00
Eike Siewertsen 1a0e69872a add shared_support_url to CFBundle 2019-08-05 10:50:58 +02:00
Bruce Mitchener d2d3b3362a Refer to macOS rather than OS X. 2019-03-14 17:47:00 +07:00
acheronfail cf356f6c61 chore: add CF functions for using bookmark data
fixes #116 (a closed issue)
2018-11-09 12:20:09 +11:00
Ryan Leckey 1d369075c3 Add CF(Mutable)AttributedString and a couple helpers 2018-07-06 12:25:18 -07:00
Bruce Mitchener 7e7d65bb4d Reduce usage of libc crate.
Switch from using `libc` types to `::std::os::raw`. This is a breaking
change due to the differences in how `c_void` is defined.

`core-foundation-sys` no longer needs the `libc` dependency.
2018-02-01 20:39:10 +07:00
Bruce Mitchener bf3a9c89bd Add missing license headers to src files. 2018-02-01 09:32:29 +07:00
Josh Matthews 53609f26ac Respect const/mut of system headers. 2018-01-26 13:46:06 -05:00
Linus Färnstrand 3aa63aa5b7 Add TCFTypeRef trait 2018-01-23 22:35:52 +01:00
Linus Färnstrand 249300d8ab Change CFErrorRef to *const ptr instead of *mut 2018-01-23 22:35:52 +01:00
bors-servo 2d35ed2d49 Auto merge of #84 - trlim:filedescriptor, r=jdm
Add bindings for `CFFileDescriptor`

This pull request adds implementation of `CFFileDescriptor` and `CFRunLoopSource` related API.

<!-- Reviewable:start -->

---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/84)

<!-- Reviewable:end -->
2018-01-20 17:17:36 -06:00
Tae-il Lim 530f732ce8 Implement CFFileDescriptor 2018-01-15 14:35:16 +09:00
Dan Glastonbury 6a77e377ba Add CFMutableDictionary type.
Added CFMutableDictionary that presents the mutable dictionary
functions of CF. Tries to present a similar interface as CFDictionary.

Fixes issue #93.
2017-11-29 12:50:05 +10:00
ratake 7b6fbdb1a1 Added support for CFTimeZone objects 2017-11-12 17:43:31 -08:00
ratake 79cd89bd5d Added support for CFDate objects 2017-11-12 17:43:31 -08:00
ratake e3fc4fe3e4 Implement Debug for all types 2017-11-12 17:41:29 -08:00
bors-servo fda0928c53 Auto merge of #124 - ratake:uuid-crate, r=jdm
Made CFUUID interoperable with the uuid crate

Behind the `with-uuid` feature

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/124)
<!-- Reviewable:end -->
2017-11-08 07:58:55 -06:00
ratake b81cfce569 Made CFUUID interoperable with the uuid crate 2017-11-07 20:49:25 -08:00
ratake 2e2e6af6d8 Implement Ord for CFNumber 2017-11-07 20:44:13 -08:00
ratake d20b8abc9c Implement Eq for all types 2017-11-07 20:44:12 -08:00
bors-servo 2ceebd44fe Auto merge of #121 - jrmuizel:uuid, r=jdm
Add support for CFUUID

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/121)
<!-- Reviewable:end -->
2017-10-20 10:46:12 -05:00
bors-servo dd3b248259 Auto merge of #119 - jrmuizel:cfurl-fs, r=jdm
Add CFURLGetFileSystemRepresentation

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/119)
<!-- Reviewable:end -->
2017-10-20 07:49:22 -05:00
Jeff Muizelaar 6ca30dd9a8 Add support for CFUUID 2017-10-19 22:29:25 -04:00
Jeff Muizelaar a6dc32cf50 Support converting non-utf8 paths to CFURLs 2017-10-19 18:17:26 -04:00
Jeff Muizelaar 04fd67e25b Add CFURLGetFileSystemRepresentation 2017-10-19 17:36:54 -04:00
ratake 0dd90e84ae Complete the CFAllocator reference 2017-10-12 21:48:29 -07:00
ratake a622566dc4 Correct the definition for CFStringCreateWithBytes 2017-10-12 21:48:29 -07:00
ratake 7b0544fef6 Add support for f32 to CFNumber 2017-10-12 21:48:29 -07:00
ratake dcc0a07776 Complete the types for CFArrayCallBacks and CFDictionaryCallBacks 2017-10-12 21:48:29 -07:00
Kornel fe6edb78b9 Fix return types 2017-08-08 15:06:15 +01:00