Skip to content

Commit 976bc93

Browse files
committed
public docs and error messages
1 parent 765016f commit 976bc93

File tree

16 files changed

+39
-39
lines changed

16 files changed

+39
-39
lines changed

druid-shell/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ by [druid], a UI toolkit.
88

99
The code in `druid-shell` can be divided into roughly two categories: the
1010
platform agnostic code and types, which are exposed directly, and the
11-
platform-specific implementations of these types, which live in per-platform
12-
directories in `src/platform`. The platform-specific code for the current
13-
platform is reexported as `druid-shell::platform`.
11+
platform-specific implementations of these types, which live in per-backend
12+
directories in `src/backend`. The backend-specific code for the current
13+
backend is reexported as `druid-shell::backend`.
1414

15-
`druid-shell` does not generally expose platform types directly. Instead, we
15+
`druid-shell` does not generally expose backend types directly. Instead, we
1616
expose wrapper structs that define the common interface, and then call
17-
corresponding methods on the concrete type for the current platform.
17+
corresponding methods on the concrete type for the current backend.
1818

1919
## Unsafe
2020

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

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

15-
//! GTK platform errors.
15+
//! GTK backend errors.
1616
1717
use std::fmt;
1818

1919
use glib::{BoolError, Error as GLibError};
2020

21-
/// GTK platform errors.
21+
/// GTK backend errors.
2222
#[derive(Debug, Clone)]
2323
pub enum Error {
2424
/// Generic GTK error.

druid-shell/src/backend/gtk/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-
//! GTK-based platform support
15+
//! GTK-based backend support
1616
1717
pub mod application;
1818
pub mod clipboard;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use super::keycodes;
5757
use super::menu::Menu;
5858
use super::util;
5959

60-
/// The platform target DPI.
60+
/// The backend target DPI.
6161
///
6262
/// GTK considers 96 the default value which represents a 1.0 scale factor.
6363
const SCALE_TARGET_DPI: f64 = 96.0;

druid-shell/src/backend/mac/error.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 platform errors.
15+
//! macOS backend errors.
1616
1717
//TODO: add a backend error for macOS, based on NSError
1818

druid-shell/src/backend/mac/keyboard.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-
//! Conversion of platform keyboard event into cross-platform event.
15+
//! Conversion of backend keyboard event into cross-platform event.
1616
1717
use cocoa::appkit::{NSEvent, NSEventModifierFlags, NSEventType};
1818
use cocoa::base::id;

druid-shell/src/backend/shared/keyboard.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-
//! Keyboard logic that is shared by more than one platform.
15+
//! Keyboard logic that is shared by more than one backend.
1616
1717
#[allow(unused)]
1818
use keyboard_types::{Code, Location};

druid-shell/src/backend/shared/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-
//! Logic that is shared by more than one platform.
15+
//! Logic that is shared by more than one backend.
1616
1717
cfg_if::cfg_if! {
1818
if #[cfg(any(target_os = "macos", target_os = "linux"))] {

druid-shell/src/backend/web/error.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-
//! Web platform errors.
15+
//! Web backend errors.
1616
1717
use wasm_bindgen::JsValue;
1818

druid-shell/src/backend/web/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-
//! Web-based platform support
15+
//! Web-based backend support
1616
1717
pub mod application;
1818
pub mod clipboard;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use winapi::um::winbase::{
2727

2828
use super::util::FromWide;
2929

30-
/// Windows platform error.
30+
/// Windows backend error.
3131
#[derive(Debug, Clone)]
3232
pub enum Error {
3333
/// Windows error code.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ use crate::window::{
7979
FileDialogToken, IdleToken, TextFieldToken, TimerToken, WinHandler, WindowLevel,
8080
};
8181

82-
/// The platform target DPI.
82+
/// The backend target DPI.
8383
///
8484
/// Windows considers 96 the default value which represents a 1.0 scale factor.
8585
pub(crate) const SCALE_TARGET_DPI: f64 = 96.0;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ impl Application {
606606

607607
pub fn clipboard(&self) -> Clipboard {
608608
// TODO(x11/clipboard): implement Application::clipboard
609-
tracing::warn!("Application::clipboard is currently unimplemented for X11 platforms.");
609+
tracing::warn!("Application::clipboard is currently unimplemented for X11 backend.");
610610
Clipboard {}
611611
}
612612

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,35 @@ pub struct Clipboard;
2323
impl Clipboard {
2424
pub fn put_string(&mut self, _s: impl AsRef<str>) {
2525
// TODO(x11/clipboard): implement Clipboard::put_string
26-
warn!("Clipboard::put_string is currently unimplemented for X11 platforms.");
26+
warn!("Clipboard::put_string is currently unimplemented for X11 backend.");
2727
}
2828

2929
pub fn put_formats(&mut self, _formats: &[ClipboardFormat]) {
3030
// TODO(x11/clipboard): implement Clipboard::put_formats
31-
warn!("Clipboard::put_formats is currently unimplemented for X11 platforms.");
31+
warn!("Clipboard::put_formats is currently unimplemented for X11 backend.");
3232
}
3333

3434
pub fn get_string(&self) -> Option<String> {
3535
// TODO(x11/clipboard): implement Clipboard::get_string
36-
warn!("Clipboard::set_string is currently unimplemented for X11 platforms.");
36+
warn!("Clipboard::set_string is currently unimplemented for X11 backend.");
3737
None
3838
}
3939

4040
pub fn preferred_format(&self, _formats: &[FormatId]) -> Option<FormatId> {
4141
// TODO(x11/clipboard): implement Clipboard::preferred_format
42-
warn!("Clipboard::preferred_format is currently unimplemented for X11 platforms.");
42+
warn!("Clipboard::preferred_format is currently unimplemented for X11 backend.");
4343
None
4444
}
4545

4646
pub fn get_format(&self, _format: FormatId) -> Option<Vec<u8>> {
4747
// TODO(x11/clipboard): implement Clipboard::get_format
48-
warn!("Clipboard::get_format is currently unimplemented for X11 platforms.");
48+
warn!("Clipboard::get_format is currently unimplemented for X11 backend.");
4949
None
5050
}
5151

5252
pub fn available_type_names(&self) -> Vec<String> {
5353
// TODO(x11/clipboard): implement Clipboard::available_type_names
54-
warn!("Clipboard::available_type_names is currently unimplemented for X11 platforms.");
54+
warn!("Clipboard::available_type_names is currently unimplemented for X11 backend.");
5555
vec![]
5656
}
5757
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ pub struct Menu;
2121
impl Menu {
2222
pub fn new() -> Menu {
2323
// TODO(x11/menus): implement Menu::new (currently a no-op)
24-
tracing::warn!("Menu::new is currently unimplemented for X11 platforms.");
24+
tracing::warn!("Menu::new is currently unimplemented for X11 backend.");
2525
Menu {}
2626
}
2727

2828
pub fn new_for_popup() -> Menu {
2929
// TODO(x11/menus): implement Menu::new_for_popup (currently a no-op)
30-
tracing::warn!("Menu::new_for_popup is currently unimplemented for X11 platforms.");
30+
tracing::warn!("Menu::new_for_popup is currently unimplemented for X11 backend.");
3131
Menu {}
3232
}
3333

3434
pub fn add_dropdown(&mut self, mut _menu: Menu, _text: &str, _enabled: bool) {
3535
// TODO(x11/menus): implement Menu::add_dropdown (currently a no-op)
36-
tracing::warn!("Menu::add_dropdown is currently unimplemented for X11 platforms.");
36+
tracing::warn!("Menu::add_dropdown is currently unimplemented for X11 backend.");
3737
}
3838

3939
pub fn add_item(
@@ -45,11 +45,11 @@ impl Menu {
4545
_selected: bool,
4646
) {
4747
// TODO(x11/menus): implement Menu::add_item (currently a no-op)
48-
tracing::warn!("Menu::add_item is currently unimplemented for X11 platforms.");
48+
tracing::warn!("Menu::add_item is currently unimplemented for X11 backend.");
4949
}
5050

5151
pub fn add_separator(&mut self) {
5252
// TODO(x11/menus): implement Menu::add_separator (currently a no-op)
53-
tracing::warn!("Menu::add_separator is currently unimplemented for X11 platforms.");
53+
tracing::warn!("Menu::add_separator is currently unimplemented for X11 backend.");
5454
}
5555
}

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl WindowBuilder {
163163

164164
pub fn show_titlebar(&mut self, _show_titlebar: bool) {
165165
// not sure how to do this, maybe _MOTIF_WM_HINTS?
166-
warn!("WindowBuilder::show_titlebar is currently unimplemented for X11 platforms.");
166+
warn!("WindowBuilder::show_titlebar is currently unimplemented for X11 backend.");
167167
}
168168

169169
pub fn set_transparent(&mut self, transparent: bool) {
@@ -877,7 +877,7 @@ impl Window {
877877

878878
/// Set whether the window should show titlebar
879879
fn show_titlebar(&self, _show_titlebar: bool) {
880-
warn!("Window::show_titlebar is currently unimplemented for X11 platforms.");
880+
warn!("Window::show_titlebar is currently unimplemented for X11 backend.");
881881
}
882882

883883
fn get_position(&self) -> Point {
@@ -1644,12 +1644,12 @@ impl WindowHandle {
16441644
}
16451645

16461646
pub fn content_insets(&self) -> Insets {
1647-
warn!("WindowHandle::content_insets unimplemented for X11 platforms.");
1647+
warn!("WindowHandle::content_insets unimplemented for X11 backend.");
16481648
Insets::ZERO
16491649
}
16501650

16511651
pub fn set_level(&self, _level: WindowLevel) {
1652-
warn!("WindowHandle::set_level unimplemented for X11 platforms.");
1652+
warn!("WindowHandle::set_level unimplemented for X11 backend.");
16531653
}
16541654

16551655
pub fn set_size(&self, size: Size) {
@@ -1670,16 +1670,16 @@ impl WindowHandle {
16701670
}
16711671

16721672
pub fn set_window_state(&self, _state: window::WindowState) {
1673-
warn!("WindowHandle::set_window_state is currently unimplemented for X11 platforms.");
1673+
warn!("WindowHandle::set_window_state is currently unimplemented for X11 backend.");
16741674
}
16751675

16761676
pub fn get_window_state(&self) -> window::WindowState {
1677-
warn!("WindowHandle::get_window_state is currently unimplemented for X11 platforms.");
1677+
warn!("WindowHandle::get_window_state is currently unimplemented for X11 backend.");
16781678
window::WindowState::Restored
16791679
}
16801680

16811681
pub fn handle_titlebar(&self, _val: bool) {
1682-
warn!("WindowHandle::handle_titlebar is currently unimplemented for X11 platforms.");
1682+
warn!("WindowHandle::handle_titlebar is currently unimplemented for X11 backend.");
16831683
}
16841684

16851685
pub fn bring_to_front_and_focus(&self) {
@@ -1800,19 +1800,19 @@ impl WindowHandle {
18001800

18011801
pub fn open_file(&mut self, _options: FileDialogOptions) -> Option<FileDialogToken> {
18021802
// TODO(x11/file_dialogs): implement WindowHandle::open_file
1803-
warn!("WindowHandle::open_file is currently unimplemented for X11 platforms.");
1803+
warn!("WindowHandle::open_file is currently unimplemented for X11 backend.");
18041804
None
18051805
}
18061806

18071807
pub fn save_as(&mut self, _options: FileDialogOptions) -> Option<FileDialogToken> {
18081808
// TODO(x11/file_dialogs): implement WindowHandle::save_as
1809-
warn!("WindowHandle::save_as is currently unimplemented for X11 platforms.");
1809+
warn!("WindowHandle::save_as is currently unimplemented for X11 backend.");
18101810
None
18111811
}
18121812

18131813
pub fn show_context_menu(&self, _menu: Menu, _pos: Point) {
18141814
// TODO(x11/menus): implement WindowHandle::show_context_menu
1815-
warn!("WindowHandle::show_context_menu is currently unimplemented for X11 platforms.");
1815+
warn!("WindowHandle::show_context_menu is currently unimplemented for X11 backend.");
18161816
}
18171817

18181818
pub fn get_idle_handle(&self) -> Option<IdleHandle> {

0 commit comments

Comments
 (0)