Commit Graph

1586 Commits

Author SHA1 Message Date
bors-servo 4fc0194cd0 Auto merge of #287 - jrmuizel:stroke-color, r=jdm
Add binding for CGContextSetRGBStrokeColor

<!-- 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/287)
<!-- Reviewable:end -->
2019-01-04 16:53:39 -05:00
Jeff Muizelaar e6e7729b0a Add binding for CGContextSetRGBStrokeColor 2019-01-04 16:46:54 -05:00
bors-servo a4b08a85bc Auto merge of #286 - jrmuizel:mitre, r=jdm
Fix the spelling of miter

<!-- 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/286)
<!-- Reviewable:end -->
2019-01-04 14:16:21 -05:00
Jeff Muizelaar a65bf52e87 Fix the spelling of miter 2019-01-04 14:07:06 -05:00
bors-servo e48becfa88 Auto merge of #285 - jrmuizel:bounding, r=jdm
Add a binding for CGContextGetClipBoundingBox

<!-- 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/285)
<!-- Reviewable:end -->
2019-01-04 10:00:37 -05:00
Jeff Muizelaar 128f022a47 Add a binding for CGContextGetClipBoundingBox 2019-01-04 09:57:32 -05:00
bors-servo 815accb232 Auto merge of #283 - jrmuizel:stroke, r=jdm
Expose stroking apis on CGContext

<!-- 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/283)
<!-- Reviewable:end -->
2019-01-03 22:44:22 -05:00
Jeff Muizelaar be6dd330b8 Expose stroking apis on CGContext 2019-01-03 22:17:07 -05:00
bors-servo b5b08d9cdd Auto merge of #281 - jrmuizel:clear-rect, r=jrmuizel
Add bindings for CGContextClearRect

<!-- 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/281)
<!-- Reviewable:end -->
2019-01-03 22:09:05 -05:00
Jeff Muizelaar b55674f65b Add bindings for CGContextClearRect 2019-01-03 22:08:24 -05:00
bors-servo cf71f83951 Auto merge of #276 - euclio:ns-not-found, r=jrmuizel
add NSNotFound and NSIntegerMax constants

<!-- 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/276)
<!-- Reviewable:end -->
2019-01-03 20:20:26 -05:00
bors-servo df62de513b Auto merge of #279 - silwol:master, r=jrmuizel
Use libc c_char instead of i8 for libc strlen() call

This patch allows build errors like https://buildd.debian.org/status/fetch.php?pkg=rust-core-foundation&arch=arm64&ver=0.6.1-1&stamp=1533301991&raw=0 to go through on architectures that use u8 as c_char.

<!-- 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/279)
<!-- Reviewable:end -->
2019-01-03 20:16:37 -05:00
Wolfgang Silbermayr e2ae28c815 Use libc c_char instead of i8 for libc strlen() call 2018-12-07 07:06:09 +01:00
bors-servo 42a6014bf4 Auto merge of #269 - jrmuizel:run, r=jdm
Add some minimal bindings for CTLine and CTRun

<!-- 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/269)
<!-- Reviewable:end -->
2018-11-14 17:42:48 -05:00
Andy Russell 6884430a82 add NSNotFound constant 2018-11-10 16:16:37 -05:00
bors-servo 55a4d799ed Auto merge of #274 - acheronfail:chore/add-cf-bookmark-definitions, r=jdm
chore: add CF functions for using bookmark data

fixes #116 (a closed issue)

Provides the definitions for some of the CF functions for using Bookmark data (which is useful for sandboxed applications).

<!-- 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/274)
<!-- Reviewable:end -->
2018-11-09 09:23:06 -05:00
acheronfail cf356f6c61 chore: add CF functions for using bookmark data
fixes #116 (a closed issue)
2018-11-09 12:20:09 +11:00
bors-servo e24f1442bc Auto merge of #273 - acheronfail:chore/add-more-methods-to-nscolor, r=jdm
chore: add NSColorSpace and more methods to NSColor

fixes #184
fixes #251

This PR adds some requested methods for `NSColor`, as well as adding a bit of functionality for `NSColorSpace` too.

<!-- 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/273)
<!-- Reviewable:end -->
2018-11-08 18:41:35 -05:00
acheronfail 6148a59381 chore: add NSColorSpace and more methods to NSColor
fixes #184
fixes #251
2018-11-09 09:48:20 +11:00
Jeff Muizelaar 42889636bf Add some minimal bindings for CTLine and CTRun 2018-11-08 16:03:21 -05:00
bors-servo 9f23b511ad Auto merge of #272 - acheronfail:chore/add-isEnabled-setEnabled-to-nsbutton, r=jdm
chore: add simple NSControl class

I needed to use `[button setEnabled]` for an `NSButton`, so I added some of `NSControl`'s basic functionality.

Example usage:

```rust
use cocoa::foundation::NSRect;
use cocoa::appkit::{NSButton, NSControl, NSView};

// Parent view
let view = NSView::alloc(nil)
    .initWithFrame_(NSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)));

// Add button to view
let button = NSButton::alloc(nil)
    .initWithFrame_(NSRect::new(NSPoint::new(20., 20.), NSSize::new(150., 50.)));
NSView::addSubview_(view, button);

// Prints "1" (button enabled)
println!("{:?}", NSControl::isEnabled_(button));

// Disable the button
NSControl::setEnabled_(button, NO);

// Prints "0" (button disabled)
println!("{:?}", NSControl::isEnabled_(button));
```

<!-- 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/272)
<!-- Reviewable:end -->
2018-11-08 15:28:45 -05:00
acheronfail 8a72e96c97 chore: add simple NSControl class 2018-11-09 07:20:57 +11:00
bors-servo 8ffba8a79a Auto merge of #271 - Darkspirit:https, r=jdm
Remove unneeded webhook notification

https://github.com/servo/saltfs/pull/906#issuecomment-436313032

<!-- 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/271)
<!-- Reviewable:end -->
2018-11-06 19:56:55 -05:00
Jan Andre Ikenmeyer 77bb7b6cfe Remove unneeded webhook notification 2018-11-07 00:06:36 +01:00
bors-servo d052be8d40 Auto merge of #270 - pcwalton:version-0.18.4, r=jdm
Update `cocoa` version to 0.18.4

r? @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/270)
<!-- Reviewable:end -->
2018-11-03 17:41:34 -04:00
Patrick Walton f537062e05 Update cocoa version to 0.18.4 2018-11-02 12:24:24 -07:00
bors-servo 0edd977eb7 Auto merge of #268 - pcwalton:additions-0.17.3, r=jdm
CFArray, Core Animation, and Quartz Window Services additions

Here's your regularly scheduled set of additions to the Core Foundation bindings. I needed these for the testing infrastructure I'm developing for https://github.com/pcwalton/planeshift.

r? @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/268)
<!-- Reviewable:end -->
2018-11-02 07:53:15 -04:00
Patrick Walton fd4736bb9f Update version number to 0.17.3 2018-11-01 20:26:29 -07:00
Patrick Walton ee0ada3d28 Add bindings to Quartz Window Services.
This series of functions allows us to take screenshots, which are useful for
integration testing.
2018-11-01 19:53:02 -07:00
Patrick Walton 692ba80aec Add bindings to -[CATransaction completionBlock] and
`-[CATransaction setCompletionBlock:]`

We have support for blocks, so there's no reason to not include these.
2018-11-01 19:51:32 -07:00
Patrick Walton b56fda0a13 Add bindings to CARenderer 2018-11-01 19:50:02 -07:00
Patrick Walton ee0269808d Add a few bindings to Core Video to go along with the CARenderer bindings 2018-11-01 19:47:36 -07:00
Patrick Walton 1cdd18a0e2 Add a binding to CACurrentMediaTime() 2018-11-01 19:46:25 -07:00
Patrick Walton 90ddbb60b2 Allow a CFArray to be constructed from Copy data.
This is necessary for the bindings to Quartz Window Services to work, since
those APIs don't wrap `CGWindowID` objects in `CFNumber` wrappers.
2018-11-01 19:39:48 -07:00
bors-servo b9372673f0 Auto merge of #265 - faern:dictionary-conversion, r=jdm
Converting between dictionary types

I'm trying to use the `CFDictionary` and `CFMutableDictionary` types more extensively. But run into problems. They are not very compatible with each other. This crate for example does not expose any clean way of using `CFDictionaryCreateMutableCopy` to create a `CFMutableDictionary` from any `CFDictionary`. I added a `From` implementation for this.

It was not possible to, in some safe/simple way, cast a `CFDictionary<K, V>` into the untyped `CFDictionary<*const c_void, *const c_void>` something I added `to_untyped` to be able to do.

When it comes to downcasting, it was not possible to downcast a `CFType` into a dictionary, since they don't implement `ConcreteCFType`. Something they probably should, for the case where the keys and values are just void pointers. `CFArray` does exactly this.

Lastly, what I needed the most was to be able to convert a `CFMutableDictionary` into a `CFDictionary`. This allows me to borrow an immutable `CFDictionary` via the `ItemRef` type basically. It's possible to work around this and actually have owned instances of a `CFDictionary` and a `CFMutableDictionary` pointing to the same actual dictionary by doing this:
```rust
let mut_dict = CFMutableDictionary::new();
let mut_dict2 = mut_dict.clone();
let dict = mut_dict.as_immutable();
// Here one can mutate the dict via `mut_dict2` while `dict` is still in scope/alive.
```
But since we already allow cloning a `CFMutableDictionary` to have two mutable references to the same dictionary I guess someone decided this should be viewed as safe. Both `CFDictionary` and `CFMutableDictionary` does not implement `Send` so we should not end up in any actual thread inconsistencies here.

If the above is indeed considered safe, I could get rid of the `ItemRef` juggling and just make it `fn as_immutable(&self) -> CFDictionary` directly maybe? Would simplify usage.

<!-- 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/265)
<!-- Reviewable:end -->
2018-10-29 08:57:26 -04:00
bors-servo 3239e415ef Auto merge of #266 - pcwalton:new-appkit-versions, r=emilio
Add constants for new AppKit versions through El Capitan.

I need this to fix `winit`, because Mojave has some new behavior around
layer-backed views and version sniffing is the easiest way to detect when I need to handle it.

This also bumps the version to 0.18.3.

r? @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/266)
<!-- Reviewable:end -->
2018-10-27 19:56:19 -04:00
Patrick Walton 95f3257573 Add constants for new AppKit versions through El Capitan.
I need this to fix `winit`, because Mojave has some new behavior around
layer-backed views and version sniffing is the easiest way to detect when I
need to handle it.

This also bumps the version to 0.18.3.
2018-10-25 11:51:04 -07:00
Linus Färnstrand 1cb7f0816f Change as_immutable to to_immutable 2018-10-23 09:38:46 +02:00
Linus Färnstrand c539fbc644 Fix indentation 2018-10-23 09:38:46 +02:00
Linus Färnstrand f8c0f59a48 Add as_immutable to CFMutableDictionary 2018-10-23 09:38:46 +02:00
Linus Färnstrand 57170cf838 Allow converting dictionaries to their untyped counterparts 2018-10-23 09:38:46 +02:00
Linus Färnstrand 8ca2746589 Implement ConcreteCFType for CFDictionary<*void, *void> 2018-10-23 09:38:35 +02:00
Linus Färnstrand 1dd66bd610 Add conversion from CFDictionary to CFMutableDictionary 2018-10-19 10:27:24 +02:00
bors-servo 105fd39dd3 Auto merge of #264 - pcwalton:version-bump-0.18.2, r=jdm
Bump some versions

r? @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/264)
<!-- Reviewable:end -->
2018-10-16 18:48:28 -04:00
Patrick Walton 33ed5ec8e6 Bump some versions 2018-10-16 15:46:01 -07:00
bors-servo 88d5222139 Auto merge of #263 - pcwalton:add-sublayer, r=jdm
Add a few more bindings to `CALayer` and `CFBundle`

r? @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/263)
<!-- Reviewable:end -->
2018-10-16 18:37:47 -04:00
Patrick Walton 6eb7c9d1cb Add bindings to CFBundleGetBundleWithIdentifier and
`CFBundleGetFunctionPointerForName`.
2018-10-16 15:34:43 -07:00
Patrick Walton 5b4f4ebf42 Add bindings to -[CALayer addSublayer:] and -[CALayer setContentsOpaque:]. 2018-10-16 15:34:40 -07:00
bors-servo e7d90872c4 Auto merge of #262 - servo:jdm-patch-1, r=jrmuizel
Update version of core-foundation for core-text.

<!-- 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/262)
<!-- Reviewable:end -->
2018-10-10 08:30:48 -04:00
bors-servo b92a14275e Auto merge of #261 - jrmuizel:rustkit, r=jdm
Mention RustKit for people that might be interested.

<!-- 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/261)
<!-- Reviewable:end -->
2018-10-10 01:10:34 -04:00