-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update all gtk crates to 18.x #2391
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ hdr = ["piet-common/hdr"] | |
serde = ["piet-common/serde"] | ||
|
||
[dependencies] | ||
piet-common = "0.6.2" | ||
piet-common = { git = "https://github.com/linebender/piet.git", rev = "303b9a932de61cca5a12a8a1ecfbba742638dc52" } | ||
|
||
tracing = "0.1.37" | ||
once_cell = "1.17.1" | ||
|
@@ -100,14 +100,14 @@ bitflags = "1.3.2" | |
[target.'cfg(any(target_os = "freebsd", target_os="linux", target_os="openbsd"))'.dependencies] | ||
ashpd = { version = "0.3.2", optional = true } | ||
# TODO(x11/dependencies): only use feature "xcb" if using X11 | ||
cairo-rs = { version = "0.16.7", default-features = false, features = ["xcb"] } | ||
cairo-sys-rs = { version = "0.16.3", default-features = false, optional = true } | ||
cairo-rs = { version = "0.18.0", default-features = false, features = ["xcb"] } | ||
cairo-sys-rs = { version = "0.18.0", default-features = false, optional = true } | ||
futures = { version = "0.3.26", optional = true, features = ["executor"]} | ||
gdk-sys = { version = "0.16.0", optional = true } | ||
gdk-sys = { version = "0.18.0", optional = true } | ||
# `gtk` gets renamed to `gtk-rs` so that we can use `gtk` as the feature name. | ||
gtk-rs = { version = "0.16.2", package = "gtk", optional = true } | ||
glib-sys = { version = "0.16.3", optional = true } | ||
gtk-sys = { version = "0.16.0", optional = true } | ||
gtk-rs = { version = "0.18.0", package = "gtk", optional = true } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from gtk, you can go to |
||
glib-sys = { version = "0.18.0", optional = true } | ||
gtk-sys = { version = "0.18.0", optional = true } | ||
nix = { version = "0.24.3", optional = true } | ||
x11rb = { version = "0.10.1", features = ["allow-unsafe-code", "present", "render", "randr", "xfixes", "xkb", "resource_manager", "cursor"], optional = true } | ||
wayland-client = { version = "0.29.5", optional = true } | ||
|
@@ -127,7 +127,7 @@ version = "0.3.61" | |
features = ["Window", "MouseEvent", "CssStyleDeclaration", "WheelEvent", "KeyEvent", "KeyboardEvent", "Navigator"] | ||
|
||
[dev-dependencies] | ||
piet-common = { version = "0.6.2", features = ["png"] } | ||
piet-common = { git = "https://github.com/linebender/piet.git", rev = "303b9a932de61cca5a12a8a1ecfbba742638dc52", features = ["png"] } | ||
static_assertions = "1.1.0" | ||
test-log = { version = "0.2.11", features = ["trace"], default-features = false } | ||
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -24,12 +24,12 @@ use std::slice; | |||
use std::sync::{Arc, Mutex, Weak}; | ||||
use std::time::Instant; | ||||
|
||||
use cairo::glib::{Propagation, ControlFlow}; | ||||
use gtk::gdk_pixbuf::Colorspace::Rgb; | ||||
use gtk::gdk_pixbuf::Pixbuf; | ||||
use gtk::glib::source::Continue; | ||||
use gtk::glib::translate::FromGlib; | ||||
use gtk::prelude::*; | ||||
use gtk::traits::SettingsExt; | ||||
use gtk::traits::GtkSettingsExt; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
already part of the prelude |
||||
use gtk::{AccelGroup, ApplicationWindow, DrawingArea}; | ||||
|
||||
use gdk_sys::GdkKeymapKey; | ||||
|
@@ -427,7 +427,7 @@ impl WindowBuilder { | |||
.connect_enter_notify_event(|widget, _| { | ||||
widget.grab_focus(); | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you imported it above |
||||
}); | ||||
|
||||
// Set the minimum size | ||||
|
@@ -539,7 +539,7 @@ impl WindowBuilder { | |||
} | ||||
} | ||||
|
||||
Inhibit(false) | ||||
cairo::glib::Propagation::Proceed | ||||
})); | ||||
|
||||
win_state.drawing_area.connect_screen_changed( | ||||
|
@@ -595,7 +595,7 @@ impl WindowBuilder { | |||
}); | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state.drawing_area.connect_button_release_event(clone!(handle => move |_widget, event| { | ||||
|
@@ -622,7 +622,7 @@ impl WindowBuilder { | |||
}); | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state.drawing_area.connect_motion_notify_event( | ||||
|
@@ -643,7 +643,7 @@ impl WindowBuilder { | |||
state.with_handler(|h| h.mouse_move(&mouse_event)); | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
}), | ||||
); | ||||
|
||||
|
@@ -653,7 +653,7 @@ impl WindowBuilder { | |||
state.with_handler(|h| h.mouse_leave()); | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
}), | ||||
); | ||||
|
||||
|
@@ -709,7 +709,7 @@ impl WindowBuilder { | |||
} | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state | ||||
|
@@ -727,7 +727,7 @@ impl WindowBuilder { | |||
); | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state | ||||
|
@@ -745,7 +745,7 @@ impl WindowBuilder { | |||
); | ||||
} | ||||
|
||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state | ||||
|
@@ -754,7 +754,7 @@ impl WindowBuilder { | |||
if let Some(state) = handle.state.upgrade() { | ||||
state.with_handler(|h| h.got_focus()); | ||||
} | ||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state | ||||
|
@@ -763,17 +763,21 @@ impl WindowBuilder { | |||
if let Some(state) = handle.state.upgrade() { | ||||
state.with_handler(|h| h.lost_focus()); | ||||
} | ||||
Inhibit(true) | ||||
cairo::glib::Propagation::Stop | ||||
})); | ||||
|
||||
win_state | ||||
.window | ||||
.connect_delete_event(clone!(handle => move |_widget, _ev| { | ||||
if let Some(state) = handle.state.upgrade() { | ||||
state.with_handler(|h| h.request_close()); | ||||
Inhibit(!state.closing.get()) | ||||
if !state.closing.get() { | ||||
Propagation::Stop | ||||
} else { | ||||
Propagation::Proceed | ||||
} | ||||
} else { | ||||
Inhibit(false) | ||||
cairo::glib::Propagation::Proceed | ||||
} | ||||
})); | ||||
|
||||
|
@@ -1221,9 +1225,9 @@ impl WindowHandle { | |||
if let Some(state) = self.state.upgrade() { | ||||
gtk::glib::timeout_add(interval, move || { | ||||
if state.with_handler(|h| h.timer(token)).is_some() { | ||||
return Continue(false); | ||||
return ControlFlow::Break; | ||||
} | ||||
Continue(true) | ||||
ControlFlow::Continue | ||||
}); | ||||
} | ||||
token | ||||
|
@@ -1382,7 +1386,7 @@ impl IdleHandle { | |||
} | ||||
} | ||||
|
||||
fn run_idle(state: &Arc<WindowState>) -> Continue { | ||||
fn run_idle(state: &Arc<WindowState>) -> ControlFlow { | ||||
util::assert_main_thread(); | ||||
let result = state.with_handler(|handler| { | ||||
let queue: Vec<_> = std::mem::take(&mut state.idle_queue.lock().unwrap()); | ||||
|
@@ -1404,7 +1408,7 @@ fn run_idle(state: &Arc<WindowState>) -> Continue { | |||
let timeout = Duration::from_millis(16); | ||||
gtk::glib::timeout_add(timeout, move || run_idle(&state)); | ||||
} | ||||
Continue(false) | ||||
ControlFlow::Break | ||||
} | ||||
|
||||
fn make_gdk_cursor(cursor: &Cursor, gdk_window: &Window) -> Option<gtk::gdk::Cursor> { | ||||
|
@@ -1504,7 +1508,7 @@ fn make_key_event(key: &EventKey, repeat: bool, state: KeyState) -> KeyEvent { | |||
let keyval = key.keyval(); | ||||
let hardware_keycode = key.hardware_keycode(); | ||||
|
||||
let keycode = hardware_keycode_to_keyval(hardware_keycode).unwrap_or_else(|| keyval.clone()); | ||||
let keycode = hardware_keycode_to_keyval(hardware_keycode).unwrap_or(keyval); | ||||
|
||||
let text = keyval.to_unicode(); | ||||
let mods = get_modifiers(key.state()); | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to explicitly depend on this, you can get it from
cairo::ffi