Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ version = "0.24.1"
edition = "2018"

[dependencies]
cairo-rs = "0.16.1"
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core" }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why you use the git version?
Wasn't there a last update to crates.io before they stopped maintaining those crates?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last version on crates.io of gtk is 0.18.2.
This fork that compiles uses the git version so i just copied it
https://github.com/nikescar/gtk3-rs/blob/master/gtk/Cargo.toml

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 0.18.2 does not compile?
Is this expected or should that be fixed upstream?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 0.18.2 does not compile?

idk maybe it does but when i saw that the git version is newer, i tried and it failed. checked the forks and this one was working

fragile = "2.0"
glib = "0.16.2"
glib-sys = "0.16.0"
gobject-sys = "0.16.0"
gtk = "0.16.1"
gio = { git = "https://github.com/gtk-rs/gtk-rs-core" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
glib-sys = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gtk = { git = "https://github.com/nikescar/gtk3-rs.git", version = "0.19.0" }
libc = "^0.2.54"
log = "^0.4.6"
target-lexicon = "0.13.3"

[features]
hidpi = []
3 changes: 2 additions & 1 deletion src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

use glib::{Cast, IsA, Object};
use glib::Object;
use glib::prelude::{Cast, IsA};
use gtk::{prelude::ContainerExt, prelude::WidgetExt};

use crate::state::EventStream;
Expand Down
4 changes: 2 additions & 2 deletions src/core/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

use std::mem;
use std::mem::{self, size_of};
use std::os::raw::c_int;
use std::ptr;

Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn new_source<T: SourceFuncs>(data: T) -> Source {
funcs.dispatch = Some(dispatch::<T>);
funcs.finalize = Some(finalize::<T>);
let mut funcs = Box::new(funcs);
let source = g_source_new(&mut *funcs, mem::size_of::<SourceData<T>>() as u32);
let source = g_source_new(&mut *funcs, size_of::<SourceData<T>>() as u32);
ptr::write(&mut (*(source as *mut SourceData<T>)).data, data);
ptr::write(&mut (*(source as *mut SourceData<T>)).funcs, funcs);
from_glib_full(source)
Expand Down
8 changes: 3 additions & 5 deletions src/drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ use cairo::{
Format,
ImageSurface,
};
use gtk::{
Inhibit,
prelude::WidgetExt,
};
use glib::Propagation;
use gtk::prelude::WidgetExt;

#[derive(Clone)]
struct Surface {
Expand Down Expand Up @@ -138,7 +136,7 @@ impl<W: Clone + WidgetExt> DrawHandler<W> {
eprintln!("Cannot paint: {:?}", error);
}

Inhibit(false)
Propagation::Proceed
});
}
}
19 changes: 8 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,16 @@ mod widget;
pub use fragile::Fragile;

#[doc(hidden)]
pub use glib::{
Cast,
IsA,
Object,
StaticType,
ToValue,
Value,
};
pub use glib::Object;
#[doc(hidden)]
pub use glib::Value;
#[doc(hidden)]
pub use glib::prelude::{Cast, IsA, StaticType, ToValue};
#[doc(hidden)]
pub use glib::translate::{FromGlibPtrNone, IntoGlib, ToGlibPtr};
#[doc(hidden)]
pub use gobject_sys::{GParameter, g_object_newv};
use glib::Continue;
use glib::ControlFlow;

pub use crate::core::{Channel, EventStream, Sender, StreamHandle};
pub use crate::state::{
Expand Down Expand Up @@ -356,7 +353,7 @@ pub fn interval<F: Fn() -> MSG + 'static, MSG: 'static>(stream: &StreamHandle<MS
glib::timeout_add_local(std::time::Duration::from_millis(duration as u64), move || {
let msg = constructor();
stream.emit(msg);
Continue(true)
ControlFlow::Continue
});
}

Expand All @@ -366,6 +363,6 @@ pub fn timeout<F: Fn() -> MSG + 'static, MSG: 'static>(stream: &StreamHandle<MSG
glib::timeout_add_local(std::time::Duration::from_millis(duration as u64), move || {
let msg = constructor();
stream.emit(msg);
Continue(false)
ControlFlow::Break
});
}
3 changes: 2 additions & 1 deletion src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

use glib::{IsA, Object};
use glib::Object;
use glib::prelude::IsA;

use super::{Relm, run};
use crate::state::Update;
Expand Down
Loading