Skip to content

Commit e7ec2d1

Browse files
committed
Druid 0.5
This updates our crate versions, and also updates us to the latest major versions of our dependencies, fixing any breakage. It also removes anything marked as deprecated.
1 parent 933d6a0 commit e7ec2d1

File tree

12 files changed

+409
-339
lines changed

12 files changed

+409
-339
lines changed

Cargo.lock

+376-252
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

druid-derive/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "druid-derive"
3-
version = "0.1.2"
3+
version = "0.2.0"
44
license = "Apache-2.0"
55
authors = ["Druid authors"]
66
description = "derive impls for druid, a Rust UI toolkit."
@@ -16,4 +16,4 @@ quote = "1.0.2"
1616
proc-macro2 = "1.0.4"
1717

1818
[dev-dependencies]
19-
druid = { path = "../druid", version = "0.4.0" }
19+
druid = { path = "../druid", version = "0.5.0" }

druid-shell/Cargo.toml

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "druid-shell"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
license = "Apache-2.0"
55
authors = ["Raph Levien <[email protected]>"]
66
description = "Platform abstracting application shell used for druid toolkit."
@@ -16,18 +16,18 @@ use_gtk = ["gtk", "gtk-sys", "gio", "gdk", "gdk-sys", "glib", "glib-sys", "cairo
1616
default-target = "x86_64-pc-windows-msvc"
1717

1818
[dependencies]
19-
piet-common = "0.0.7"
19+
piet-common = "0.0.8"
2020
log = "0.4.8"
2121
lazy_static = "1.0"
22-
time = "0.1.39"
22+
time = "0.2.4"
2323
cfg-if = "0.1.10"
2424

25-
cairo-rs = { version = "0.7.1", default_features = false, optional = true }
26-
gio = { version = "0.7.0", optional = true }
27-
gdk = { version = "0.11.0", optional = true }
25+
cairo-rs = { version = "0.8.0", default_features = false, optional = true }
26+
gio = { version = "0.8.0", optional = true }
27+
gdk = { version = "0.12.0", optional = true }
2828
gdk-sys = { version = "0.9.0", optional = true }
29-
gtk = { version = "0.7.0", optional = true }
30-
glib = { version = "0.8.1", optional = true }
29+
gtk = { version = "0.8.0", optional = true }
30+
glib = { version = "0.9.1", optional = true }
3131
glib-sys = { version = "0.9.0", optional = true }
3232
gtk-sys = { version = "0.9.0", optional = true }
3333

@@ -44,17 +44,17 @@ features = ["d2d1_1", "dwrite", "winbase", "libloaderapi", "errhandlingapi", "wi
4444
[target.'cfg(target_os="macos")'.dependencies]
4545
cocoa = "0.20.0"
4646
objc = "0.2.5"
47-
cairo-rs = { version = "0.7.1", default_features = false }
47+
cairo-rs = { version = "0.8.0", default_features = false }
4848

4949
[target.'cfg(target_os="linux")'.dependencies]
50-
cairo-rs = { version = "0.7.1", default_features = false }
51-
gio = "0.7.0"
52-
gdk = "0.11.0"
50+
cairo-rs = { version = "0.8.0", default_features = false }
51+
gio = "0.8.0"
52+
gdk = "0.12.0"
5353
gdk-sys = "0.9.0"
54-
glib = "0.8.1"
54+
glib = "0.9.1"
5555
glib-sys = "0.9.0"
5656
gtk-sys = "0.9.0"
5757

5858
[target.'cfg(target_os="linux")'.dependencies.gtk]
59-
version = "0.7.0"
59+
version = "0.8.0"
6060
features = ["v3_20"]

druid-shell/examples/perftest.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std::any::Any;
1616

17-
use time::get_time;
17+
use time::Time;
1818

1919
use piet_common::kurbo::{Line, Rect};
2020
use piet_common::{Color, FontBuilder, Piet, RenderContext, Text, TextLayoutBuilder};
@@ -44,7 +44,8 @@ impl WinHandler for PerfTest {
4444

4545
piet.stroke(Line::new((0.0, height), (width, 0.0)), &FG_COLOR, 1.0);
4646

47-
let th = ::std::f64::consts::PI * (get_time().nsec as f64) * 2e-9;
47+
let current_ns = Time::now().nanosecond();
48+
let th = ::std::f64::consts::PI * (current_ns as f64) * 2e-9;
4849
let dx = 100.0 * th.sin();
4950
let dy = 100.0 * th.cos();
5051
piet.stroke(
@@ -59,8 +60,8 @@ impl WinHandler for PerfTest {
5960
.build()
6061
.unwrap();
6162

62-
let now = get_time();
63-
let now = now.sec as f64 + 1e-9 * now.nsec as f64;
63+
let now = Time::now();
64+
let now = now.second() as f64 + 1e-9 * now.nanosecond() as f64;
6465
let msg = format!("{:3.1}ms", 1e3 * (now - self.last_time));
6566
self.last_time = now;
6667
let layout = piet.text().new_text_layout(&font, &msg).build().unwrap();

druid-shell/src/platform/gtk/dialog.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use std::ffi::OsString;
1818

1919
use crate::dialog::{FileDialogOptions, FileDialogType};
20-
use gtk::{FileChooserAction, FileChooserExt, NativeDialogExt, Window};
20+
use gtk::{FileChooserAction, FileChooserExt, NativeDialogExt, ResponseType, Window};
2121

2222
use crate::Error;
2323

@@ -44,13 +44,13 @@ pub(crate) fn get_file_dialog_path(
4444
let result = dialog.run();
4545

4646
let result = match result {
47-
gtk_sys::GTK_RESPONSE_ACCEPT => match dialog.get_filename() {
47+
ResponseType::Accept => match dialog.get_filename() {
4848
Some(path) => Ok(path.into_os_string()),
4949
None => Err(Error::Other("No path received for filename")),
5050
},
51-
gtk_sys::GTK_RESPONSE_CANCEL => Err(Error::Other("Dialog was deleted")),
51+
ResponseType::Cancel => Err(Error::Other("Dialog was deleted")),
5252
_ => {
53-
eprintln!("Unhandled dialog result: {:?}", result);
53+
log::warn!("Unhandled dialog result: {:?}", result);
5454
Err(Error::Other("Unhandled dialog result"))
5555
}
5656
};

druid-shell/src/platform/gtk/runloop.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
1717
use std::cell::RefCell;
1818

19-
use gio::{ApplicationExt, ApplicationExtManual, ApplicationFlags, Cancellable};
19+
use gio::prelude::ApplicationExtManual;
20+
use gio::{ApplicationExt, ApplicationFlags, Cancellable};
2021
use gtk::Application;
2122

2223
use super::util::assert_main_thread;

druid-shell/src/window.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
//! Platform independent window types.
1616
17-
#![allow(deprecated)] // for the three items that have moved
18-
1917
use std::any::Any;
2018

2119
use crate::dialog::{FileDialogOptions, FileInfo};

druid/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "druid"
3-
version = "0.4.1"
3+
version = "0.5.0"
44
license = "Apache-2.0"
55
authors = ["Raph Levien <[email protected]>"]
66
description = "Data-oriented Rust UI design toolkit."
@@ -27,16 +27,16 @@ fluent-syntax = "0.9.1"
2727
unic-langid = "0.7.1"
2828
unicode-segmentation = "1.3.0"
2929
log = "0.4.8"
30-
usvg = {version = "0.8.0", optional = true}
30+
usvg = {version = "0.9.0", optional = true}
3131

3232
[dependencies.simple_logger]
3333
version = "1.3.0"
3434
default-features = false
3535

3636
[dependencies.druid-shell]
3737
path = "../druid-shell"
38-
version = "0.4.0"
38+
version = "0.5.0"
3939

4040
[dependencies.druid-derive]
4141
path = "../druid-derive"
42-
version = "0.1.1"
42+
version = "0.2.0"

druid/src/widget/flex.rs

+1-36
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ use crate::{
2020
BoxConstraints, Data, Env, Event, EventCtx, LayoutCtx, PaintCtx, UpdateCtx, Widget, WidgetPod,
2121
};
2222

23-
/// A builder for a row widget that can contain flex children.
24-
///
25-
/// The actual widget is implemented by [`Flex`], but this builder
26-
/// is provided for convenience.
27-
///
28-
/// [`Flex`]: struct.Flex.html
29-
pub struct Row;
30-
/// A builder for a column widget that can contain flex children.
31-
///
32-
/// The actual widget is implemented by [`Flex`], but this builder
33-
/// is provided for convenience.
34-
///
35-
/// [`Flex`]: struct.Flex.html
36-
pub struct Column;
37-
3823
/// A container with either horizontal or vertical layout.
3924
pub struct Flex<T: Data> {
4025
direction: Axis,
@@ -46,7 +31,7 @@ struct ChildWidget<T: Data> {
4631
params: Params,
4732
}
4833

49-
pub enum Axis {
34+
pub(crate) enum Axis {
5035
Horizontal,
5136
Vertical,
5237
}
@@ -79,26 +64,6 @@ impl Axis {
7964
}
8065
}
8166

82-
impl Row {
83-
/// Create a new row widget.
84-
///
85-
/// The child widgets are laid out horizontally, from left to right.
86-
#[deprecated(since = "0.4.0", note = "Use Flex::row() instead")]
87-
pub fn new<T: Data>() -> Flex<T> {
88-
Flex::row()
89-
}
90-
}
91-
92-
impl Column {
93-
/// Create a new row widget.
94-
///
95-
/// The child widgets are laid out vertically, from top to bottom.
96-
#[deprecated(since = "0.4.0", note = "Use Flex::column() instead")]
97-
pub fn new<T: Data>() -> Flex<T> {
98-
Flex::column()
99-
}
100-
}
101-
10267
impl<T: Data> Flex<T> {
10368
/// Create a new horizontal stack.
10469
///

druid/src/widget/label.rs

-7
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ impl<T: Data> Label<T> {
6767
}
6868
}
6969

70-
/// Set text alignment.
71-
#[inline]
72-
#[deprecated(since = "0.4.1", note = "use text_align instead")]
73-
pub fn align(self, align: UnitPoint) -> Self {
74-
self.text_align(align)
75-
}
76-
7770
/// Set text alignment.
7871
pub fn text_align(mut self, align: UnitPoint) -> Self {
7972
self.align = align;

druid/src/widget/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub use checkbox::Checkbox;
4646
pub use container::Container;
4747
pub use either::Either;
4848
pub use env_scope::EnvScope;
49-
pub use flex::{Column, Flex, Row};
49+
pub use flex::Flex;
5050
pub use identity_wrapper::IdentityWrapper;
5151
pub use label::{Label, LabelText};
5252
pub use list::{List, ListIter};

druid/src/widget/padding.rs

-12
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,6 @@ pub struct Padding<T: Data> {
3131
}
3232

3333
impl<T: Data> Padding<T> {
34-
/// Create widget with uniform padding.
35-
#[deprecated(since = "0.3.0", note = "Use Padding::new() instead")]
36-
pub fn uniform(padding: f64, child: impl Widget<T> + 'static) -> Padding<T> {
37-
Padding {
38-
left: padding,
39-
right: padding,
40-
top: padding,
41-
bottom: padding,
42-
child: WidgetPod::new(child).boxed(),
43-
}
44-
}
45-
4634
/// Create a new widget with the specified padding. This can either be an instance
4735
/// of [`kurbo::Insets`], a f64 for uniform padding, a 2-tuple for axis-uniform padding
4836
/// or 4-tuple with (left, top, right, bottom) values.

0 commit comments

Comments
 (0)