Commit Graph

1700 Commits

Author SHA1 Message Date
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
bors-servo 80a9bf00e4 Auto merge of #346 - servo:publish, r=nox
Publish core-foundation-sys, core-foundation, core-text
2019-11-05 06:55:42 -05:00
Josh Matthews 2393333957 Major version release for core-text. 2019-11-05 12:55:10 +01:00
Josh Matthews ae995daaab Minor version update for core-foundation-sys and core-foundation. 2019-11-05 12:54:59 +01:00
bors-servo 24ef524629 Auto merge of #347 - servo:threadsafe-fonts, r=SimonSapin
Properly make core_text::font::Font be Send and Sync

The Apple documentation says:

> All individual functions in Core Text are thread-safe. Font objects (CTFont,
> CTFontDescriptor, and associated objects) can be used simultaneously by
> multiple operations, work queues, or threads. However, the layout objects
> (CTTypesetter, CTFramesetter, CTRun, CTLine, CTFrame, and associated objects)
> should be used in a single operation, work queue, or thread.

https://developer.apple.com/documentation/coretext
2019-11-05 06:22:44 -05:00
Anthony Ramine 24d9ccc2c3 Properly make core_text::font::Font be Send and Sync
The Apple documentation says:

> All individual functions in Core Text are thread-safe. Font objects (CTFont,
> CTFontDescriptor, and associated objects) can be used simultaneously by
> multiple operations, work queues, or threads. However, the layout objects
> (CTTypesetter, CTFramesetter, CTRun, CTLine, CTFrame, and associated objects)
> should be used in a single operation, work queue, or thread.

https://developer.apple.com/documentation/coretext
2019-11-05 12:17:49 +01:00
bors-servo 8793a46699 Auto merge of #345 - zubivan:master, r=jdm
Bump core graphics version to 0.18.0

As discussed in #339 bumping version of core graphics to the next minor.
2019-10-28 14:15:58 -04:00
Ivan Zub 4486e9e208 Bump versions of dependant packages 2019-10-26 20:27:40 +02:00
Ivan Zub 44b4624e24 Bump core graphics version to 0.18.0 2019-10-26 20:10:54 +02:00
bors-servo cac6d108be Auto merge of #344 - zubivan:master, r=jdm
Add CGConfigureDisplayMirrorOfDisplay

Hi there,

One more for Core Graphics from me. This time adds [`CGConfigureDisplayMirrorOfDisplay`](https://developer.apple.com/documentation/coregraphics/1454531-cgconfiguredisplaymirrorofdispla) and [`kCGNullDirectDisplay`](https://developer.apple.com/documentation/coregraphics/kcgnulldirectdisplay) APIs.

`CGConfigureDisplayMirrorOfDisplay`:
``` objc
func CGConfigureDisplayMirrorOfDisplay(_ config: CGDisplayConfigRef?,
                                     _ display: CGDirectDisplayID,
                                     _ master: CGDirectDisplayID) -> CGError
```

`kCGNullDirectDisplay`:
``` objc
#define kCGNullDirectDisplay
```

Not sure about the `null_display` function, but at least it kind of aligns with `main`. Maybe I should just call it `null`.

Let me know what do you think.
2019-10-24 18:00:25 -04:00
Ivan Zub 0f5dfff5f5 Add wrapper for CGConfigureDisplayMirrorOfDisplay 2019-10-24 23:35:29 +02:00
Ivan Zub b0145f2c44 Add the null display
Value used to reset mirroring settings to default
2019-10-24 23:34:32 +02:00
Ivan Zub c9410c5fc0 Correct documentation comment 2019-10-24 23:28:44 +02:00
bors-servo 12c15a5385 Auto merge of #343 - zubivan:master, r=jdm
Add CGConfigureDisplayOrigin

Adds a wrapper for [CGConfigureDisplayOrigin](https://developer.apple.com/documentation/coregraphics/1454090-cgconfiguredisplayorigin) which has the following signature:

``` c
func CGConfigureDisplayOrigin(_ config: CGDisplayConfigRef?,
                            _ display: CGDirectDisplayID,
                            _ x: Int32,
                            _ y: Int32) -> CGError
```

Please let me know if there is anything I can improve here.

I'm currently working on the small utility heavily relying on CoreGraphics API, so expect more of those to come as I go. :)
2019-10-23 09:00:57 -04:00
Ivan Zub 580e171e6f Add wrapper for CGConfigureDisplayOrigin 2019-10-23 10:50:27 +02:00
bors-servo 70aca43f2f Auto merge of #341 - SSheldon:cocoa_version_0.19.1, r=jdm
Update cocoa version to 0.19.1

New version needed so that the #340 fixes can be published.
2019-10-16 13:10:29 -04:00
Steven Sheldon e65c9b2939 Update cocoa version to 0.19.1 2019-10-16 08:08:11 -07:00
bors-servo f7c2096ad0 Auto merge of #340 - SSheldon:fix_omitted_ret_types, r=jdm
Fixes so the compiler can infer msg_send! return types

Currently, due to a quirk in Rust's type inference interacting with the structure of the `msg_send!` macro, a `()` return type will be inferred when the compiler cannot otherwise determine the return type. This behavior is expected to change, and in the future could resolve to a `!` return type, which results in undefined behavior.

Linting has previously been added for this in rust-lang/rust#39216, but it did not catch these cases due to SSheldon/rust-objc#62. An upcoming version of objc will be fixed to stop hiding these errors, at which point they will become compile errors.

This change fixes these errors and allows cocoa to compile with the fixed version of objc.
2019-10-16 10:02:31 -04:00
Steven Sheldon 0a1b0d6f1b Fixes so the compiler can infer msg_send! return types
Currently, due to a quirk in Rust's type inference interacting with the
structure of the msg_send! macro, a () return type will be inferred when
the compiler cannot otherwise determine the return type. This behavior
is expected to change, and in the future could resolve to a ! return
type, which results in undefined behavior.

Linting has previously been added for this in rust-lang/rust#39216, but
it did not catch these cases due to SSheldon/rust-objc#62. An upcoming
version of objc will be fixed to stop hiding these errors, at which
point they will become compile errors.

This change fixes these errors and allows cocoa to compile with the
fixed version of objc.
2019-10-16 06:50:58 -07:00
bors-servo c9b0702dc0 Auto merge of #337 - wezm:CFDataGetBytes, r=jdm
Add CFDataGetBytes to CFData bindings

Just add a missing binding that I needed.

<!-- 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/337)
<!-- Reviewable:end -->
2019-10-15 08:13:08 -04:00
Wesley Moore b2a4a0e566 Add CFDataGetBytes to CFData bindings 2019-10-15 09:53:39 +11:00
bors-servo 6143ce111e Auto merge of #336 - wezm:copy-available-tables, r=jdm
Add get_available_font_tables to CTFont

The PR exposes `CTFontCopyAvailableTables` through `get_available_font_tables`.

<!-- 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/336)
<!-- Reviewable:end -->
2019-10-11 08:25:40 -04:00
Wesley Moore bc20614a3b Add get_available_font_tables to CTFont 2019-10-11 16:49:05 +11:00
bors-servo ba4e7f41f5 Auto merge of #335 - wezm:character-set, r=jdm
Add CFCharacterSet

<!-- 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/335)
<!-- Reviewable:end -->
2019-10-10 09:50:38 -04:00
Wesley Moore ad416b4890 Add CFCharacterSet to core-foundation 2019-10-10 15:35:21 +11:00
Wesley Moore 35e3e5b5c1 Add CFCharacterSet to core-foundation-sys 2019-10-10 15:33:37 +11:00
bors-servo 751146025c Auto merge of #333 - seanvoss:add_target, r=jdm
Adds setTarget to buttons and menu items, these are required in many …

…cases

<!-- 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/333)
<!-- Reviewable:end -->
2019-09-25 09:43:06 -04:00
svoss 4372c047e6 Adds setTarget to buttons and menu items, these are required in many cases 2019-09-25 06:41:07 -07:00
bors-servo e1229a6b9d Auto merge of #332 - servo:gleamup, r=manishearth
Update gleam. Publish io-surface 0.12.1.

<!-- 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/332)
<!-- Reviewable:end -->
2019-09-03 12:23:28 -04:00
Josh Matthews 33c087ee8f Update gleam. Publish io-surface 0.12.1. 2019-09-03 12:18:10 -04:00
bors-servo 0951ab3a83 Auto merge of #330 - aleksijuvani:fix-i686-apple-darwin, r=jdm
Fix i686-apple-darwin compile target

<!-- 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/330)
<!-- Reviewable:end -->
2019-08-30 19:49:45 -04:00
Aleksi Juvani 552021c096 Fix i686-apple-darwin compile target 2019-08-22 21:56:34 +03:00
bors-servo 0612ea1fbb Auto merge of #329 - fry:master, r=jdm
add shared_support_url to CFBundle

This adds access to CFBundleCopySharedSupportURL from the CFBundle struct

<!-- 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/329)
<!-- Reviewable:end -->
2019-08-05 10:16:56 -04:00
Eike Siewertsen 1a0e69872a add shared_support_url to CFBundle 2019-08-05 10:50:58 +02:00
bors-servo 1a857cd745 Auto merge of #328 - king6cong:master, r=jdm
Sync member order in impl and trait

<!-- 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/328)
<!-- Reviewable:end -->
2019-08-02 05:45:19 -04:00
king6cong 0f953f4e7b Sync member order in impl and trait 2019-08-02 15:11:32 +08:00
bors-servo b18ad75ff8 Auto merge of #327 - seanvoss:add_imageview, r=jdm
Adds Image View Support

<!-- 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/327)
<!-- Reviewable:end -->
2019-07-23 09:58:52 -04:00
bors-servo 99b4dfe38b Auto merge of #326 - servo:jdm-patch-3, r=asajeffrey
Major version changes for cocoa and io-surface

<!-- 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/326)
<!-- Reviewable:end -->
2019-07-22 20:26:11 -04:00
Sean Voss 4885ac1384 Adds Image View Support 2019-07-22 15:28:55 -07:00
bors-servo 0fdc104311 Auto merge of #325 - poiru:bump-ct, r=jdm
Bump core-text to 13.3.0

The only API change since the last bump is #321.

<!-- 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/325)
<!-- Reviewable:end -->
2019-07-17 09:13:21 -04:00
Josh Matthews 70275f5af1 Update cocoa to 0.19.0 2019-07-17 08:29:40 -04:00
Birunthan Mohanathas 5200688b1b Bump core-text to 13.3.0
The only API change since the last bump is #321.
2019-07-17 15:28:10 +03:00
bors-servo d5e805cd78 Auto merge of #322 - felixrabe:fix-nscolor, r=jdm
Fix NSColor argument order: r b<->g

<!-- 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/322)
<!-- Reviewable:end -->
2019-07-17 08:24:15 -04:00
Josh Matthews 451af6e167 Update io-surface to 0.12.0. 2019-07-17 08:17:44 -04:00
bors-servo 2563989875 Auto merge of #324 - zakorgy:io-surface-alpha, r=jdm
Add alpha option to bind_to_gl_texture

This PR is related to https://github.com/servo/servo/pull/23509.
If the WebGL context we use doesn't have alpha, the underlying IOsurface should use RGB internal format instead of RGBA, else the reported GL_ALPHA_BITS value will be incorrect fot the context in the related wpt-tests.
We only need to change the internal format in this case, according to https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/CGLIOSurface.h#L99
cc @jdm

<!-- 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/324)
<!-- Reviewable:end -->
2019-07-17 07:34:10 -04:00
Zakor Gyula 8a15cb91c4 Add alpha option to bind_to_gl_texture 2019-07-17 10:58:18 +02:00
bors-servo 0ed0c4b7d9 Auto merge of #321 - poiru:font-descriptor-format, r=jdm
Implement CTFontDescriptor::font_format()

<!-- 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/321)
<!-- Reviewable:end -->
2019-07-16 16:50:16 -04:00
bors-servo eab13d8032 Auto merge of #323 - atouchet:master, r=jdm
Update Travis CI URLs

<!-- 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/323)
<!-- Reviewable:end -->
2019-07-15 08:11:31 -04:00
atouchet 7430046924 Update Travis CI URLs 2019-07-14 21:16:49 -07:00
Felix Rabe 8bc0ed06cb Fix NSColor argument order: r b<->g 2019-07-14 23:20:33 +02:00