Skip to content
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

Time coord #314

Merged
merged 4 commits into from Sep 11, 2019
Merged

Time coord #314

merged 4 commits into from Sep 11, 2019

Conversation

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Sep 8, 2019

impl Uninitialized for TimeCoord {
#[inline]
unsafe fn uninitialized() -> Self {
mem::zeroed()

This comment has been minimized.

Copy link
@EPashkin

EPashkin Sep 8, 2019

Member

Why not MaybeUninit?

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Sep 8, 2019

Author Member

I'll check it. Good catch!

@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Sep 8, 2019

@GuillaumeGomez Thanks, 👍

src/atom.rs Outdated
@@ -58,7 +58,7 @@ impl GlibPtrDefault for Atom {
impl Uninitialized for Atom {
#[inline]
unsafe fn uninitialized() -> Self {
mem::zeroed()
mem::MaybeUninit::zeroed().assume_init()

This comment has been minimized.

Copy link
@sdroege

sdroege Sep 9, 2019

Member

This does not actually bring any advantage over mem::zeroed(). It's still UB if all-zeroes is not a valid representation of the type.

Also see gtk-rs/gir#808 . Why add more Uninitialized impls :)

@@ -83,6 +83,7 @@ mod keys;
mod rectangle;

This comment has been minimized.

Copy link
@sdroege

sdroege Sep 9, 2019

Member

Typo in commit message: TimeDoord -> TimeCoord

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Sep 9, 2019

lgtm otherwise

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Sep 9, 2019

Also needs to be applied to gdk4. Same code basically.

n_events.as_mut_ptr(),
));
if ret {
Some(FromGlibContainer::from_glib_full_num(

This comment has been minimized.

Copy link
@sdroege

sdroege Sep 9, 2019

Member

Unhappy CI

error[E0277]: the trait bound `time_coord::TimeCoord: glib::translate::FromGlibContainerAsVec<_, *mut *mut gdk_sys::GdkTimeCoord>` is not satisfied

   --> src/auto/device.rs:188:22

    |

188 |                 Some(FromGlibContainer::from_glib_full_num(

    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `glib::translate::FromGlibContainerAsVec<_, *mut *mut gdk_sys::GdkTimeCoord>` is not implemented for `time_coord::TimeCoord`

    |

    = note: required because of the requirements on the impl of `glib::translate::FromGlibContainer<_, *mut *mut gdk_sys::GdkTimeCoord>` for `std::vec::Vec<time_coord::TimeCoord>`

    = note: required by `glib::translate::FromGlibContainer::from_glib_full_num`
use glib_sys::gconstpointer;
use gobject_sys;
use std::convert::{AsRef, From};
use std::mem;

This comment has been minimized.

Copy link
@sdroege

sdroege Sep 9, 2019

Member
warning: unused import: `glib`

 --> src/time_coord.rs:6:5

  |

6 | use glib;

  |     ^^^^

warning: unused import: `glib_sys::gconstpointer`

 --> src/time_coord.rs:9:5

  |

9 | use glib_sys::gconstpointer;

  |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `gobject_sys`

  --> src/time_coord.rs:10:5

   |

10 | use gobject_sys;

   |     ^^^^^^^^^^^

warning: unused imports: `AsRef`, `From`

  --> src/time_coord.rs:11:20

   |

11 | use std::convert::{AsRef, From};

   |                    ^^^^^  ^^^^

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:time-coord branch from 715faf9 to 5f51d59 Sep 10, 2019
&mut events,
n_events.as_mut_ptr(),
));
if ret {

This comment has been minimized.

Copy link
@sdroege

sdroege Sep 11, 2019

Member

This is inverted. if !ret { return None; } would be correct

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Sep 11, 2019

Author Member

Good catch!

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:time-coord branch from 5f51d59 to 12c0216 Sep 11, 2019
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Sep 11, 2019

Looks good to me now

@GuillaumeGomez GuillaumeGomez merged commit 8cc49a0 into gtk-rs:master Sep 11, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:time-coord branch Sep 11, 2019
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Sep 11, 2019

Now also the same for gdk4 :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Sep 11, 2019

Already on it. :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.