Commit Graph

137 Commits

Author SHA1 Message Date
Bruce Mitchener 6610aaa1ff Fix clippy::doc_markdown lints. (#705) 2024-08-14 02:16:33 +00:00
Matt Bray 743b793f75 feat(CGDisplay): add displays_with_point and displays_with_rect (#657)
* feat(CGDisplay): add displays_with_point and displays_with_rect

* inline to match other fns in this module

* add tests for CGDisplay::displays_with_point and displays_with_rect

* refactor: use kCGErrorSuccess
2024-08-14 02:12:10 +00:00
Bruce Mitchener fb71d45b30 Enable clippy, suppress lots, fix a couple. (#703)
This enables clippy in CI and suppresses most of the existing
warnings. We can drill down and fix those later, but this will
help start getting things under control.
2024-08-13 04:25:49 +00:00
Bruce Mitchener 39a39555c0 Use workspace inheritance. (#701)
Consolidate package configuration where possible. This also
removes the `homepage` key as it only points to the repository
so isn't providing anything additional.

Use workspace dependencies for the crates provided by the workspace
and used within the workspace. This centralizes the version number
maintenance a bit.
2024-08-12 07:41:37 +00:00
Bruce Mitchener e513e990dc Correct screen capture access return values. (#698)
Both `CGRequestScreenCaptureAccess` and `CGPreflightScreenCaptureAccess`
return `bool`, not `boolean_t`.

Fixes #677.
Replaces #678.
2024-08-12 01:27:32 +00:00
Bruce Mitchener 9f33b121fb Use core::ffi over std::os::raw and libc::c_* (#692)
`core::ffi` is the preferred way to access these type definitions.
Begin removing uses of the versions from `libc`.

`libc::c_void` is not exactly the same as `core::ffi::c_void` but
some code has tried using them interchangeably (like in io-surface).

`libc::size_t` is `usize` on all current platforms.
2024-08-11 20:24:22 +00:00
Bruce Mitchener 42ec06106d Bump MSRV to 1.65 (#694)
This will allow us to use `dep:` syntax and also move to using types
from `core::ffi` as well as some other more modern constructs.
2024-08-11 16:15:49 +00:00
Marco Mastropaolo f94fa25c02 Added ffi bindings for CGDisplayRegisterReconfigurationCallback and related types/funcs (#687) 2024-08-02 06:15:35 +00:00
Bruce Mitchener 31a92cd2fc Fix typos. (#689) 2024-07-20 10:26:35 +00:00
Bruce Mitchener 2847e06cf5 core-graphics: Fix kCGWindowSharingReadWrite value (#690) 2024-07-20 10:25:46 +00:00
Marco Mastropaolo 8002ddd167 Fixes a minor race condition in active_displays (#686)
Fixes a minor race condition in active_displays that might happen
	if a display is removed between the active_display_count and the
	CGGetActiveDisplayList. In that case the returned vec would be
	inconsistent and contain one (or more) spurious null displays.

	Note: the returned value will always be subject to TOC/TOU,
	of course, but this specific case has the returned value
	containing invalid displays with id=0 that were never supposed
	to be in the returned value in any possible state of the
	displays; this commit fixes this case.
2024-06-18 14:39:29 +00:00
Bruce Mitchener 8d2b732db5 Remove usages of extern crate. (#672) 2024-05-27 06:40:54 +00:00
George Burton abbcc1eea5 Update bitflags to 2.2.1 (#549) 2024-04-09 08:47:41 +00:00
Alex Touchet f9440bcddb Update/remove obsolete badges and update link (#663) 2024-04-08 10:27:33 +00:00
Dirkjan Ochtman 9721646053 foundation: remove optional chrono dependency (#666)
* foundation: remove optional chrono dependency

* Bump version numbers for semver-incompatible changes
2024-04-08 10:20:45 +00:00
Martin Robinson d7879eb353 core-graphics: Add more metrics functions to CGFont (#661) 2024-04-04 19:28:23 +00:00
Jeff Muizelaar dd284a07f4 Bump the patch version. (#662)
The change to kCGWindowListOptionAll was technically semver breaking
but the constants were wrong before so it should be fine.
2024-04-04 17:14:38 +00:00
nashaofu 0933af08be fix: Correcting errors in window CGWindowListOption values (#653) 2024-01-13 12:21:17 +00:00
Bruce Mitchener 58972aef0a Update to 2018 edition. (#642)
This is the minimum fix required. It updates to use crate-relative
imports.
2023-10-24 00:30:22 +00:00
Bruce Mitchener 3ff7cc2795 docs: Fix various markdown issues. (#639) 2023-10-10 15:22:46 +00:00
Leo Kettmeir c4f4ad20b6 feat: add link feature (#608)
adjust docs

Update cocoa/Cargo.toml

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>

fmt
2023-10-10 14:46:20 +00:00
Bruce Mitchener e589abe82e Make license files consistent. (#625)
Each crate now has a symlink to the root level license files.
Previously, some did, some had copies, and some had nothing.

Fixes #503.
2023-08-13 12:20:16 +00:00
Bruce Mitchener 18df9aafe7 Some clippy fixes. (#624) 2023-08-03 14:20:26 +00:00
Bruce Mitchener 062041a921 docs.rs: Document with all-features enabled. (#626)
This will help people find the functionality that is feature-gated.

Fixes #540.
2023-08-01 15:29:29 +00:00
micolous b009c87f2d Auto-format code with "cargo fmt" and check in CI (#615)
* add rustfmt check to CI

* Run "cargo fmt" (rustfmt) over core-foundation-rs
2023-07-25 02:22:25 +00:00
Jeff Muizelaar 50fec8dd8d Bump core-graphics version to get cg_event_tap_callback_internal fix. 2023-07-07 11:46:55 -04:00
Jeff Muizelaar f3cf0f1d38 Drop #[no_mangle] from cg_event_tap_callback_internal
This allows multiple versions of core-graphics to be linked into the
same binaries without getting "duplicate symbol: cg_event_tap_callback_internal"
2023-07-07 11:36:20 -04:00
Nicolas Silva 589c97086e Bump core-text, core-graphics and cocoa 2023-06-19 17:07:44 +02:00
michaelwright235 612ef8f9e5 core-graphics: Assign a value to a _ variable
Compiler thinks that we need to use the value, so we use this workaroud
to get rid of a warning.
2023-06-07 02:09:50 +03:00
bors-servo c441d916e1 Auto merge of #560 - fcfangcc:release-0.23.4, r=jdm
Release for core-graphics

Release core-graphics  version to 0.22.4

Include #554 , I urgently need to use it. Thanks 😃
2023-05-29 04:29:36 +02:00
fcfangcc 4c11545a87 release core-graphics 0.22.4 2023-05-29 09:39:15 +08:00
bors-servo d254cec065 Auto merge of #554 - fcfangcc:feat-screenCaptureAccess, r=jdm
Add binding for ScreenCaptureAccess

Add binding for [CGRequestScreenCaptureAccess](https://developer.apple.com/documentation/coregraphics/3656524-cgrequestscreencaptureaccess) and [CGPreflightScreenCaptureAccess](https://developer.apple.com/documentation/coregraphics/3656523-cgpreflightscreencaptureaccess)

 to check if the app has screen recording permission on macOS
2023-05-24 15:53:08 +02:00
bors-servo 8b982fdd57 Auto merge of #548 - burtonageo:update_foreign_types, r=jdm
Update `foreign-types` crate to v0.5

Splits out the `foreign-types` part of https://github.com/servo/core-foundation-rs/pull/545
2023-05-24 15:42:31 +02:00
fcfangcc d8b6ff1723 Add ScreenCaptureAccess struct 2023-05-24 21:23:55 +08:00
fcfangcc 2784e317bd Add binding for ScreenCaptureAccess 2023-05-24 15:50:12 +08:00
mtfcd 75f424f81a Add function from apple document, and add a method image_for_rect for convinient to use. 2023-04-27 00:04:55 -04:00
George Burton 6ddf5cadcc Update foreign-types crate to v0.5 2023-04-25 22:15:52 +01:00
Alex Touchet 1632edee66 Use SPDX license format 2023-04-02 22:43:22 -07:00
Josh Leeb-du Toit 49aa01d437 Add binding for CGEventTapPostEvent
This change adds the binding for CGEventTapPostEvent and adds a wrapper
function CGEvent::post_from_tap to call the core-graphics function.
2023-03-21 15:38:43 +11:00
Alexander Ekdahl 6a0cbbfb3d Add all color space names
Adds all of the non-deprecated color space names found at: https://developer.apple.com/documentation/coregraphics/cgcolorspace/color_space_names
2022-12-24 00:41:31 +01:00
Hein Rutjes 342af5e6a9 Add CGContextResetClip 2022-10-07 07:43:07 -04:00
Hein Rutjes 3213c3e3f3 Add CGContextSetAlpha 2022-10-06 13:50:31 -04:00
Mads Marquart 560da05fef Add CoreGraphics FFI used by winit 2022-09-05 13:33:55 +02:00
Alex Touchet 5143684bb5 Fix listed core-graphics homepage 2022-05-26 08:25:16 -04:00
Mikaela Szekely 65b1efcd5d Publish core-graphics 2021-10-27 20:31:00 -06:00
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
Phil Dennis-Jordan c519abad47 Adds function for fetching ID of a core_graphics::display::CGDisplayMode
This adds a mode_id() function on CGDisplayMode which returns the unique (to that display) integer ID the system uses to identify the display mode. It internally calls down to CGDisplayModeGetIODisplayModeID() in the CoreGraphics framework. The FFI for this function was previously missing and has also been added.
2021-03-26 15:49:20 +01:00
Jeff Muizelaar d9403529d0 Expose CGFontCopyVariations and CGFontCopyVariationAxes 2021-02-09 20:02:46 -05:00
Asaf Fisher 532a3214be core-graphics: event: Add tests to CGEventTap 2021-01-25 19:58:22 +02:00
Asaf Fisher 19671d30c2 core-graphics: Add CGEventTap object to create an event tap 2021-01-25 19:58:22 +02:00