Skip to content

Commit 2cd22fb

Browse files
authored
Use standardized Druid naming convention. (#2337)
1 parent 5b160d2 commit 2cd22fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+96
-94
lines changed

CHANGELOG.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ You can find its changes [documented below](#070---2021-01-01).
164164
- Added examples in `TextBox` ([#2284] by [@ThomasMcandrew])
165165
- Removed outdated section in docs for `LifeCycle::WidgetAdded` ([#2320] by [@sprocklem])
166166
- Updated `Event::AnimFrame` docs with info about when `paint` happens. ([#2323] by [@xStrom])
167+
- Implemented standardized Druid naming convention. ([#2337] by [@xStrom])
167168

168169
### Examples
169170
- Add readme ([#1423] by [@JAicewizard])
@@ -344,16 +345,16 @@ values and their textual representations. ([#1377])
344345

345346
#### X11 backend for druid-shell.
346347

347-
[@crsaracco] got us started and implemented basic support to run druid on bare-metal X11 in [#599].
348+
[@crsaracco] got us started and implemented basic support to run Druid on bare-metal X11 in [#599].
348349
Additional features got fleshed out in [#894] and [#900] by [@xStrom]
349350
and in [#920], [#961], and [#982] by [@jneem].
350351

351-
While still incomplete this lays the foundation for running druid on Linux without relying on GTK.
352+
While still incomplete this lays the foundation for running Druid on Linux without relying on GTK.
352353

353354
#### Web backend for druid-shell.
354355

355356
[@elrnv] continued the work of [@tedsta] and implemented a mostly complete web backend
356-
via WebAssembly (Wasm) in [#759] and enabled all druid examples to
357+
via WebAssembly (Wasm) in [#759] and enabled all Druid examples to
357358
[run in the browser](https://elrnv.github.io/druid-wasm-examples/).
358359

359360
While some features like the clipboard, menus or file dialogs are not yet available,
@@ -364,8 +365,8 @@ all fundamental features are there.
364365
[@cmyr] continued the work of [@jrmuizel] and implemented Core Graphics support for Piet in
365366
[piet#176](https://github.com/linebender/piet/pull/176).
366367

367-
Those changes made it into druid via [#905].
368-
This means that druid no longer requires cairo on macOS and uses Core Graphics instead.
368+
Those changes made it into Druid via [#905].
369+
This means that Druid no longer requires cairo on macOS and uses Core Graphics instead.
369370

370371
### Added
371372

@@ -494,7 +495,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
494495

495496
### Outside News
496497

497-
- There are new projects using druid:
498+
- There are new projects using Druid:
498499
- [Kondo](https://github.com/tbillington/kondo) Save disk space by cleaning unneeded files from software projects.
499500
- [jack-mixer](https://github.com/derekdreery/jack-mixer) A jack client that provides mixing, levels and a 3-band eq.
500501
- [kiro-synth](https://github.com/chris-zen/kiro-synth) An in progress modular sound synthesizer.
@@ -893,6 +894,7 @@ Last release without a changelog :(
893894
[#2324]: https://github.com/linebender/druid/pull/2324
894895
[#2331]: https://github.com/linebender/druid/pull/2331
895896
[#2335]: https://github.com/linebender/druid/pull/2335
897+
[#2337]: https://github.com/linebender/druid/pull/2337
896898
[#2338]: https://github.com/linebender/druid/pull/2338
897899
[#2340]: https://github.com/linebender/druid/pull/2340
898900
[#2343]: https://github.com/linebender/druid/pull/2343

docs/src/02_getting_started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ On OpenBSD, Druid requires gtk+3; install from packages:
3131

3232
## Starting a project
3333

34-
Create a new cargo binary crate, and add druid as a dependency:
34+
Create a new cargo binary crate, and add `druid` as a dependency:
3535

3636
```sh
3737
> cargo new my-druid-app

docs/src/05_lens.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl Lens<Container2, Name> for NameLens {
108108

109109
As you'll see, we've introduced `Rc`: the reference-counted pointer. You will see this and its multithreaded cousin `Arc` used pervasively in the examples. Now, the only time we actually have to copy memory is when `Rc::make_mut` is called in the `f` in `with_mut`. This means that in the case where nothing changes, all we will be doing is incrementing and decrementing reference counts. Moreover, we give the compiler the opportunity to inline `f` and `with`/`with_mut`, making this abstraction potentially zero-cost (disclaimer: I haven't actually studied the produced assembly to validate this claim).
110110

111-
The trade-off is that we introduce more complexity into the `Name` type: to make changes to the data we have to use `Rc::make_mut` to get mutable access to the `String`. (The code in the lens will ensure that the newer copy of the `Rc`d data is saved to the outer type.) This means the writing fast druid code requires knowledge of the Rust pointer types (`Rc`/`Arc`, and also potentially `RefCell`/`Mutex`).
111+
The trade-off is that we introduce more complexity into the `Name` type: to make changes to the data we have to use `Rc::make_mut` to get mutable access to the `String`. (The code in the lens will ensure that the newer copy of the `Rc`d data is saved to the outer type.) This means the writing fast Druid code requires knowledge of the Rust pointer types (`Rc`/`Arc`, and also potentially `RefCell`/`Mutex`).
112112

113113
We can actually do even better than this. Suppose that we are working on a vector of data rather than a string. We can import the `im` crate to get collections that use *structural sharing*, meaning that even when the vector is mutated, we only *Clone* what we need to. Because `im` is so useful, it is included in `druid` (behind the `im` feature).
114114

docs/src/07_resolution_independence.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ the large image assets would be scaled down to the size that makes sense for the
5454

5555
Druid aims to make all of this as **easy and automatic** as possible.
5656
Druid has expressive vector drawing capabilities that you should use whenever possible.
57-
Vector drawing is also used by the widgets that come included with druid.
57+
Vector drawing is also used by the widgets that come included with Druid.
5858
Handling different pixel densities is done at the `druid-shell` level already.
5959
In fact pixels mostly don't even enter the conversation at the `druid` level.
6060
The `druid` coordinate system is instead measured in **display points** (**dp**),
6161
e.g. you might say a widget has a width of **100dp**.
6262
*Display points* are conceptually similar to Microsoft's *device-independent pixels*,
6363
Google's *density-independent pixels*, Apple's *points*, and CSS's *pixel units*.
6464

65-
You **describe the UI using display points and then druid will automatically
65+
You **describe the UI using display points and then Druid will automatically
6666
translate that into pixels** based on the pixel density of the platform.
6767
Remember there might be multiple displays connected with different pixel densities,
6868
and your application might have multiple windows - with each window on a different display.
69-
It will all just work, because druid will adjust the actual pixel dimensions
69+
It will all just work, because Druid will adjust the actual pixel dimensions
7070
based on the display that the window is currently located on.

druid-derive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "druid-derive"
33
version = "0.4.0"
44
license = "Apache-2.0"
55
authors = ["Druid authors"]
6-
description = "derive impls for druid, a Rust UI toolkit."
6+
description = "derive impls for Druid, a Rust UI toolkit."
77
repository = "https://github.com/linebender/druid"
88
edition = "2018"
99

druid-derive/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# druid-derive
22

3-
This crate is implementations of derive macros for [druid][].
3+
This crate contains the implementations of derive macros for [Druid].
44

5-
[druid]: https://github.com/linebender/druid
5+
[Druid]: https://github.com/linebender/druid

druid-derive/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! derive macros for druid.
15+
//! derive macros for Druid.
1616
1717
#![deny(clippy::trivially_copy_pass_by_ref)]
1818
#![doc(

druid-shell/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "druid-shell"
33
version = "0.7.0"
44
license = "Apache-2.0"
55
authors = ["Raph Levien <[email protected]>"]
6-
description = "Platform abstracting application shell used for druid toolkit."
6+
description = "Platform abstracting application shell used for Druid toolkit."
77
repository = "https://github.com/linebender/druid"
88
readme = "README.md"
99
categories = ["os::macos-apis", "os::windows-apis", "gui"]

druid-shell/examples/edit_text.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! This example shows a how a single-line text field might be implemented for druid-shell.
15+
//! This example shows a how a single-line text field might be implemented for `druid-shell`.
1616
//! Beyond the omission of multiple lines and text wrapping, it also is missing many motions
1717
//! (like "move to previous word") and bidirectional text support.
1818

druid-shell/src/backend/mac/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! macOS druid-shell backend.
15+
//! macOS `druid-shell` backend.
1616
1717
#![allow(clippy::let_unit_value)]
1818

druid-shell/src/backend/mac/window.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ fn set_size_deferred(this: &mut Object, _view_state: &mut ViewState, size: Size)
899899
let current_frame: NSRect = msg_send![window, frame];
900900
let mut new_frame = current_frame;
901901

902-
// maintain druid origin (as mac origin is bottom left)
902+
// maintain Druid origin (as mac origin is bottom left)
903903
new_frame.origin.y -= size.height - current_frame.size.height;
904904
new_frame.size.width = size.width;
905905
new_frame.size.height = size.height;

druid-shell/src/backend/wayland/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum Error {
2727
version: u32,
2828
inner: Arc<wl::GlobalError>,
2929
},
30-
/// An unexpected error occurred. It's not handled by druid-shell/wayland, so you should
30+
/// An unexpected error occurred. It's not handled by `druid-shell`/wayland, so you should
3131
/// terminate the app.
3232
Fatal(Arc<dyn StdError + 'static>),
3333
String(ErrorString),

druid-shell/src/backend/wayland/keyboard.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl Keyboard {
135135
event.mods = self.xkb_mods.get();
136136

137137
if let Err(cause) = keystroke.queue.send(event) {
138-
tracing::error!("failed to send druid key event: {:?}", cause);
138+
tracing::error!("failed to send Druid key event: {:?}", cause);
139139
}
140140
}
141141

druid-shell/src/backend/windows/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! Windows implementation of druid-shell.
15+
//! Windows implementation of `druid-shell`.
1616
1717
mod accels;
1818
pub mod application;
@@ -40,7 +40,7 @@ pub mod window;
4040
//
4141
// https://docs.microsoft.com/en-us/windows/win32/direct2d/devices-and-device-contexts
4242
// A Device Context, ID2D1DeviceContext, is available as of windows 7 platform update. This
43-
// is the minimum compatibility target for druid. We are not making an effort to do
43+
// is the minimum compatibility target for Druid. We are not making an effort to do
4444
// RenderTarget only.
4545
//
4646
// Basically, go from HwndRenderTarget or DxgiSurfaceRenderTarget (2d or 3d) to a Device Context.

druid-shell/src/backend/windows/window.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub enum PresentStrategy {
137137
/// We work hard to avoid calling into `WinHandler` re-entrantly. Since we use
138138
/// the system's event loop, and since the `WinHandler` gets a `WindowHandle` to use, this implies
139139
/// that none of the `WindowHandle`'s methods can return control to the system's event loop
140-
/// (because if it did, the system could call back into druid-shell with some mouse event, and then
140+
/// (because if it did, the system could call back into `druid-shell` with some mouse event, and then
141141
/// we'd try to call the `WinHandler` again).
142142
///
143143
/// The solution is that for every `WindowHandle` method that *wants* to return control to the
@@ -146,12 +146,12 @@ pub enum PresentStrategy {
146146
/// method returns.
147147
///
148148
/// An example call trace might look like:
149-
/// 1. the system hands a mouse click event to druid-shell
150-
/// 2. druid-shell calls `WinHandler::mouse_up`
149+
/// 1. the system hands a mouse click event to `druid-shell`
150+
/// 2. `druid-shell` calls `WinHandler::mouse_up`
151151
/// 3. after some processing, the `WinHandler` calls `WindowHandle::save_as`, which schedules a
152152
/// deferred op and returns immediately
153153
/// 4. after some more processing, `WinHandler::mouse_up` returns
154-
/// 5. druid-shell displays the "save as" dialog that was requested in step 3.
154+
/// 5. `druid-shell` displays the "save as" dialog that was requested in step 3.
155155
enum DeferredOp {
156156
SaveAs(FileDialogOptions, FileDialogToken),
157157
Open(FileDialogOptions, FileDialogToken),

druid-shell/src/backend/x11/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! X11 implementation of druid-shell.
15+
//! X11 implementation of `druid-shell`.
1616
1717
// TODO(x11/render_improvements): screen is currently flashing when resizing in perftest.
1818
// Might be related to the "sleep scheduler" in XWindow::render()?

druid-shell/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! Platform abstraction for druid toolkit.
15+
//! Platform abstraction for Druid toolkit.
1616
//!
1717
//! `druid-shell` is an abstraction around a given platform UI & application
1818
//! framework. It provides common types, which then defer to a platform-defined

druid-shell/src/scale.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::kurbo::{Insets, Line, Point, Rect, Size, Vec2};
2828
/// These display points will be automatically converted into pixels under the hood.
2929
/// One pixel is equal to one display point when the platform scale factor is `1.0`.
3030
///
31-
/// Read more about pixels and display points [in the druid book].
31+
/// Read more about pixels and display points [in the Druid book].
3232
///
3333
/// ## Converting with `Scale`
3434
///
@@ -42,7 +42,7 @@ use crate::kurbo::{Insets, Line, Point, Rect, Size, Vec2};
4242
///
4343
/// [`x`]: #method.x
4444
/// [`y`]: #method.y
45-
/// [in the druid book]: https://linebender.org/druid/resolution_independence.html
45+
/// [in the Druid book]: https://linebender.org/druid/07_resolution_independence.html
4646
#[derive(Copy, Clone, PartialEq, Debug)]
4747
pub struct Scale {
4848
/// The scale factor on the x axis.

druid-shell/src/text.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
//! 3. The user presses a key on the keyboard. The platform first calls
5555
//! `WinHandler::key_down`. If this method returns `true`, the application
5656
//! has indicated the keypress was captured, and we skip the remaining steps.
57-
//! 4. If `key_down` returned `false`, druid-shell forwards the key event to the
57+
//! 4. If `key_down` returned `false`, `druid-shell` forwards the key event to the
5858
//! platform's text input system
5959
//! 5. The platform, in response to either this key event or some other user
6060
//! action, determines it's time for some text input. It calls
@@ -97,7 +97,7 @@
9797
//! ## Supported Platforms
9898
//!
9999
//! Currently, `druid-shell` text input is fully implemented on macOS. Our goal
100-
//! is to have full support for all druid-shell targets, but for now,
100+
//! is to have full support for all `druid-shell` targets, but for now,
101101
//! `InputHandler` calls are simulated from keypresses on other platforms, which
102102
//! doesn't allow for IME input, dead keys, etc.
103103

druid/examples/game_of_life.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! This is an example of how you would implement the game of life with druid.
16-
//! This example doesn't showcase anything specific in druid.
15+
//! This is an example of how you would implement the game of life with Druid.
16+
//! This example doesn't showcase anything specific in Druid.
1717
1818
// On Windows platform, don't show a console when opening the app.
1919
#![windows_subsystem = "windows"]

druid/examples/hello.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! This is a very small example of how to setup a druid application.
15+
//! This is a very small example of how to setup a Druid application.
1616
//! It does the almost bare minimum while still being useful.
1717
1818
// On Windows platform, don't show a console when opening the app.

druid/examples/hello_web/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Druid web hello world
22

3-
This is a minimal example of building a single druid application for the web.
4-
To build all the druid examples for the web, check out the `web` example directory.
3+
This is a minimal example of building a single Druid application for the web.
4+
To build all the Druid examples for the web, check out the `web` example directory.
55

66
## Building
77

druid/examples/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn build_app() -> impl Widget<u32> {
7171
.background(Color::WHITE);
7272
col.add_flex_child(aspect_ratio_box.center(), 1.0);
7373

74-
// This method asks druid to draw colored rectangles around our widgets,
74+
// This method asks Druid to draw colored rectangles around our widgets,
7575
// so we can visually inspect their layout rectangles.
7676
col.debug_paint_layout()
7777
}

0 commit comments

Comments
 (0)