2021-02-20 17:02:34 +00:00
|
|
|
[package]
|
|
|
|
name = "gpui"
|
|
|
|
version = "0.1.0"
|
2024-01-03 20:59:39 +00:00
|
|
|
edition = "2021"
|
|
|
|
authors = ["Nathan Sobo <nathan@zed.dev>"]
|
2024-01-18 23:52:16 +00:00
|
|
|
description = "Zed's GPU-accelerated UI framework"
|
2023-01-18 20:28:02 +00:00
|
|
|
publish = false
|
2024-01-23 15:56:22 +00:00
|
|
|
license = "Apache-2.0"
|
2024-01-23 16:40:30 +00:00
|
|
|
|
2024-03-05 17:01:17 +00:00
|
|
|
[lints]
|
|
|
|
workspace = true
|
|
|
|
|
2024-01-03 20:59:39 +00:00
|
|
|
[features]
|
2024-03-19 17:16:18 +00:00
|
|
|
default = []
|
2024-05-29 21:15:29 +00:00
|
|
|
test-support = [
|
|
|
|
"backtrace",
|
|
|
|
"collections/test-support",
|
|
|
|
"util/test-support",
|
|
|
|
"http/test-support",
|
|
|
|
]
|
2024-01-31 16:37:16 +00:00
|
|
|
runtime_shaders = []
|
2024-05-29 16:50:45 +00:00
|
|
|
macos-blade = ["blade-graphics", "blade-macros", "blade-util", "bytemuck"]
|
2024-01-03 20:59:39 +00:00
|
|
|
|
2021-11-30 19:46:39 +00:00
|
|
|
[lib]
|
|
|
|
path = "src/gpui.rs"
|
2022-03-04 00:15:56 +00:00
|
|
|
doctest = false
|
2021-11-30 19:46:39 +00:00
|
|
|
|
2021-02-20 17:02:34 +00:00
|
|
|
[dependencies]
|
2024-01-31 02:41:29 +00:00
|
|
|
anyhow.workspace = true
|
2024-01-04 10:39:52 +00:00
|
|
|
async-task = "4.7"
|
2022-03-01 16:01:52 +00:00
|
|
|
backtrace = { version = "0.3", optional = true }
|
2024-02-16 21:39:40 +00:00
|
|
|
blade-graphics = { workspace = true, optional = true }
|
|
|
|
blade-macros = { workspace = true, optional = true }
|
2024-05-29 16:50:45 +00:00
|
|
|
blade-util = { workspace = true, optional = true }
|
2024-02-16 21:39:40 +00:00
|
|
|
bytemuck = { version = "1", optional = true }
|
2024-02-06 19:41:36 +00:00
|
|
|
collections.workspace = true
|
2023-04-25 00:41:55 +00:00
|
|
|
ctor.workspace = true
|
2023-08-06 18:45:31 +00:00
|
|
|
derive_more.workspace = true
|
2024-03-16 11:59:18 +00:00
|
|
|
env_logger.workspace = true
|
2021-03-23 14:15:41 +00:00
|
|
|
etagere = "0.2"
|
2023-04-25 00:41:55 +00:00
|
|
|
futures.workspace = true
|
2024-02-16 21:39:40 +00:00
|
|
|
font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "5a5c4d4" }
|
2024-02-06 19:41:36 +00:00
|
|
|
gpui_macros.workspace = true
|
2024-05-10 21:50:20 +00:00
|
|
|
http.workspace = true
|
2024-06-25 13:12:45 +00:00
|
|
|
image = "0.25.1"
|
2024-02-26 01:37:52 +00:00
|
|
|
itertools.workspace = true
|
2023-04-25 00:41:55 +00:00
|
|
|
lazy_static.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
linkme = "0.3"
|
2023-04-25 00:41:55 +00:00
|
|
|
log.workspace = true
|
2021-02-20 23:05:36 +00:00
|
|
|
num_cpus = "1.13"
|
2021-07-20 18:22:02 +00:00
|
|
|
parking = "2.0.0"
|
2023-04-25 00:41:55 +00:00
|
|
|
parking_lot.workspace = true
|
2021-02-20 17:02:34 +00:00
|
|
|
pathfinder_geometry = "0.5"
|
2023-04-25 00:41:55 +00:00
|
|
|
postage.workspace = true
|
2024-02-22 18:59:52 +00:00
|
|
|
profiling.workspace = true
|
2023-04-25 00:41:55 +00:00
|
|
|
rand.workspace = true
|
2024-02-04 06:39:44 +00:00
|
|
|
raw-window-handle = "0.6"
|
2023-08-18 07:03:46 +00:00
|
|
|
refineable.workspace = true
|
2024-04-11 02:12:05 +00:00
|
|
|
resvg = { version = "0.41.0", default-features = false }
|
|
|
|
usvg = { version = "0.41.0", default-features = false }
|
2024-01-31 02:41:29 +00:00
|
|
|
schemars.workspace = true
|
2021-04-13 17:03:56 +00:00
|
|
|
seahash = "4.1"
|
2024-03-29 16:11:57 +00:00
|
|
|
semantic_version.workspace = true
|
2023-04-25 00:41:55 +00:00
|
|
|
serde.workspace = true
|
|
|
|
serde_derive.workspace = true
|
|
|
|
serde_json.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
slotmap = "1.0.6"
|
2023-04-25 00:41:55 +00:00
|
|
|
smallvec.workspace = true
|
|
|
|
smol.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
sum_tree.workspace = true
|
2024-05-10 13:05:50 +00:00
|
|
|
taffy = "0.4.3"
|
2023-09-06 21:22:29 +00:00
|
|
|
thiserror.workspace = true
|
2023-04-25 00:41:55 +00:00
|
|
|
time.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
util.workspace = true
|
2024-04-12 14:53:10 +00:00
|
|
|
uuid.workspace = true
|
2021-07-20 18:22:02 +00:00
|
|
|
waker-fn = "1.1.0"
|
2021-02-20 23:05:36 +00:00
|
|
|
|
2021-03-24 17:20:25 +00:00
|
|
|
[dev-dependencies]
|
2022-03-01 16:01:52 +00:00
|
|
|
backtrace = "0.3"
|
2024-02-06 19:41:36 +00:00
|
|
|
collections = { workspace = true, features = ["test-support"] }
|
|
|
|
util = { workspace = true, features = ["test-support"] }
|
2024-05-10 21:50:20 +00:00
|
|
|
http = { workspace = true, features = ["test-support"] }
|
2024-06-26 04:06:50 +00:00
|
|
|
unicode-segmentation.workspace = true
|
2021-03-24 17:20:25 +00:00
|
|
|
|
2024-06-25 03:26:24 +00:00
|
|
|
[build-dependencies]
|
|
|
|
embed-resource = "2.4"
|
|
|
|
|
2024-03-28 17:22:31 +00:00
|
|
|
[target.'cfg(target_os = "macos")'.build-dependencies]
|
2024-01-03 20:59:39 +00:00
|
|
|
bindgen = "0.65.1"
|
|
|
|
cbindgen = "0.26.0"
|
|
|
|
|
2021-02-20 17:02:34 +00:00
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
2021-04-14 14:30:03 +00:00
|
|
|
block = "0.1"
|
2024-06-11 18:43:12 +00:00
|
|
|
cocoa.workspace = true
|
2024-02-24 02:18:06 +00:00
|
|
|
core-foundation.workspace = true
|
2024-02-16 21:39:40 +00:00
|
|
|
core-graphics = "0.23"
|
|
|
|
core-text = "20.1"
|
|
|
|
foreign-types = "0.5"
|
2023-04-25 00:41:55 +00:00
|
|
|
log.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
media.workspace = true
|
2024-02-16 21:39:40 +00:00
|
|
|
metal = "0.25"
|
2021-02-20 17:02:34 +00:00
|
|
|
objc = "0.2"
|
2024-01-26 07:08:48 +00:00
|
|
|
|
2024-03-03 18:53:22 +00:00
|
|
|
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
|
2024-01-26 07:08:48 +00:00
|
|
|
flume = "0.11"
|
2024-03-03 18:53:22 +00:00
|
|
|
blade-graphics.workspace = true
|
|
|
|
blade-macros.workspace = true
|
2024-05-29 16:50:45 +00:00
|
|
|
blade-util.workspace = true
|
2024-03-03 18:53:22 +00:00
|
|
|
bytemuck = "1"
|
2024-06-15 22:23:00 +00:00
|
|
|
cosmic-text = { git = "https://github.com/pop-os/cosmic-text", rev = "542b20c" }
|
2024-03-03 18:53:22 +00:00
|
|
|
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
2024-03-28 17:22:31 +00:00
|
|
|
as-raw-xcb-connection = "1"
|
2024-05-29 21:15:29 +00:00
|
|
|
ashpd.workspace = true
|
2024-06-18 17:04:19 +00:00
|
|
|
calloop = "0.13.0"
|
|
|
|
calloop-wayland-source = "0.3.0"
|
2024-06-18 22:07:45 +00:00
|
|
|
wayland-backend = { version = "0.3.3", features = ["client_system", "dlopen"] }
|
2024-03-08 16:14:47 +00:00
|
|
|
wayland-client = { version = "0.31.2" }
|
2024-03-03 19:28:20 +00:00
|
|
|
wayland-cursor = "0.31.1"
|
2024-03-08 16:14:47 +00:00
|
|
|
wayland-protocols = { version = "0.31.2", features = [
|
|
|
|
"client",
|
|
|
|
"staging",
|
|
|
|
"unstable",
|
|
|
|
] }
|
2024-05-06 16:53:08 +00:00
|
|
|
wayland-protocols-plasma = { version = "0.2.0", features = ["client"] }
|
2024-03-25 14:27:16 +00:00
|
|
|
oo7 = "0.3.0"
|
2024-03-28 17:22:31 +00:00
|
|
|
open = "5.1.2"
|
2024-04-22 23:20:24 +00:00
|
|
|
filedescriptor = "0.8.2"
|
2024-04-29 23:07:54 +00:00
|
|
|
x11rb = { version = "0.13.0", features = [
|
|
|
|
"allow-unsafe-code",
|
|
|
|
"xkb",
|
|
|
|
"randr",
|
|
|
|
"xinput",
|
2024-05-06 20:05:00 +00:00
|
|
|
"cursor",
|
2024-04-29 23:07:54 +00:00
|
|
|
"resource_manager",
|
|
|
|
] }
|
2024-03-28 17:22:31 +00:00
|
|
|
xkbcommon = { version = "0.7", features = ["wayland", "x11"] }
|
2024-05-29 21:15:29 +00:00
|
|
|
xim = { git = "https://github.com/npmania/xim-rs", rev = "27132caffc5b9bc9c432ca4afad184ab6e7c16af", features = [
|
|
|
|
"x11rb-xcb",
|
|
|
|
"x11rb-client",
|
|
|
|
] }
|
2024-06-21 23:32:32 +00:00
|
|
|
font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "5a5c4d4", features = ["source-fontconfig-dlopen"] }
|
2024-06-18 17:04:19 +00:00
|
|
|
x11-clipboard = "0.9.2"
|
linux/x11: Custom run loop with `mio` instead of `calloop` (#13646)
This changes the implementation of the X11 client to use `mio`, as a
polling mechanism, and a custom run loop instead of `calloop` and its
callback-based approach.
We're doing this for one big reason: more control over how we handle
events.
With `calloop` we don't have any control over which events are processed
when and how long they're processes for. For example: we could be
blasted with 150 input events from X11 and miss a frame while processing
them, but instead of then drawing a new frame, calloop could decide to
work off the runnables that were generated from application-level code,
which would then again cause us to be behind.
We kinda worked around some of that in
https://github.com/zed-industries/zed/pull/12839 but the problem still
persists.
So what we're doing here is to use `mio` as a polling-mechanism. `mio`
notifies us if there are X11 on the XCB connection socket to be
processed. We also use its timeout mechanism to make sure that we don't
wait for events when we should render frames.
On top of `mio` we now have a custom run loop that allows us to decide
how much time to spend on what — input events, rendering windows, XDG
events, runnables — and in what order we work things off.
This custom run loop is consciously "dumb": we render all windows at the
highest frame rate right now, because we want to keep things predictable
for now while we test this approach more. We can then always switch to
more granular timings. But considering that our loop runs and checks for
windows to be redrawn whenever there's an event, this is more an
optimization than a requirement.
One reason for why we're doing this for X11 but not for Wayland is due
to how peculiar X11's event handling is: it's asynchronous and by
default X11 generates synthetic events when a key is held down. That can
lead to us being flooded with input events if someone keeps a key
pressed.
So another optimization that's in here is inspired by [GLFW's X11 input
handling](https://github.com/glfw/glfw/blob/b35641f4a3c62aa86a0b3c983d163bc0fe36026d/src/x11_window.c#L1321-L1349):
based on a heuristic we detect whether a `KeyRelease` event was
auto-generated and if so, we drop it. That essentially halves the amount
of events we have to process when someone keeps a key pressed.
Release Notes:
- N/A
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Conrad <conrad@zed.dev>
2024-07-03 15:05:26 +00:00
|
|
|
mio = { version = "1.0.0", features = ["os-poll", "os-ext"] }
|
2024-03-03 18:53:22 +00:00
|
|
|
|
2024-03-03 19:58:31 +00:00
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
|
|
windows.workspace = true
|
2024-06-14 17:12:20 +00:00
|
|
|
windows-core = "0.57"
|
2024-06-18 17:04:19 +00:00
|
|
|
clipboard-win = "3.1.1"
|
2024-02-22 09:18:34 +00:00
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "hello_world"
|
|
|
|
path = "examples/hello_world.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "image"
|
2024-03-11 07:56:45 +00:00
|
|
|
path = "examples/image/image.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "set_menus"
|
|
|
|
path = "examples/set_menus.rs"
|
2024-06-26 04:06:50 +00:00
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "input"
|
|
|
|
path = "examples/input.rs"
|