2186 Commits

Author SHA1 Message Date
Anthony Eid 6f844cf1a1 Fix get_descriptors memory leak (#746)
This function incorrectly assumed that
`CTFontCollectionCreateMatchingFontDescriptors` doesn't follow the
*Create* rule which is false.

From Apple's docs

> A retained reference to an array of normalized font descriptors
  matching the collection definition.

https://leopard-adc.pepas.com/documentation/Carbon/Reference/CTFontCollectionRef/Reference/reference.html#//apple_ref/c/func/CTFontCollectionCreateMatchingFontDescriptors

I also confirmed using instruments that this was causing a memory leak
in Zed.
2026-01-15 21:38:44 +00:00
Josh Matthews 6a8e54e54d Publish core-text 0.21.0. (#738)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-01-15 12:26:19 +00:00
Martin Robinson 3944c6a1af Upgrade MSRV to 1.68 and remove macos-13 builder (#747)
This should fix the build on CI.

Co-authored-by: @sagudev

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-01-15 10:13:02 +00:00
zhoujiaweii 7342edde37 chore: remove redundant word in comment (#740)
Signed-off-by: zhoujiaweii <zjwustc@outlook.com>
2025-08-29 11:00:01 +00:00
Yash Joshi ab22f7ac45 core-text: Add has_table method wrapping CTFontHasTable (#739)
* core-text:Add has_table method wrapping CTFontHasTable

* Fix Build by make lifetimes explicit

* fix clippy lints in array.rs and propertylist.rs
2025-08-28 05:42:24 +00:00
David Stern 0bcad1e103 Fix unwrap panic in extract_number_for_key in impl TraitAccessorPrivate for CTFontTraits on macOS Ventura. (#735)
* fix ventura crash

* formatting

---------

Co-authored-by: alokedesai <aloke@warp.dev>
2025-07-13 06:28:35 +00:00
Josh Matthews 13cd1142e5 Fix clippy lints. (#736) 2025-07-13 05:38:26 +00:00
Josh Matthews 1626428a0b Use latest CI workflow from other servo repos. (#733)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-27 08:48:48 +00:00
Tyler Mandry 14d8c7fb82 Bump core-graphics to v0.25.0 (#722)
* Bump core-graphics to 0.25.0

Signed-off-by: Tyler Mandry <tmandry@gmail.com>

* Update Cargo.toml

Signed-off-by: Tyler Mandry <tmandry@gmail.com>

---------

Signed-off-by: Tyler Mandry <tmandry@gmail.com>
2025-05-27 01:39:27 +00:00
nashaofu c97cdc6c46 Remove duplicate definitions of CGWindow-related constants and types (#659) 2025-05-26 19:26:39 +00:00
Bruce Mitchener 7928f6ffc9 Remove core_graphics::private::CGSRegion (#700)
This is a private API on macOS. This code was added for use
in `servo-glutin` and was not used outside of that as far as
I know (by doing various code searches).

Fixes #656.
2025-05-26 19:23:14 +00:00
Tyler Mandry f0882ea7c2 [breaking][core-graphics] Enforce Sendness of CGEventTap callback (soundness fix) (#725)
* Make CGEventTap #[must_use]

This prevents a failure mode of handling the Result of CGEventTap::new()
but not saving the tap itself.

* Enforce Sendness of CGEventTap callback

This was previously unsound.
2025-05-26 19:21:27 +00:00
Jay Madden 0e484ab3df fix: add catalina feature flag to srgb binding (#719) 2025-05-26 19:00:32 +00:00
Tyler Mandry 7e4d907137 Allow dropping event from CGEventTap callback (#724) 2025-05-26 18:49:04 +00:00
Tyler Mandry 548b65cd30 Bump core-foundation to 0.10.1 (#706)
Signed-off-by: Tyler Mandry <tmandry@gmail.com>
2025-05-26 12:19:26 +00:00
Mads Marquart f07616dfa3 Bump patch version in deprecated crates (#732) 2025-05-23 14:07:14 +00:00
Mads Marquart 61b90e72da Deprecate cocoa, cocoa-foundation and io-surface and link to objc2 crates instead (#731)
* Deprecate cocoa-foundation

* Deprecate cocoa

* Deprecate io-surface
2025-05-16 16:46:10 +00:00
alphaArgon 0e783c6355 Fix isEqualToString memory leak (#730) 2025-04-23 07:52:10 +00:00
Tyler Mandry d7202b3451 Fix CI (#723)
* Fix check-cfg error in CI

* Fix clippy::precedence warning

* Mark semver checks as optional while they are failing
2025-03-16 21:04:30 +00:00
Bruce Mitchener 49078e1f0f Update CI (#718)
* Stop using macos-12 since GitHub Actions no longer provides it.
* Start using macos-15.
* Update typos CLI to current version.
2025-01-08 06:20:58 +00:00
Bruce Mitchener f23baea603 Fix clippy::needless_lifetimes lints (#717)
* Fix `clippy::needless_lifetimes` lints

* Fix `clippy::doc_markdown` lints
2025-01-08 05:20:49 +00:00
Jay Madden 94373819a7 core-graphics: add binding for CGColorCreateSRGB (#716)
Signed-off-by: Jay Madden <25359755+Jay-Madden@users.noreply.github.com>
2025-01-07 10:20:59 +00:00
pentamassiv 8c71d0f34f core-graphics: Add CGKeyCodes for numpad keys (#712)
* core-graphics: Add CGKeyCodes for numkey as well as ANSI, ISO and JIS keys

* Fix tiny English nit

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-12-09 14:52:38 +00:00
Gaauwe Rombouts f6e7580a35 fix: update NSWindowTabbingMode enum values (#714)
Signed-off-by: Gaauwe Rombouts <gromdroid@gmail.com>
2024-11-12 23:52:58 +00:00
Iason Paraskevopoulos ef896fee16 core-graphics: add event set_location (#713)
* core-graphics: add event set_location

* core-graphics: add documentation to CGEvent functions

Adds documentation to CGEventTapEnable and CGEventSetLocation.
2024-10-15 07:14:11 +00:00
Tyler Mandry 66be81ae13 [breaking][core-graphics] Fix unsoundness in CGEventTap API (#710)
* Fix unsoundness in CGEventTap API

* Fix lifetime unsoundness in CGEventTap, add ::with
2024-10-12 02:23:16 +00:00
Lucas Nogueira cf4c9c06c5 core-graphics: remove set_font_smoothing_style API, closes #707 (#709)
The `CGContextSetFontSmoothingStyle` API is private, and Apple rejects it for the App Store.

See #707 for more information.
2024-08-30 20:03:51 +00:00
Bruce Mitchener b2fdaf4132 Update to 2021 edition. (#704) 2024-08-14 02:17:03 +00:00
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
Mads Marquart 6541d9a789 Fix invalid msg_send! (#702) 2024-08-13 12:04:01 +00:00
Tyler Mandry 9d8c74ea34 Fix TCFType macros for generic types (#652)
* Improve TCFType macros

This adds the following new features:

* `declare_TCFType!`: Generics are accepted.
* `impl_TCFType!`: Non-defaulted generics are accepted, and impls are
  fixed to be for all generics.

In addition, some warnings are silenced and the macros no longer depend
on any traits being in scope in the caller.

* Support generics in impl_CFComparison

* Add generic test for macros
2024-08-13 11:13:17 +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 84b8365425 Use CFIndex::MAX rather than CFIndex::max_value() (#699)
Since `CFIndex` is just `isize`, we can use the `CFIndex::MAX`
constant. The `max_value` and other functions are pending
deprecation and cause a clippy lint warning.
2024-08-12 02:42:23 +00:00
Bruce Mitchener 9d6b64153d ci: Add typos check (#697) 2024-08-12 01:28:59 +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 b10b72c0cc core-foundation: Use dep syntax for with-uuid feature. (#691)
This removes an implicit feature due to the optional dependency
`uuid`.

While this is user visible, any use of `uuid` as a feature previously
would not have enabled the support code and so it wouldn't have had
any benefit.
2024-08-11 20:25:03 +00:00
Bruce Mitchener 4dac7cfd68 core-graphics-types: Remove dep on bitflags (#695)
This is unused.
2024-08-11 20:24:38 +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
Xiaopeng Li b10f1efc48 Retain calayer after creation (#546)
* Retain calayer after creation

* Fix fmt

* fix create_calayer test
2024-08-09 16:48:56 +00:00
Ngo Iok Ui (Wu Yu Wei) 652bab0a62 Bump version of core-foundation-sys to 0.8.7 (#683)
* Bump version of core-foundation-sys to 0.9.0

* Bump patch version instead
2024-08-09 16:47:06 +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
Kornel 3570256ecc Avoid UB if the CFData pointer is NULL (#688) 2024-07-14 17:50:44 +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 6940925635 Remove remaining chrono code. (#682)
In 9721646053, the `with-chrono`
feature was removed, but this dead code lingered.
2024-05-27 07:01:47 +00:00
Bruce Mitchener c2cca87e8c ci: Remove usage of macos-11 (#681)
* ci: Remove usage of macos-11

This is being removed at GitHub on June 28, 2024.

Switch semver action to macos-14.

* Use `macos-14` instead of `macos-14.0` for semver check

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-05-27 06:47:45 +00:00